Skip to content

Commit

Permalink
ci: add workflow examples with tenv and tofu (#193)
Browse files Browse the repository at this point in the history
* bump v10 release

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* add tofu example

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* add tofu example via tenv

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* move tf via pr workflows to examples directrory to prevent mistrigger

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* add explicit check for terraform cli path

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* replace `tenv` with `tofu` in "comments or input" example

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* add `tenv` to tf tests workflow with multiple tf tools execution simultaenously

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* revert to initial setup step to reproduce tf test results

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* replace tool-specific setup steps with `tenv`

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* remove unnecessary comment

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* revert extraneous changes

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* revert move of example workflows

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* replace `TENV_TOOL` with `CLI_USES` thanks to tenv@v1.5.0

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* tidy release tags

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* fix cosign latest tag reference format

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* trigger workflow

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* trigger

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* replace `tenv ... install` with `tenv ... use`

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* use v1.6.1 instead of latest

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* get tenv tf version

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* run multiline yaml command

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* echo tenv update-path

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* add dquotes

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* remove dquotes

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* only update-path

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* tidy up

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* remove version test step

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* test `tenv constraint`

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* test constraint

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* fix line

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* replace `tenv  constraint` with `install`

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* docs: add entry under examples for `tenv` usage scenario

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* ci: remove version logging step

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* ci: add path-filter to tests workflow trigger

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* ci: substitute `CLI_VERSION`

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

---------

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>
  • Loading branch information
rdhar authored Apr 9, 2024
1 parent 8a2e8db commit dc00f4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/tf_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: TF Tests
on:
pull_request:
types: [opened, reopened, synchronize, closed]
paths:
- "**.yml"
- "scripts/**"
- "tests/**"

jobs:
tests:
Expand Down Expand Up @@ -31,9 +35,15 @@ 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 }}
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 "$CLI_VERSION" && tenv update-path
- name: Provision TF
id: tf
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
>
Expand Down

0 comments on commit dc00f4c

Please sign in to comment.