Skip to content

Commit a629e84

Browse files
authored
Bump ct and cleanup script (#124)
* add dependabot config Signed-off-by: cpanato <ctadeu@gmail.com> * bump ct to release v3.9.0 and make the input variables similar to each other Signed-off-by: cpanato <ctadeu@gmail.com> --------- Signed-off-by: cpanato <ctadeu@gmail.com>
1 parent 2fffad3 commit a629e84

File tree

5 files changed

+44
-35
lines changed

5 files changed

+44
-35
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
open-pull-requests-limit: 10

.github/workflows/test-action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: test-chart-testing-action
22

3-
on: [pull_request]
3+
on:
4+
pull_request:
45

56
jobs:
67
test_ct_action:
@@ -16,8 +17,8 @@ jobs:
1617
ct version
1718
CT_VERSION_OUTPUT=$(ct version 2>&1 /dev/null)
1819
ACTUAL_VERSION=$(echo "$CT_VERSION_OUTPUT" | grep Version | rev | cut -d ' ' -f1 | rev)
19-
if [[ $ACTUAL_VERSION != 'v3.8.0' ]]; then
20-
echo 'should be v3.8.0'
20+
if [[ $ACTUAL_VERSION != 'v3.9.0' ]]; then
21+
echo 'should be v3.9.0'
2122
exit 1
2223
else
2324
exit 0

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A GitHub Action for installing the [helm/chart-testing](https://github.com/helm/
1515

1616
For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input)
1717

18-
- `version`: The chart-testing version to install (default: `v3.8.0`)
18+
- `version`: The chart-testing version to install (default: `3.9.0`)
1919
- `yamllint_version`: The chart-testing version to install (default: `1.27.1`)
2020
- `yamale_version`: The chart-testing version to install (default: `3.0.4`)
2121

@@ -44,15 +44,15 @@ jobs:
4444
- name: Set up Helm
4545
uses: azure/setup-helm@v3
4646
with:
47-
version: v3.11.2
47+
version: v3.12.1
4848

4949
- uses: actions/setup-python@v4
5050
with:
5151
python-version: '3.9'
5252
check-latest: true
5353

5454
- name: Set up chart-testing
55-
uses: helm/chart-testing-action@v2.4.0
55+
uses: helm/chart-testing-action@v2.5.0
5656

5757
- name: Run chart-testing (list-changed)
5858
id: list-changed
@@ -68,7 +68,7 @@ jobs:
6868

6969
- name: Create kind cluster
7070
if: steps.list-changed.outputs.changed == 'true'
71-
uses: helm/kind-action@v1.4.0
71+
uses: helm/kind-action@v1.7.0
7272

7373
- name: Run chart-testing (install)
7474
if: steps.list-changed.outputs.changed == 'true'

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ branding:
66
icon: anchor
77
inputs:
88
version:
9-
description: "The chart-testing version to install (default: v3.8.0)"
9+
description: "The chart-testing version to install (default: 3.9.0)"
1010
required: false
11-
default: v3.8.0
11+
default: '3.9.0'
1212
yamllint_version:
1313
description: "The yamllint version to install (default: 1.27.1)"
1414
required: false

ct.sh

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -o errexit
44
set -o nounset
55
set -o pipefail
66

7-
DEFAULT_CHART_TESTING_VERSION=v3.8.0
7+
DEFAULT_CHART_TESTING_VERSION=3.9.0
88
DEFAULT_YAMLLINT_VERSION=1.27.1
99
DEFAULT_YAMALE_VERSION=3.0.4
1010

@@ -13,14 +13,14 @@ cat << EOF
1313
Usage: $(basename "$0") <options>
1414
1515
-h, --help Display help
16-
-v, --version The chart-testing version to use (default: $DEFAULT_CHART_TESTING_VERSION)"
16+
-v, --version The chart-testing version to use (default: ${DEFAULT_CHART_TESTING_VERSION})"
1717
EOF
1818
}
1919

2020
main() {
21-
local version="$DEFAULT_CHART_TESTING_VERSION"
22-
local yamllint_version="$DEFAULT_YAMLLINT_VERSION"
23-
local yamale_version="$DEFAULT_YAMALE_VERSION"
21+
local version="${DEFAULT_CHART_TESTING_VERSION}"
22+
local yamllint_version="${DEFAULT_YAMLLINT_VERSION}"
23+
local yamale_version="${DEFAULT_YAMALE_VERSION}"
2424

2525
parse_command_line "$@"
2626

@@ -36,7 +36,7 @@ parse_command_line() {
3636
;;
3737
-v|--version)
3838
if [[ -n "${2:-}" ]]; then
39-
version="$2"
39+
version="${2#v}"
4040
shift
4141
else
4242
echo "ERROR: '-v|--version' cannot be empty." >&2
@@ -74,8 +74,8 @@ parse_command_line() {
7474
}
7575

7676
install_chart_testing() {
77-
if [[ ! -d "$RUNNER_TOOL_CACHE" ]]; then
78-
echo "Cache directory '$RUNNER_TOOL_CACHE' does not exist" >&2
77+
if [[ ! -d "${RUNNER_TOOL_CACHE}" ]]; then
78+
echo "Cache directory '${RUNNER_TOOL_CACHE}' does not exist" >&2
7979
exit 1
8080
fi
8181

@@ -85,35 +85,35 @@ install_chart_testing() {
8585
else
8686
arch=amd64
8787
fi
88-
local cache_dir="$RUNNER_TOOL_CACHE/ct/$version/$arch"
89-
local venv_dir="$cache_dir/venv"
88+
local cache_dir="${RUNNER_TOOL_CACHE}/ct/${version}/${arch}"
89+
local venv_dir="${cache_dir}/venv"
9090

91-
if [[ ! -d "$cache_dir" ]]; then
92-
mkdir -p "$cache_dir"
91+
if [[ ! -d "${cache_dir}" ]]; then
92+
mkdir -p "${cache_dir}"
9393

94-
echo "Installing chart-testing ${version}..."
95-
CT_CERT=https://github.com/helm/chart-testing/releases/download/$version/chart-testing_${version#v}_linux_$arch.tar.gz.pem
96-
CT_SIG=https://github.com/helm/chart-testing/releases/download/$version/chart-testing_${version#v}_linux_$arch.tar.gz.sig
94+
echo "Installing chart-testing v${version}..."
95+
CT_CERT=https://github.com/helm/chart-testing/releases/download/v$version/chart-testing_${version#v}_linux_$arch.tar.gz.pem
96+
CT_SIG=https://github.com/helm/chart-testing/releases/download/v$version/chart-testing_${version#v}_linux_$arch.tar.gz.sig
9797

98-
curl --retry 5 --retry-delay 1 -sSLo ct.tar.gz "https://github.com/helm/chart-testing/releases/download/$version/chart-testing_${version#v}_linux_$arch.tar.gz"
98+
curl --retry 5 --retry-delay 1 -sSLo ct.tar.gz "https://github.com/helm/chart-testing/releases/download/v$version/chart-testing_${version#v}_linux_$arch.tar.gz"
9999
cosign verify-blob --certificate $CT_CERT --signature $CT_SIG \
100100
--certificate-identity "https://github.com/helm/chart-testing/.github/workflows/release.yaml@refs/heads/main" \
101101
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" ct.tar.gz
102102
retVal=$?
103-
if [[ "$retVal" -ne 0 ]]; then
104-
log_error "Unable to validate chart-testing version: ${version}"
103+
if [[ "${retVal}" -ne 0 ]]; then
104+
log_error "Unable to validate chart-testing version: v${version}"
105105
exit 1
106106
fi
107107

108-
tar -xzf ct.tar.gz -C "$cache_dir"
108+
tar -xzf ct.tar.gz -C "${cache_dir}"
109109
rm -f ct.tar.gz
110110

111111
echo 'Creating virtual Python environment...'
112-
python3 -m venv "$venv_dir"
112+
python3 -m venv "${venv_dir}"
113113

114114
echo 'Activating virtual environment...'
115115
# shellcheck disable=SC1090
116-
source "$venv_dir/bin/activate"
116+
source "${venv_dir}/bin/activate"
117117

118118
echo 'Installing yamllint...'
119119
pip3 install "yamllint==${yamllint_version}"
@@ -124,16 +124,16 @@ install_chart_testing() {
124124

125125
# https://github.com/helm/chart-testing-action/issues/62
126126
echo 'Adding ct directory to PATH...'
127-
echo "$cache_dir" >> "$GITHUB_PATH"
127+
echo "${cache_dir}" >> "${GITHUB_PATH}"
128128

129129
echo 'Setting CT_CONFIG_DIR...'
130-
echo "CT_CONFIG_DIR=$cache_dir/etc" >> "$GITHUB_ENV"
130+
echo "CT_CONFIG_DIR=${cache_dir}/etc" >> "${GITHUB_ENV}"
131131

132132
echo 'Configuring environment variables for virtual environment for subsequent workflow steps...'
133-
echo "VIRTUAL_ENV=$venv_dir" >> "$GITHUB_ENV"
134-
echo "$venv_dir/bin" >> "$GITHUB_PATH"
133+
echo "VIRTUAL_ENV=${venv_dir}" >> "${GITHUB_ENV}"
134+
echo "${venv_dir}/bin" >> "${GITHUB_PATH}"
135135

136-
"$cache_dir/ct" version
136+
"${cache_dir}/ct" version
137137
}
138138

139139
main "$@"

0 commit comments

Comments
 (0)