@@ -5,6 +5,7 @@ set -o nounset
55set -o pipefail
66
77DEFAULT_CHART_TESTING_VERSION=3.14.0
8+ DEFAULT_VERIFY_BLOB=true
89DEFAULT_YAMLLINT_VERSION=1.33.0
910DEFAULT_YAMALE_VERSION=6.0.0
1011
1920
2021main () {
2122 local version=" ${DEFAULT_CHART_TESTING_VERSION} "
23+ local verify_blob=" ${DEFAULT_VERIFY_BLOB} "
2224 local yamllint_version=" ${DEFAULT_YAMLLINT_VERSION} "
2325 local yamale_version=" ${DEFAULT_YAMALE_VERSION} "
2426
@@ -34,6 +36,16 @@ parse_command_line() {
3436 show_help
3537 exit
3638 ;;
39+ --verify-blob)
40+ if [[ -n " ${2:- } " ]]; then
41+ verify_blob=" ${2# v} "
42+ shift
43+ else
44+ echo " ERROR: '--verify-blob' cannot be empty." >&2
45+ show_help
46+ exit 1
47+ fi
48+ ;;
3749 -v|--version)
3850 if [[ -n " ${2:- } " ]]; then
3951 version=" ${2# v} "
@@ -88,21 +100,28 @@ install_chart_testing() {
88100 local cache_dir=" ${RUNNER_TOOL_CACHE} /ct/${version} /${arch} "
89101 local venv_dir=" ${cache_dir} /venv"
90102
103+ curl --retry 5 --retry-delay 1 -sSLo ct.tar.gz \
104+ " https://github.com/helm/chart-testing/releases/download/v${version} /chart-testing_${version# v} _linux_${arch} .tar.gz"
105+ echo " Installing chart-testing v${version} ..."
106+
91107 if [[ ! -d " ${cache_dir} " ]]; then
92108 mkdir -p " ${cache_dir} "
93109
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
97-
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"
99- cosign verify-blob --certificate " ${CT_CERT} " --signature " ${CT_SIG} " \
100- --certificate-identity " https://github.com/helm/chart-testing/.github/workflows/release.yaml@refs/heads/main" \
101- --certificate-oidc-issuer " https://token.actions.githubusercontent.com" ct.tar.gz
102- retVal=$?
103- if [[ " ${retVal} " -ne 0 ]]; then
104- log_error " Unable to validate chart-testing version: v${version} "
105- exit 1
110+ if [[ " ${verify_blob} " != " false" ]]; then
111+ echo " Verifing blob..."
112+ CT_CERT=https://github.com/helm/chart-testing/releases/download/v${version} /chart-testing_${version# v} _linux_${arch} .tar.gz.pem
113+ CT_SIG=https://github.com/helm/chart-testing/releases/download/v${version} /chart-testing_${version# v} _linux_${arch} .tar.gz.sig
114+
115+ cosign verify-blob --certificate " ${CT_CERT} " --signature " ${CT_SIG} " \
116+ --certificate-identity " https://github.com/helm/chart-testing/.github/workflows/release.yaml@refs/heads/main" \
117+ --certificate-oidc-issuer " https://token.actions.githubusercontent.com" ct.tar.gz
118+ retVal=$?
119+ if [[ " ${retVal} " -ne 0 ]]; then
120+ log_error " Unable to validate chart-testing version: v${version} "
121+ exit 1
122+ fi
123+ else
124+ echo " Skipping verifing blob..."
106125 fi
107126
108127 tar -xzf ct.tar.gz -C " ${cache_dir} "
0 commit comments