From a9a977a9ba1067194c84bfc5c070653d4e05a47c Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:01:44 +0100 Subject: [PATCH 01/35] bump v10 release Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_via_pr_comments.yml | 2 +- .github/workflows/tf_via_pr_comments_or_input.yml | 2 +- .github/workflows/tf_via_pr_input.yml | 2 +- .github/workflows/tf_via_pr_input_matrix.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tf_via_pr_comments.yml b/.github/workflows/tf_via_pr_comments.yml index 74644636..c358baf1 100644 --- a/.github/workflows/tf_via_pr_comments.yml +++ b/.github/workflows/tf_via_pr_comments.yml @@ -29,7 +29,7 @@ jobs: uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 - name: Provision TF - uses: devsectop/tf-via-pr-comments@dc6ce4481c36f83bd8a5110040499da17df6cb1a # v9.1.0 + uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 env: TF_VAR_PLACEHOLDER: value with: diff --git a/.github/workflows/tf_via_pr_comments_or_input.yml b/.github/workflows/tf_via_pr_comments_or_input.yml index 5998a889..5a8f6dd8 100644 --- a/.github/workflows/tf_via_pr_comments_or_input.yml +++ b/.github/workflows/tf_via_pr_comments_or_input.yml @@ -29,7 +29,7 @@ jobs: uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 - name: Provision TF - uses: devsectop/tf-via-pr-comments@dc6ce4481c36f83bd8a5110040499da17df6cb1a # v9.1.0 + uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 env: TF_VAR_PLACEHOLDER: value with: diff --git a/.github/workflows/tf_via_pr_input.yml b/.github/workflows/tf_via_pr_input.yml index 92feb5f6..dfd8c8cf 100644 --- a/.github/workflows/tf_via_pr_input.yml +++ b/.github/workflows/tf_via_pr_input.yml @@ -30,7 +30,7 @@ jobs: uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 - name: Provision TF - uses: devsectop/tf-via-pr-comments@dc6ce4481c36f83bd8a5110040499da17df6cb1a # v9.1.0 + uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 env: TF_VAR_PLACEHOLDER: value with: diff --git a/.github/workflows/tf_via_pr_input_matrix.yml b/.github/workflows/tf_via_pr_input_matrix.yml index 3bb1f968..588664ae 100644 --- a/.github/workflows/tf_via_pr_input_matrix.yml +++ b/.github/workflows/tf_via_pr_input_matrix.yml @@ -29,7 +29,7 @@ jobs: - name: Provision TF id: tf - uses: devsectop/tf-via-pr-comments@dc6ce4481c36f83bd8a5110040499da17df6cb1a # v9.1.0 + uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 env: TF_VAR_PLACEHOLDER: value with: From 4ad3498381963df8ecb1b8d9a9f2611ca441e683 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:02:03 +0100 Subject: [PATCH 02/35] add tofu example Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_via_pr_input_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tf_via_pr_input_matrix.yml b/.github/workflows/tf_via_pr_input_matrix.yml index 588664ae..ffe500ba 100644 --- a/.github/workflows/tf_via_pr_input_matrix.yml +++ b/.github/workflows/tf_via_pr_input_matrix.yml @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Setup TF - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 + uses: opentofu/setup-opentofu@ae80d4ecaab946d8f5ff18397fbf6d0686c6d46a # v1.0.3 - name: Provision TF id: tf From 8ef515b021cda988cc1b8e5127f2add5f821a056 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:02:21 +0100 Subject: [PATCH 03/35] add tofu example via tenv Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_via_pr_comments_or_input.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tf_via_pr_comments_or_input.yml b/.github/workflows/tf_via_pr_comments_or_input.yml index 5a8f6dd8..7b21aa6f 100644 --- a/.github/workflows/tf_via_pr_comments_or_input.yml +++ b/.github/workflows/tf_via_pr_comments_or_input.yml @@ -25,8 +25,13 @@ jobs: with: ref: ${{ github.event.issue && format('refs/pull/{0}/merge', github.event.issue.number) }} - - name: Setup TF - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 + - name: Setup TF (via tenv) + run: | + LATEST_COSIGN=$(curl https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v\", ") + LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest|jq -r .tag_name) + curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" + curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" + sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - name: Provision TF uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 @@ -35,6 +40,7 @@ jobs: with: recreate_comment: true var_file_from_workspace: true + cli_uses: tofu command_input: ${{ github.event.comment && '' || format('-tf={0} -chdir=sample/sample_instance -workspace=dev', github.event.action != 'closed' && 'plan' || 'apply') }} var_file_prefix: env/ var_file_suffix: .tfvars From 364e218bed18363f87633cbb99e227efe56c92c1 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:55:51 +0100 Subject: [PATCH 04/35] move tf via pr workflows to examples directrory to prevent mistrigger Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/{workflows => examples}/tf_via_pr_comments.yml | 0 .github/{workflows => examples}/tf_via_pr_comments_or_input.yml | 0 .github/{workflows => examples}/tf_via_pr_input.yml | 0 .github/{workflows => examples}/tf_via_pr_input_matrix.yml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename .github/{workflows => examples}/tf_via_pr_comments.yml (100%) rename .github/{workflows => examples}/tf_via_pr_comments_or_input.yml (100%) rename .github/{workflows => examples}/tf_via_pr_input.yml (100%) rename .github/{workflows => examples}/tf_via_pr_input_matrix.yml (100%) diff --git a/.github/workflows/tf_via_pr_comments.yml b/.github/examples/tf_via_pr_comments.yml similarity index 100% rename from .github/workflows/tf_via_pr_comments.yml rename to .github/examples/tf_via_pr_comments.yml diff --git a/.github/workflows/tf_via_pr_comments_or_input.yml b/.github/examples/tf_via_pr_comments_or_input.yml similarity index 100% rename from .github/workflows/tf_via_pr_comments_or_input.yml rename to .github/examples/tf_via_pr_comments_or_input.yml diff --git a/.github/workflows/tf_via_pr_input.yml b/.github/examples/tf_via_pr_input.yml similarity index 100% rename from .github/workflows/tf_via_pr_input.yml rename to .github/examples/tf_via_pr_input.yml diff --git a/.github/workflows/tf_via_pr_input_matrix.yml b/.github/examples/tf_via_pr_input_matrix.yml similarity index 100% rename from .github/workflows/tf_via_pr_input_matrix.yml rename to .github/examples/tf_via_pr_input_matrix.yml From 6cc795bfd2923db53ea411332576e68919b571ed Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:56:15 +0100 Subject: [PATCH 05/35] add explicit check for terraform cli path Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 7c0a514c..d83f0970 100644 --- a/action.yml +++ b/action.yml @@ -152,7 +152,7 @@ runs: arg_replace: ${{ fromJSON(steps.parsed.outputs.command)['replace'] }} arg_target: ${{ fromJSON(steps.parsed.outputs.command)['target'] }} arg_test_directory: ${{ fromJSON(steps.parsed.outputs.command)['test-directory'] }} - arg_tf_cli: ${{ inputs.cli_uses || (env.TOFU_CLI_PATH && 'tofu') || 'terraform' }} + arg_tf_cli: ${{ inputs.cli_uses || (env.TOFU_CLI_PATH && 'tofu') || (env.TERRAFORM_CLI_PATH && 'terraform') }} arg_tf: ${{ fromJSON(steps.parsed.outputs.command)['tf'] }} arg_upgrade: ${{ fromJSON(steps.parsed.outputs.command)['upgrade'] }} arg_var_file: ${{ inputs.var_file_from_workspace == 'true' && fromJSON(steps.parsed.outputs.command)['workspace'] || fromJSON(steps.parsed.outputs.command)['var-file'] }} @@ -302,7 +302,7 @@ runs: # Remove lines related to fetching the state of resources and truncate # before the last 66000 characters to capture the final change summary. tf_output_raw=$(cat <<'EOTF' - ${{ steps.apply.outputs.stderr || steps.apply.outputs.stdout || steps.plan.outputs.stderr || steps.plan.outputs.stdout || steps.force_unlock.outputs.stderr || steps.force_unlock.outputs.stdout || steps.workspace.outputs.stderr || steps.validate.outputs.stderr || steps.init.outputs.stderr }} + ${{ steps.apply.outputs.stderr || steps.apply.outputs.stdout || steps.plan.outputs.stderr || steps.plan.outputs.stdout || steps.force_unlock.outputs.stderr || steps.force_unlock.outputs.stdout || steps.workspace.outputs.stderr || steps.fmt.outputs.stdout || steps.validate.outputs.stderr || steps.init.outputs.stderr }} EOTF ) echo 'tf_output<> $GITHUB_OUTPUT From e645c7d8469f352904ccefcef04e12dc7f180e45 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:35:52 +0100 Subject: [PATCH 06/35] replace `tenv` with `tofu` in "comments or input" example Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/examples/tf_via_pr_comments_or_input.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/examples/tf_via_pr_comments_or_input.yml b/.github/examples/tf_via_pr_comments_or_input.yml index 7b21aa6f..8f3c9bb1 100644 --- a/.github/examples/tf_via_pr_comments_or_input.yml +++ b/.github/examples/tf_via_pr_comments_or_input.yml @@ -25,13 +25,8 @@ jobs: with: ref: ${{ github.event.issue && format('refs/pull/{0}/merge', github.event.issue.number) }} - - name: Setup TF (via tenv) - run: | - LATEST_COSIGN=$(curl https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v\", ") - LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest|jq -r .tag_name) - curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" - curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" - sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" + - name: Setup TF + uses: opentofu/setup-opentofu@ae80d4ecaab946d8f5ff18397fbf6d0686c6d46a # v1.0.3 - name: Provision TF uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 @@ -40,7 +35,6 @@ jobs: with: recreate_comment: true var_file_from_workspace: true - cli_uses: tofu command_input: ${{ github.event.comment && '' || format('-tf={0} -chdir=sample/sample_instance -workspace=dev', github.event.action != 'closed' && 'plan' || 'apply') }} var_file_prefix: env/ var_file_suffix: .tfvars From 2e4ee8a2917b1e7814e6e8581153399684c244ba Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:51:15 +0100 Subject: [PATCH 07/35] add `tenv` to tf tests workflow with multiple tf tools execution simultaenously Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index f1cab6f3..50ad6e96 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -31,14 +31,23 @@ jobs: - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Setup TF - uses: opentofu/setup-opentofu@ae80d4ecaab946d8f5ff18397fbf6d0686c6d46a # v1.0.3 - - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 + - name: Setup TF (via tenv) + env: + CLI_USES: ${{ matrix.cli_uses }} + TENV_TOOL: ${{ matrix.cli_uses == 'terraform' && 'tf' || 'tofu' }} + run: | + LATEST_COSIGN=$(curl https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v\", ") + LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest|jq -r .tag_name) + curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" + curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" + sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" + tenv ${TENV_TOOL} install latest && ${CLI_USES} --version - name: Provision TF id: tf continue-on-error: true uses: ./ + # uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 with: chdir_prefix: tests/ cli_uses: ${{ matrix.cli_uses }} From adfe13fd1f2452275dbf4539d8ed2f96d95715e8 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:05:30 +0100 Subject: [PATCH 08/35] revert to initial setup step to reproduce tf test results Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 50ad6e96..b3669dfe 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -31,23 +31,26 @@ jobs: - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Setup TF (via tenv) - env: - CLI_USES: ${{ matrix.cli_uses }} - TENV_TOOL: ${{ matrix.cli_uses == 'terraform' && 'tf' || 'tofu' }} - run: | - LATEST_COSIGN=$(curl https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v\", ") - LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest|jq -r .tag_name) - curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" - curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" - sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - tenv ${TENV_TOOL} install latest && ${CLI_USES} --version + - name: Setup TF + uses: opentofu/setup-opentofu@ae80d4ecaab946d8f5ff18397fbf6d0686c6d46a # v1.0.3 + - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 + + # - name: Setup TF (via tenv) + # env: + # CLI_USES: ${{ matrix.cli_uses }} + # TENV_TOOL: ${{ matrix.cli_uses == 'terraform' && 'tf' || 'tofu' }} + # run: | + # LATEST_COSIGN=$(curl https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v\", ") + # LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest|jq -r .tag_name) + # curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" + # curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" + # sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" + # tenv ${TENV_TOOL} install latest && ${CLI_USES} --version - name: Provision TF id: tf continue-on-error: true uses: ./ - # uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 with: chdir_prefix: tests/ cli_uses: ${{ matrix.cli_uses }} From 44aa0a84f0b9f067d4c87d8e5889924c7d71c767 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:07:58 +0100 Subject: [PATCH 09/35] replace tool-specific setup steps with `tenv` Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index b3669dfe..5a9afa24 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -31,21 +31,21 @@ jobs: - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Setup TF - uses: opentofu/setup-opentofu@ae80d4ecaab946d8f5ff18397fbf6d0686c6d46a # v1.0.3 - - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 + # - name: Setup TF + # uses: opentofu/setup-opentofu@ae80d4ecaab946d8f5ff18397fbf6d0686c6d46a # v1.0.3 + # - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 - # - name: Setup TF (via tenv) - # env: - # CLI_USES: ${{ matrix.cli_uses }} - # TENV_TOOL: ${{ matrix.cli_uses == 'terraform' && 'tf' || 'tofu' }} - # run: | - # LATEST_COSIGN=$(curl https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v\", ") - # LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest|jq -r .tag_name) - # curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" - # curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" - # sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - # tenv ${TENV_TOOL} install latest && ${CLI_USES} --version + - name: Setup TF (via tenv) + env: + CLI_USES: ${{ matrix.cli_uses }} + TENV_TOOL: ${{ matrix.cli_uses == 'terraform' && 'tf' || 'tofu' }} + run: | + LATEST_COSIGN=$(curl https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v\", ") + LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest|jq -r .tag_name) + curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" + curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" + sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" + tenv ${TENV_TOOL} install latest && ${CLI_USES} --version - name: Provision TF id: tf From e9d35ca7992b9bade524d8186cf93a59f1b29a5f Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:09:37 +0100 Subject: [PATCH 10/35] remove unnecessary comment Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 5a9afa24..2418c056 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -31,10 +31,6 @@ jobs: - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - # - name: Setup TF - # uses: opentofu/setup-opentofu@ae80d4ecaab946d8f5ff18397fbf6d0686c6d46a # v1.0.3 - # - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 - - name: Setup TF (via tenv) env: CLI_USES: ${{ matrix.cli_uses }} From 66fee40e9933d43d6b4572f5ed7c51df621250f7 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:32:38 +0100 Subject: [PATCH 11/35] revert extraneous changes Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/examples/tf_via_pr_comments.yml | 2 +- .github/examples/tf_via_pr_comments_or_input.yml | 4 ++-- .github/examples/tf_via_pr_input.yml | 2 +- .github/examples/tf_via_pr_input_matrix.yml | 4 ++-- action.yml | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/examples/tf_via_pr_comments.yml b/.github/examples/tf_via_pr_comments.yml index c358baf1..74644636 100644 --- a/.github/examples/tf_via_pr_comments.yml +++ b/.github/examples/tf_via_pr_comments.yml @@ -29,7 +29,7 @@ jobs: uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 - name: Provision TF - uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 + uses: devsectop/tf-via-pr-comments@dc6ce4481c36f83bd8a5110040499da17df6cb1a # v9.1.0 env: TF_VAR_PLACEHOLDER: value with: diff --git a/.github/examples/tf_via_pr_comments_or_input.yml b/.github/examples/tf_via_pr_comments_or_input.yml index 8f3c9bb1..5998a889 100644 --- a/.github/examples/tf_via_pr_comments_or_input.yml +++ b/.github/examples/tf_via_pr_comments_or_input.yml @@ -26,10 +26,10 @@ jobs: ref: ${{ github.event.issue && format('refs/pull/{0}/merge', github.event.issue.number) }} - name: Setup TF - uses: opentofu/setup-opentofu@ae80d4ecaab946d8f5ff18397fbf6d0686c6d46a # v1.0.3 + uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 - name: Provision TF - uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 + uses: devsectop/tf-via-pr-comments@dc6ce4481c36f83bd8a5110040499da17df6cb1a # v9.1.0 env: TF_VAR_PLACEHOLDER: value with: diff --git a/.github/examples/tf_via_pr_input.yml b/.github/examples/tf_via_pr_input.yml index dfd8c8cf..92feb5f6 100644 --- a/.github/examples/tf_via_pr_input.yml +++ b/.github/examples/tf_via_pr_input.yml @@ -30,7 +30,7 @@ jobs: uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 - name: Provision TF - uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 + uses: devsectop/tf-via-pr-comments@dc6ce4481c36f83bd8a5110040499da17df6cb1a # v9.1.0 env: TF_VAR_PLACEHOLDER: value with: diff --git a/.github/examples/tf_via_pr_input_matrix.yml b/.github/examples/tf_via_pr_input_matrix.yml index ffe500ba..3bb1f968 100644 --- a/.github/examples/tf_via_pr_input_matrix.yml +++ b/.github/examples/tf_via_pr_input_matrix.yml @@ -25,11 +25,11 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Setup TF - uses: opentofu/setup-opentofu@ae80d4ecaab946d8f5ff18397fbf6d0686c6d46a # v1.0.3 + uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 - name: Provision TF id: tf - uses: devsectop/tf-via-pr-comments@069fd20e039d1ee5fba48b8a319752e44451782a # v10 + uses: devsectop/tf-via-pr-comments@dc6ce4481c36f83bd8a5110040499da17df6cb1a # v9.1.0 env: TF_VAR_PLACEHOLDER: value with: diff --git a/action.yml b/action.yml index d83f0970..7c0a514c 100644 --- a/action.yml +++ b/action.yml @@ -152,7 +152,7 @@ runs: arg_replace: ${{ fromJSON(steps.parsed.outputs.command)['replace'] }} arg_target: ${{ fromJSON(steps.parsed.outputs.command)['target'] }} arg_test_directory: ${{ fromJSON(steps.parsed.outputs.command)['test-directory'] }} - arg_tf_cli: ${{ inputs.cli_uses || (env.TOFU_CLI_PATH && 'tofu') || (env.TERRAFORM_CLI_PATH && 'terraform') }} + arg_tf_cli: ${{ inputs.cli_uses || (env.TOFU_CLI_PATH && 'tofu') || 'terraform' }} arg_tf: ${{ fromJSON(steps.parsed.outputs.command)['tf'] }} arg_upgrade: ${{ fromJSON(steps.parsed.outputs.command)['upgrade'] }} arg_var_file: ${{ inputs.var_file_from_workspace == 'true' && fromJSON(steps.parsed.outputs.command)['workspace'] || fromJSON(steps.parsed.outputs.command)['var-file'] }} @@ -302,7 +302,7 @@ runs: # Remove lines related to fetching the state of resources and truncate # before the last 66000 characters to capture the final change summary. tf_output_raw=$(cat <<'EOTF' - ${{ steps.apply.outputs.stderr || steps.apply.outputs.stdout || steps.plan.outputs.stderr || steps.plan.outputs.stdout || steps.force_unlock.outputs.stderr || steps.force_unlock.outputs.stdout || steps.workspace.outputs.stderr || steps.fmt.outputs.stdout || steps.validate.outputs.stderr || steps.init.outputs.stderr }} + ${{ steps.apply.outputs.stderr || steps.apply.outputs.stdout || steps.plan.outputs.stderr || steps.plan.outputs.stdout || steps.force_unlock.outputs.stderr || steps.force_unlock.outputs.stdout || steps.workspace.outputs.stderr || steps.validate.outputs.stderr || steps.init.outputs.stderr }} EOTF ) echo 'tf_output<> $GITHUB_OUTPUT From debf12163c988de2e76f1f6ddb7603d7ca1c942e Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:33:25 +0100 Subject: [PATCH 12/35] revert move of example workflows Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/{examples => workflows}/tf_via_pr_comments.yml | 0 .github/{examples => workflows}/tf_via_pr_comments_or_input.yml | 0 .github/{examples => workflows}/tf_via_pr_input.yml | 0 .github/{examples => workflows}/tf_via_pr_input_matrix.yml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename .github/{examples => workflows}/tf_via_pr_comments.yml (100%) rename .github/{examples => workflows}/tf_via_pr_comments_or_input.yml (100%) rename .github/{examples => workflows}/tf_via_pr_input.yml (100%) rename .github/{examples => workflows}/tf_via_pr_input_matrix.yml (100%) diff --git a/.github/examples/tf_via_pr_comments.yml b/.github/workflows/tf_via_pr_comments.yml similarity index 100% rename from .github/examples/tf_via_pr_comments.yml rename to .github/workflows/tf_via_pr_comments.yml diff --git a/.github/examples/tf_via_pr_comments_or_input.yml b/.github/workflows/tf_via_pr_comments_or_input.yml similarity index 100% rename from .github/examples/tf_via_pr_comments_or_input.yml rename to .github/workflows/tf_via_pr_comments_or_input.yml diff --git a/.github/examples/tf_via_pr_input.yml b/.github/workflows/tf_via_pr_input.yml similarity index 100% rename from .github/examples/tf_via_pr_input.yml rename to .github/workflows/tf_via_pr_input.yml diff --git a/.github/examples/tf_via_pr_input_matrix.yml b/.github/workflows/tf_via_pr_input_matrix.yml similarity index 100% rename from .github/examples/tf_via_pr_input_matrix.yml rename to .github/workflows/tf_via_pr_input_matrix.yml From d930bdc0966dfbb2740ba2394c8793ea8122cbe9 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Thu, 4 Apr 2024 15:17:55 +0100 Subject: [PATCH 13/35] replace `TENV_TOOL` with `CLI_USES` thanks to tenv@v1.5.0 Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 2418c056..8861e46f 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -34,14 +34,14 @@ jobs: - name: Setup TF (via tenv) env: CLI_USES: ${{ matrix.cli_uses }} - TENV_TOOL: ${{ matrix.cli_uses == 'terraform' && 'tf' || 'tofu' }} run: | LATEST_COSIGN=$(curl https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v\", ") LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest|jq -r .tag_name) curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - tenv ${TENV_TOOL} install latest && ${CLI_USES} --version + tenv ${CLI_USES} install latest + ${CLI_USES} --version - name: Provision TF id: tf From 4d20eada2c40cf5ae0b4a82cd47ed7600d0243f4 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Thu, 4 Apr 2024 18:08:26 +0100 Subject: [PATCH 14/35] tidy release tags Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 8861e46f..d656996d 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -35,8 +35,8 @@ jobs: env: CLI_USES: ${{ matrix.cli_uses }} run: | - LATEST_COSIGN=$(curl https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v\", ") - LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest|jq -r .tag_name) + LATEST_COSIGN=$(curl --silent https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name) + LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" From 85c2c577858a7cd8e8b3950564e39e9a859d3a0e Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Thu, 4 Apr 2024 20:06:10 +0100 Subject: [PATCH 15/35] fix cosign latest tag reference format Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index d656996d..f5bfeb3e 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -35,7 +35,7 @@ jobs: env: CLI_USES: ${{ matrix.cli_uses }} run: | - LATEST_COSIGN=$(curl --silent https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name) + LATEST_COSIGN=$(curl --silent https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v") LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" From c79d3b109e076fceb2d7b6a2d1082e362beaaeb7 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Fri, 5 Apr 2024 15:39:03 +0100 Subject: [PATCH 16/35] trigger workflow Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> From 1d45fdd462074851cce2c136a503d389c87b3257 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:48:57 +0100 Subject: [PATCH 17/35] trigger Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> From 4c74e2721aa2e9aba3bf65c161baaff29d539445 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Fri, 5 Apr 2024 17:09:24 +0100 Subject: [PATCH 18/35] replace `tenv ... install` with `tenv ... use` Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index f5bfeb3e..8466befa 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -40,7 +40,7 @@ jobs: curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - tenv ${CLI_USES} install latest + tenv ${CLI_USES} use latest ${CLI_USES} --version - name: Provision TF From a5f9ca043feac7a26cf5f2f3be63e0108465f741 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Fri, 5 Apr 2024 17:11:49 +0100 Subject: [PATCH 19/35] use v1.6.1 instead of latest Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 8466befa..e7666770 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -40,7 +40,7 @@ jobs: curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - tenv ${CLI_USES} use latest + tenv ${CLI_USES} use 1.6.1 ${CLI_USES} --version - name: Provision TF From 9654d8370ed44be804168694487a0cf8ec7d7ec5 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:14:24 +0100 Subject: [PATCH 20/35] get tenv tf version Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index e7666770..c048440b 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -43,6 +43,11 @@ jobs: tenv ${CLI_USES} use 1.6.1 ${CLI_USES} --version + - name: Version TF + env: + CLI_USES: ${{ matrix.cli_uses }} + run: ${CLI_USES} --version + - name: Provision TF id: tf continue-on-error: true From 7aa3e9a5bc18df9e0b39bce24e6ac5d51c3e85fe Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:31:24 +0100 Subject: [PATCH 21/35] run multiline yaml command Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index c048440b..9a8171c3 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -46,7 +46,8 @@ jobs: - name: Version TF env: CLI_USES: ${{ matrix.cli_uses }} - run: ${CLI_USES} --version + run: | + ${CLI_USES} --version - name: Provision TF id: tf From c2104f3b1f129f614706e9139c91b5077730aa3d Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:57:29 +0100 Subject: [PATCH 22/35] echo tenv update-path Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 9a8171c3..9305bbe2 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -41,6 +41,8 @@ jobs: curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" tenv ${CLI_USES} use 1.6.1 + echo "$(tenv update-path)" + echo "$(tenv update-path)" >> $GITHUB_PATH ${CLI_USES} --version - name: Version TF From 4003d0b8015d19e29886d1f360d8f4c83cf34da7 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Mon, 8 Apr 2024 14:01:22 +0100 Subject: [PATCH 23/35] add dquotes Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 9305bbe2..9e1bc6a7 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -40,16 +40,16 @@ jobs: curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - tenv ${CLI_USES} use 1.6.1 + tenv "${CLI_USES}" use 1.6.1 echo "$(tenv update-path)" echo "$(tenv update-path)" >> $GITHUB_PATH - ${CLI_USES} --version + "${CLI_USES}" --version - name: Version TF env: CLI_USES: ${{ matrix.cli_uses }} run: | - ${CLI_USES} --version + "${CLI_USES}" --version - name: Provision TF id: tf From f23f73e83585768129cac13506e66e89cb39f12c Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Mon, 8 Apr 2024 14:03:49 +0100 Subject: [PATCH 24/35] remove dquotes Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 9e1bc6a7..ed589065 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -40,16 +40,16 @@ jobs: curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - tenv "${CLI_USES}" use 1.6.1 + tenv $CLI_USES use 1.6.1 echo "$(tenv update-path)" echo "$(tenv update-path)" >> $GITHUB_PATH - "${CLI_USES}" --version + $CLI_USES --version - name: Version TF env: CLI_USES: ${{ matrix.cli_uses }} run: | - "${CLI_USES}" --version + $CLI_USES --version - name: Provision TF id: tf From 9df967a5ec6060174e99a3a3369efcacd8ec0343 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Mon, 8 Apr 2024 14:11:24 +0100 Subject: [PATCH 25/35] only update-path Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index ed589065..60b32bb3 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -41,8 +41,7 @@ jobs: curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" tenv $CLI_USES use 1.6.1 - echo "$(tenv update-path)" - echo "$(tenv update-path)" >> $GITHUB_PATH + tenv update-path $CLI_USES --version - name: Version TF From 9e69bd3772c108743b16848128879d84f8257329 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:05:43 +0100 Subject: [PATCH 26/35] tidy up Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 60b32bb3..0f4e19bf 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -40,15 +40,12 @@ jobs: curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - tenv $CLI_USES use 1.6.1 - tenv update-path - $CLI_USES --version + tenv $CLI_USES use 1.6.1 && tenv update-path - name: Version TF env: CLI_USES: ${{ matrix.cli_uses }} - run: | - $CLI_USES --version + run: $CLI_USES --version - name: Provision TF id: tf From a8495e825fabc90982f0e07357cd3a0048e5cad0 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:27:24 +0100 Subject: [PATCH 27/35] remove version test step Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 0f4e19bf..50a41ede 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -36,17 +36,12 @@ jobs: CLI_USES: ${{ matrix.cli_uses }} run: | LATEST_COSIGN=$(curl --silent https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v") - LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" + LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" tenv $CLI_USES use 1.6.1 && tenv update-path - - name: Version TF - env: - CLI_USES: ${{ matrix.cli_uses }} - run: $CLI_USES --version - - name: Provision TF id: tf continue-on-error: true From 623a983efb335266bb399fdaecdf88e85cedb7fe Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:00:34 +0100 Subject: [PATCH 28/35] test `tenv constraint` Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 50a41ede..f2f147ef 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -35,12 +35,14 @@ jobs: env: CLI_USES: ${{ matrix.cli_uses }} run: | - LATEST_COSIGN=$(curl --silent https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .tag_name | tr -d "v") - curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign_${LATEST_COSIGN}_amd64.deb" - LATEST_TENV=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) - curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${LATEST_TENV}_amd64.deb" - sudo dpkg -i "cosign_${LATEST_COSIGN}_amd64.deb" "tenv_${LATEST_TENV}_amd64.deb" - tenv $CLI_USES use 1.6.1 && tenv update-path + VERSION=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) + curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${VERSION}_amd64.deb" + sudo dpkg -i "tenv_${VERSION}_amd64.deb" + tenv $CLI_USES constraint "~> 1.6" tenv update-path + + - env: + CLI_USES: ${{ matrix.cli_uses }} + run: $CLI_USES --version - name: Provision TF id: tf From c599b60089575910a468224f46accf4726c36392 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:02:05 +0100 Subject: [PATCH 29/35] test constraint Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index f2f147ef..ef639a09 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -38,7 +38,7 @@ jobs: VERSION=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${VERSION}_amd64.deb" sudo dpkg -i "tenv_${VERSION}_amd64.deb" - tenv $CLI_USES constraint "~> 1.6" tenv update-path + tenv $CLI_USES constraint "< 1.7" tenv update-path - env: CLI_USES: ${{ matrix.cli_uses }} From bbfc028c646399604d50dcaf7d8fd6dad8db3247 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:04:49 +0100 Subject: [PATCH 30/35] fix line Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index ef639a09..be7b3b00 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -38,7 +38,7 @@ jobs: VERSION=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${VERSION}_amd64.deb" sudo dpkg -i "tenv_${VERSION}_amd64.deb" - tenv $CLI_USES constraint "< 1.7" tenv update-path + tenv $CLI_USES constraint "< 1.7" && tenv update-path - env: CLI_USES: ${{ matrix.cli_uses }} From ee6bcae1f5722bd09f1c50490379a09c12a77c73 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:22:42 +0100 Subject: [PATCH 31/35] replace `tenv constraint` with `install` Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index be7b3b00..7ae05acc 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -38,7 +38,7 @@ jobs: VERSION=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${VERSION}_amd64.deb" sudo dpkg -i "tenv_${VERSION}_amd64.deb" - tenv $CLI_USES constraint "< 1.7" && tenv update-path + tenv $CLI_USES install "~> 1.6.0" && tenv update-path - env: CLI_USES: ${{ matrix.cli_uses }} From b6ccabf996a8ddb5d182881d2cd5500d68b2da86 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:50:06 +0100 Subject: [PATCH 32/35] docs: add entry under examples for `tenv` usage scenario Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 951cf039..cd6a1e1f 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,10 @@ Functional workflow examples are provided below, along with associated permissions and triggers. The full list of inputs is documented [below](#inputs). - [TF via PR Comments](.github/examples/tf_via_pr_comments.yml) +- [TF via PR Comments or Input](.github/examples/tf_via_pr_comments_or_input.yml) - [TF via PR Input with AWS Authentication](.github/examples/tf_via_pr_input.yml) - [TF via PR Input with Matrix Strategy](.github/examples/tf_via_pr_input_matrix.yml) -- [TF via PR Comments or Input](.github/examples/tf_via_pr_comments_or_input.yml) +- [TF via PR Input with `tenv` Proxy](.github/workflows/tf_tests.yml) > [!NOTE] > From 9affb661a0a2a6801647df02970d33690fd415aa Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:05:15 +0100 Subject: [PATCH 33/35] ci: remove version logging step Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 7ae05acc..0713fd0f 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -40,10 +40,6 @@ jobs: sudo dpkg -i "tenv_${VERSION}_amd64.deb" tenv $CLI_USES install "~> 1.6.0" && tenv update-path - - env: - CLI_USES: ${{ matrix.cli_uses }} - run: $CLI_USES --version - - name: Provision TF id: tf continue-on-error: true From 87c72f1eec0a5273d488ccda284f1320fec9ff8e Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:10:07 +0100 Subject: [PATCH 34/35] ci: add path-filter to tests workflow trigger Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index 0713fd0f..c60ee379 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -3,6 +3,10 @@ name: TF Tests on: pull_request: types: [opened, reopened, synchronize, closed] + paths: + - "**.yml" + - "scripts/**" + - "tests/**" jobs: tests: From 655d734b826881a9c645f9153af924a27d60aa76 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:13:42 +0100 Subject: [PATCH 35/35] ci: substitute `CLI_VERSION` Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tf_tests.yml b/.github/workflows/tf_tests.yml index c60ee379..1728d81e 100644 --- a/.github/workflows/tf_tests.yml +++ b/.github/workflows/tf_tests.yml @@ -38,11 +38,12 @@ jobs: - name: Setup TF (via tenv) env: CLI_USES: ${{ matrix.cli_uses }} + CLI_VERSION: ~> 1.6.0 run: | VERSION=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${VERSION}_amd64.deb" sudo dpkg -i "tenv_${VERSION}_amd64.deb" - tenv $CLI_USES install "~> 1.6.0" && tenv update-path + tenv $CLI_USES install "$CLI_VERSION" && tenv update-path - name: Provision TF id: tf