Skip to content

Commit 09ed887

Browse files
author
Derek Brown
authored
feat: add version override flags (#92)
Signed-off-by: Derek Brown <[email protected]>
1 parent 6930ae8 commit 09ed887

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

.github/workflows/test-action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
uses: ./
4343
with:
4444
version: 'v3.5.1'
45+
yamllint_version: '1.27.1'
46+
yamale_version: '3.0.4'
4547
- name: Check install!
4648
run: |
4749
ct version

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ A GitHub Action for installing the [helm/chart-testing](https://github.com/helm/
1616
For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input)
1717

1818
- `version`: The chart-testing version to install (default: `v3.7.0`)
19+
- `yamllint_version`: The chart-testing version to install (default: `1.27.1`)
20+
- `yamale_version`: The chart-testing version to install (default: `3.0.4`)
1921

2022
### Example Workflow
2123

action.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,21 @@ inputs:
99
description: "The chart-testing version to install (default: v3.7.0)"
1010
required: false
1111
default: v3.7.0
12+
yamllint_version:
13+
description: "The yamllint version to install (default: 1.27.1)"
14+
required: false
15+
default: '1.27.1'
16+
yamale_version:
17+
description: "The yamale version to install (default: 3.0.4)"
18+
required: false
19+
default: '3.0.4'
1220
runs:
1321
using: composite
1422
steps:
15-
- run: "$GITHUB_ACTION_PATH/ct.sh --version ${{ inputs.version }}"
23+
- run: |
24+
cd $GITHUB_ACTION_PATH \
25+
&& ./ct.sh \
26+
--version ${{ inputs.version }} \
27+
--yamllint-version ${{ inputs.yamllint_version }} \
28+
--yamale-version ${{ inputs.yamale_version }}
1629
shell: bash

ct.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ set -o nounset
55
set -o pipefail
66

77
DEFAULT_CHART_TESTING_VERSION=v3.7.0
8+
DEFAULT_YAMLLINT_VERSION=1.27.1
9+
DEFAULT_YAMALE_VERSION=3.0.4
810

911
show_help() {
1012
cat << EOF
@@ -17,6 +19,8 @@ EOF
1719

1820
main() {
1921
local version="$DEFAULT_CHART_TESTING_VERSION"
22+
local yamllint_version="$DEFAULT_YAMLLINT_VERSION"
23+
local yamale_version="$DEFAULT_YAMALE_VERSION"
2024

2125
parse_command_line "$@"
2226

@@ -40,6 +44,26 @@ parse_command_line() {
4044
exit 1
4145
fi
4246
;;
47+
--yamllint-version)
48+
if [[ -n "${2:-}" ]]; then
49+
yamllint_version="$2"
50+
shift
51+
else
52+
echo "ERROR: '--yamllint-version' cannot be empty." >&2
53+
show_help
54+
exit 1
55+
fi
56+
;;
57+
--yamale-version)
58+
if [[ -n "${2:-}" ]]; then
59+
yamale_version="$2"
60+
shift
61+
else
62+
echo "ERROR: '--yamale-version' cannot be empty." >&2
63+
show_help
64+
exit 1
65+
fi
66+
;;
4367
*)
4468
break
4569
;;
@@ -76,10 +100,10 @@ install_chart_testing() {
76100
source "$venv_dir/bin/activate"
77101

78102
echo 'Installing yamllint...'
79-
pip3 install yamllint==1.27.1
103+
pip3 install "yamllint==${yamllint_version}"
80104

81105
echo 'Installing Yamale...'
82-
pip3 install yamale==3.0.4
106+
pip3 install "yamale==${yamale_version}"
83107
fi
84108

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

0 commit comments

Comments
 (0)