Skip to content

Commit

Permalink
feat: add version override flags (#92)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Brown <derek.brown@lacework.net>
  • Loading branch information
DerekTBrown authored Jul 29, 2022
1 parent 6930ae8 commit 09ed887
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
uses: ./
with:
version: 'v3.5.1'
yamllint_version: '1.27.1'
yamale_version: '3.0.4'
- name: Check install!
run: |
ct version
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ A GitHub Action for installing the [helm/chart-testing](https://github.com/helm/
For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input)

- `version`: The chart-testing version to install (default: `v3.7.0`)
- `yamllint_version`: The chart-testing version to install (default: `1.27.1`)
- `yamale_version`: The chart-testing version to install (default: `3.0.4`)

### Example Workflow

Expand Down
15 changes: 14 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,21 @@ inputs:
description: "The chart-testing version to install (default: v3.7.0)"
required: false
default: v3.7.0
yamllint_version:
description: "The yamllint version to install (default: 1.27.1)"
required: false
default: '1.27.1'
yamale_version:
description: "The yamale version to install (default: 3.0.4)"
required: false
default: '3.0.4'
runs:
using: composite
steps:
- run: "$GITHUB_ACTION_PATH/ct.sh --version ${{ inputs.version }}"
- run: |
cd $GITHUB_ACTION_PATH \
&& ./ct.sh \
--version ${{ inputs.version }} \
--yamllint-version ${{ inputs.yamllint_version }} \
--yamale-version ${{ inputs.yamale_version }}
shell: bash
28 changes: 26 additions & 2 deletions ct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -o nounset
set -o pipefail

DEFAULT_CHART_TESTING_VERSION=v3.7.0
DEFAULT_YAMLLINT_VERSION=1.27.1
DEFAULT_YAMALE_VERSION=3.0.4

show_help() {
cat << EOF
Expand All @@ -17,6 +19,8 @@ EOF

main() {
local version="$DEFAULT_CHART_TESTING_VERSION"
local yamllint_version="$DEFAULT_YAMLLINT_VERSION"
local yamale_version="$DEFAULT_YAMALE_VERSION"

parse_command_line "$@"

Expand All @@ -40,6 +44,26 @@ parse_command_line() {
exit 1
fi
;;
--yamllint-version)
if [[ -n "${2:-}" ]]; then
yamllint_version="$2"
shift
else
echo "ERROR: '--yamllint-version' cannot be empty." >&2
show_help
exit 1
fi
;;
--yamale-version)
if [[ -n "${2:-}" ]]; then
yamale_version="$2"
shift
else
echo "ERROR: '--yamale-version' cannot be empty." >&2
show_help
exit 1
fi
;;
*)
break
;;
Expand Down Expand Up @@ -76,10 +100,10 @@ install_chart_testing() {
source "$venv_dir/bin/activate"

echo 'Installing yamllint...'
pip3 install yamllint==1.27.1
pip3 install "yamllint==${yamllint_version}"

echo 'Installing Yamale...'
pip3 install yamale==3.0.4
pip3 install "yamale==${yamale_version}"
fi

# https://github.com/helm/chart-testing-action/issues/62
Expand Down

0 comments on commit 09ed887

Please sign in to comment.