-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure HADOLINT_PATH is available where used
Newer versions of `shellcheck` notices when aliases are used in the same parsing context, exposing the alias hack used to invoke custom hadolint paths. The proper solution to allowing custom paths is simpler than that; just read it from environment. As part of this, switch from `:=` notation to `:-` for "set if empty".
- Loading branch information
1 parent
f87b499
commit 9db4f77
Showing
2 changed files
with
12 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
HADOLINT_PATH=${hadolint_path:-"hadolint"} | ||
|
||
function output_hadolint_version() { | ||
local HADOLINT_VERSION="" | ||
# I cannot pass path directly here; both tests and invoking `hadolint` | ||
# directly would fail. | ||
alias hadolint='${HADOLINT_PATH}' | ||
HADOLINT_VERSION="$(hadolint --version | cut -d " " -f 4)" | ||
echo "::set-output name=hadolint_version::${HADOLINT_VERSION}" | ||
local OUTPUT="" | ||
OUTPUT=$(eval "${HADOLINT_PATH}" --version | cut -d " " -f 4) | ||
echo "::set-output name=hadolint_version::${OUTPUT}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters