From 11af945a756ce40f04a827c99011d3393d63966c Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 11 Jul 2023 08:52:03 +0200 Subject: [PATCH 1/2] add dependabot config Signed-off-by: cpanato --- .github/dependabot.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..93353ed --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +--- +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 10 From 7959ac5310b190659c93d90ce629b5af16fcfc08 Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 11 Jul 2023 08:52:43 +0200 Subject: [PATCH 2/2] bump ct to release v3.9.0 and make the input variables similar to each other Signed-off-by: cpanato --- .github/workflows/test-action.yml | 7 +++-- README.md | 8 ++--- action.yml | 4 +-- ct.sh | 52 +++++++++++++++---------------- 4 files changed, 36 insertions(+), 35 deletions(-) diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index 1f88377..b3aad88 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -1,6 +1,7 @@ name: test-chart-testing-action -on: [pull_request] +on: + pull_request: jobs: test_ct_action: @@ -16,8 +17,8 @@ jobs: ct version CT_VERSION_OUTPUT=$(ct version 2>&1 /dev/null) ACTUAL_VERSION=$(echo "$CT_VERSION_OUTPUT" | grep Version | rev | cut -d ' ' -f1 | rev) - if [[ $ACTUAL_VERSION != 'v3.8.0' ]]; then - echo 'should be v3.8.0' + if [[ $ACTUAL_VERSION != 'v3.9.0' ]]; then + echo 'should be v3.9.0' exit 1 else exit 0 diff --git a/README.md b/README.md index 94f0587..87da19f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ 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.8.0`) +- `version`: The chart-testing version to install (default: `3.9.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`) @@ -44,7 +44,7 @@ jobs: - name: Set up Helm uses: azure/setup-helm@v3 with: - version: v3.11.2 + version: v3.12.1 - uses: actions/setup-python@v4 with: @@ -52,7 +52,7 @@ jobs: check-latest: true - name: Set up chart-testing - uses: helm/chart-testing-action@v2.4.0 + uses: helm/chart-testing-action@v2.5.0 - name: Run chart-testing (list-changed) id: list-changed @@ -68,7 +68,7 @@ jobs: - name: Create kind cluster if: steps.list-changed.outputs.changed == 'true' - uses: helm/kind-action@v1.4.0 + uses: helm/kind-action@v1.7.0 - name: Run chart-testing (install) if: steps.list-changed.outputs.changed == 'true' diff --git a/action.yml b/action.yml index 980bd1e..77fa9e6 100644 --- a/action.yml +++ b/action.yml @@ -6,9 +6,9 @@ branding: icon: anchor inputs: version: - description: "The chart-testing version to install (default: v3.8.0)" + description: "The chart-testing version to install (default: 3.9.0)" required: false - default: v3.8.0 + default: '3.9.0' yamllint_version: description: "The yamllint version to install (default: 1.27.1)" required: false diff --git a/ct.sh b/ct.sh index b76da48..9f1dad6 100755 --- a/ct.sh +++ b/ct.sh @@ -4,7 +4,7 @@ set -o errexit set -o nounset set -o pipefail -DEFAULT_CHART_TESTING_VERSION=v3.8.0 +DEFAULT_CHART_TESTING_VERSION=3.9.0 DEFAULT_YAMLLINT_VERSION=1.27.1 DEFAULT_YAMALE_VERSION=3.0.4 @@ -13,14 +13,14 @@ cat << EOF Usage: $(basename "$0") -h, --help Display help - -v, --version The chart-testing version to use (default: $DEFAULT_CHART_TESTING_VERSION)" + -v, --version The chart-testing version to use (default: ${DEFAULT_CHART_TESTING_VERSION})" EOF } main() { - local version="$DEFAULT_CHART_TESTING_VERSION" - local yamllint_version="$DEFAULT_YAMLLINT_VERSION" - local yamale_version="$DEFAULT_YAMALE_VERSION" + local version="${DEFAULT_CHART_TESTING_VERSION}" + local yamllint_version="${DEFAULT_YAMLLINT_VERSION}" + local yamale_version="${DEFAULT_YAMALE_VERSION}" parse_command_line "$@" @@ -36,7 +36,7 @@ parse_command_line() { ;; -v|--version) if [[ -n "${2:-}" ]]; then - version="$2" + version="${2#v}" shift else echo "ERROR: '-v|--version' cannot be empty." >&2 @@ -74,8 +74,8 @@ parse_command_line() { } install_chart_testing() { - if [[ ! -d "$RUNNER_TOOL_CACHE" ]]; then - echo "Cache directory '$RUNNER_TOOL_CACHE' does not exist" >&2 + if [[ ! -d "${RUNNER_TOOL_CACHE}" ]]; then + echo "Cache directory '${RUNNER_TOOL_CACHE}' does not exist" >&2 exit 1 fi @@ -85,35 +85,35 @@ install_chart_testing() { else arch=amd64 fi - local cache_dir="$RUNNER_TOOL_CACHE/ct/$version/$arch" - local venv_dir="$cache_dir/venv" + local cache_dir="${RUNNER_TOOL_CACHE}/ct/${version}/${arch}" + local venv_dir="${cache_dir}/venv" - if [[ ! -d "$cache_dir" ]]; then - mkdir -p "$cache_dir" + if [[ ! -d "${cache_dir}" ]]; then + mkdir -p "${cache_dir}" - echo "Installing chart-testing ${version}..." - CT_CERT=https://github.com/helm/chart-testing/releases/download/$version/chart-testing_${version#v}_linux_$arch.tar.gz.pem - CT_SIG=https://github.com/helm/chart-testing/releases/download/$version/chart-testing_${version#v}_linux_$arch.tar.gz.sig + echo "Installing chart-testing v${version}..." + CT_CERT=https://github.com/helm/chart-testing/releases/download/v$version/chart-testing_${version#v}_linux_$arch.tar.gz.pem + CT_SIG=https://github.com/helm/chart-testing/releases/download/v$version/chart-testing_${version#v}_linux_$arch.tar.gz.sig - 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" + 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" cosign verify-blob --certificate $CT_CERT --signature $CT_SIG \ --certificate-identity "https://github.com/helm/chart-testing/.github/workflows/release.yaml@refs/heads/main" \ --certificate-oidc-issuer "https://token.actions.githubusercontent.com" ct.tar.gz retVal=$? - if [[ "$retVal" -ne 0 ]]; then - log_error "Unable to validate chart-testing version: ${version}" + if [[ "${retVal}" -ne 0 ]]; then + log_error "Unable to validate chart-testing version: v${version}" exit 1 fi - tar -xzf ct.tar.gz -C "$cache_dir" + tar -xzf ct.tar.gz -C "${cache_dir}" rm -f ct.tar.gz echo 'Creating virtual Python environment...' - python3 -m venv "$venv_dir" + python3 -m venv "${venv_dir}" echo 'Activating virtual environment...' # shellcheck disable=SC1090 - source "$venv_dir/bin/activate" + source "${venv_dir}/bin/activate" echo 'Installing yamllint...' pip3 install "yamllint==${yamllint_version}" @@ -124,16 +124,16 @@ install_chart_testing() { # https://github.com/helm/chart-testing-action/issues/62 echo 'Adding ct directory to PATH...' - echo "$cache_dir" >> "$GITHUB_PATH" + echo "${cache_dir}" >> "${GITHUB_PATH}" echo 'Setting CT_CONFIG_DIR...' - echo "CT_CONFIG_DIR=$cache_dir/etc" >> "$GITHUB_ENV" + echo "CT_CONFIG_DIR=${cache_dir}/etc" >> "${GITHUB_ENV}" echo 'Configuring environment variables for virtual environment for subsequent workflow steps...' - echo "VIRTUAL_ENV=$venv_dir" >> "$GITHUB_ENV" - echo "$venv_dir/bin" >> "$GITHUB_PATH" + echo "VIRTUAL_ENV=${venv_dir}" >> "${GITHUB_ENV}" + echo "${venv_dir}/bin" >> "${GITHUB_PATH}" - "$cache_dir/ct" version + "${cache_dir}/ct" version } main "$@"