From 379cb0fd793c0f7dfe2a2d8a3df5bd864ddfa3d7 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 1 Oct 2024 14:01:50 +0100 Subject: [PATCH] fix: tenv version and arch selection (#309) * fix: tenv version and arch selection Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> * set `tenv_version` Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> * correct default arch reference Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> * bump doc version Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --------- Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yaml | 1 + README.md | 3 ++- action.yml | 10 ++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tf_tests.yaml b/.github/workflows/tf_tests.yaml index 71814e9f..74b540a5 100644 --- a/.github/workflows/tf_tests.yaml +++ b/.github/workflows/tf_tests.yaml @@ -52,6 +52,7 @@ jobs: arg_command: ${{ github.event.pull_request.merged && 'apply' || 'plan' }} arg_lock: ${{ github.event.pull_request.merged && 'true' || 'false' }} arg_detailed_exitcode: true + tenv_version: v3.2.3 tf_tool: ${{ matrix.tool }} tf_version: ~> 1.8.0 diff --git a/README.md b/README.md index 06fc2afe..9107a37e 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,8 @@ In order to locally decrypt the TF plan file, use the following command (noting | `fmt_enable`
Default: `true` | Boolean flag to enable TF fmt command and display diff of changes. | | `label_pr`
Default: `true` | Boolean flag to add PR label of TF command to run. | | `plan_parity`
Default: `false` | Boolean flag to compare the TF plan file with a newly-generated one to prevent stale apply. | -| `tenv_version`
Example: `v3.1.0` | String version tag of the tenv tool to install and use. | +| `tenv_arch`
Default: `amd64` | String architecture of the tenv tool to install and use. | +| `tenv_version`
Example: `v3.2.3` | String version tag of the tenv tool to install and use. | | `tf_tool`
Default: `terraform` | String name of the TF tool to use and override default assumption from wrapper environment variable. | | `tf_version`
Example: `~> 1.8.0` | String version constraint of the TF tool to install and use. | | `update_comment`
Default: `false` | Boolean flag to update existing PR comment instead of creating a new comment and deleting the old one. | diff --git a/action.yml b/action.yml index c9c9d7dd..3ea83fc0 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,10 @@ inputs: description: Boolean flag to compare the TF plan file with a newly-generated one to prevent stale apply. required: false default: "false" + tenv_arch: + description: String architecture of the tenv tool to install and use. + required: false + default: "amd64" tenv_version: description: String version tag of the tenv tool to install and use. required: false @@ -278,16 +282,18 @@ runs: - name: Install TF via tenv if: inputs.tf_version != '' env: + TENV_ARCH: ${{ inputs.tenv_arch }} TENV_VERSION: ${{ inputs.tenv_version }} TF_TOOL: ${{ inputs.tf_tool }} TF_VERSION: ${{ inputs.tf_version }} shell: bash run: | + # If $TENV_VERSION is not set, then retrieve the latest version. if [ -z "$TENV_VERSION" ]; then TENV_VERSION=$(curl --no-progress-meter --location https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) fi - curl --remote-name --no-progress-meter --location "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${TENV_VERSION}_amd64.deb" - sudo dpkg --install "tenv_${TENV_VERSION}_amd64.deb" + curl --remote-name --no-progress-meter --location "https://github.com/tofuutils/tenv/releases/download/${TENV_VERSION}/tenv_${TENV_VERSION}_${TENV_ARCH}.deb" + sudo dpkg --install "tenv_${TENV_VERSION}_${TENV_ARCH}.deb" tenv "$TF_TOOL" install "$TF_VERSION" tenv update-path