Skip to content

Commit f88c0c6

Browse files
authored
Merge pull request #668 from fluxcd/tf-1.8
Update Terraform version in CI
2 parents 78d4f2e + f1c7299 commit f88c0c6

File tree

2 files changed

+14
-64
lines changed

2 files changed

+14
-64
lines changed

.github/workflows/tests.yaml

+13-64
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ on:
77
branches: [ main ]
88

99
env:
10-
TERRAFORM_VERSION: 1.7.5
10+
TERRAFORM_VERSION: 1.8.*
1111

1212
jobs:
1313
# Ensure project builds before running testing matrix
1414
build:
15-
name: Build
1615
runs-on: ubuntu-latest
1716
timeout-minutes: 5
1817
steps:
@@ -21,49 +20,21 @@ jobs:
2120
with:
2221
go-version-file: 'go.mod'
2322
cache: true
24-
- run: make build
25-
generate:
26-
runs-on: ubuntu-latest
27-
steps:
28-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
29-
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
30-
with:
31-
go-version-file: 'go.mod'
32-
cache: true
33-
# Temporarily download Terraform 1.8 prerelease for function documentation support.
34-
# When Terraform 1.8.0 final is released, this can be removed.
3523
- uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0
3624
with:
37-
terraform_version: '1.8.0-alpha20240216'
25+
terraform_version: "${{env.TERRAFORM_VERSION}}"
3826
terraform_wrapper: false
39-
- run: go generate ./...
40-
- name: git diff
41-
run: |
42-
git diff --compact-summary --exit-code || \
43-
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
44-
45-
docs:
46-
runs-on: ubuntu-latest
47-
steps:
48-
- name: Checkout
49-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
50-
- name: Setup Go
51-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
52-
with:
53-
go-version-file: 'go.mod'
54-
cache: true
55-
cache-dependency-path: |
56-
**/go.sum
57-
**/go.mod
5827
- name: Install tools
5928
run: make tools
29+
- name: Build
30+
run: make build
6031
- name: Generate docs
6132
run: make docs
6233
- name: Check if working tree is dirty
6334
run: |
6435
if [[ $(git diff --stat) != '' ]]; then
6536
git diff
66-
echo 'run make docs and commit changes'
37+
echo "run 'make build docs' and commit changes"
6738
exit 1
6839
fi
6940
@@ -77,9 +48,8 @@ jobs:
7748
fail-fast: false
7849
matrix:
7950
terraform:
80-
- '1.5.*'
81-
- '1.6.*'
8251
- '1.7.*'
52+
- '1.8.*'
8353
steps:
8454
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
8555
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
@@ -127,9 +97,10 @@ jobs:
12797
run: |
12898
make build
12999
make terraformrc
100+
trc="${PWD}/.terraformrc"
101+
echo "TF_CLI_CONFIG_FILE=${trc}" >> "$GITHUB_ENV"
130102
- name: Apply Terraform
131103
run: |
132-
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
133104
cd examples/github-via-ssh
134105
terraform init
135106
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}"
@@ -141,7 +112,6 @@ jobs:
141112
flux get all
142113
- name: No-op apply Terraform
143114
run: |
144-
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
145115
cd examples/github-via-ssh
146116
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}"
147117
env:
@@ -152,14 +122,12 @@ jobs:
152122
kubectl delete ns flux-system
153123
- name: Restore Flux with Terraform
154124
run: |
155-
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
156125
cd examples/github-via-ssh
157126
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}"
158127
env:
159128
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
160129
- name: No-op apply Terraform
161130
run: |
162-
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
163131
cd examples/github-via-ssh
164132
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}"
165133
env:
@@ -174,12 +142,7 @@ jobs:
174142
if: ${{ always() }}
175143
continue-on-error: true
176144
run: |
177-
curl \
178-
-X DELETE \
179-
-H "Accept: application/vnd.github.v3+json" \
180-
-H "Authorization: token ${GITHUB_TOKEN}" \
181-
--fail --silent \
182-
https://api.github.com/repos/fluxcd-testing/${{ steps.vars.outputs.test_repo_name }}
145+
gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes
183146
env:
184147
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
185148
e2e-helm-install-with-github:
@@ -215,13 +178,8 @@ jobs:
215178
with:
216179
terraform_version: "${{env.TERRAFORM_VERSION}}"
217180
terraform_wrapper: false
218-
- name: Build provider
219-
run: |
220-
make build
221-
make terraformrc
222181
- name: Apply Terraform
223182
run: |
224-
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
225183
cd examples/helm-install
226184
terraform init
227185
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}"
@@ -239,12 +197,7 @@ jobs:
239197
if: ${{ always() }}
240198
continue-on-error: true
241199
run: |
242-
curl \
243-
-X DELETE \
244-
-H "Accept: application/vnd.github.v3+json" \
245-
-H "Authorization: token ${GITHUB_TOKEN}" \
246-
--fail --silent \
247-
https://api.github.com/repos/fluxcd-testing/${{ steps.vars.outputs.test_repo_name }}
200+
gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes
248201
env:
249202
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
250203
e2e-flux-bootstrap-with-github-pat:
@@ -284,9 +237,10 @@ jobs:
284237
run: |
285238
make build
286239
make terraformrc
240+
trc="${PWD}/.terraformrc"
241+
echo "TF_CLI_CONFIG_FILE=${trc}" >> "$GITHUB_ENV"
287242
- name: Apply Terraform
288243
run: |
289-
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
290244
cd examples/github-via-pat
291245
terraform init
292246
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}"
@@ -304,11 +258,6 @@ jobs:
304258
if: ${{ always() }}
305259
continue-on-error: true
306260
run: |
307-
curl \
308-
-X DELETE \
309-
-H "Accept: application/vnd.github.v3+json" \
310-
-H "Authorization: token ${GITHUB_TOKEN}" \
311-
--fail --silent \
312-
https://api.github.com/repos/fluxcd-testing/${{ steps.vars.outputs.test_repo_name }}
261+
gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes
313262
env:
314263
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ build: $(EMBEDDED_MANIFESTS_TARGET)
4848

4949
.PHONY: docs
5050
docs: $(EMBEDDED_MANIFESTS_TARGET) tools
51+
go generate ./...
5152
tfplugindocs generate --ignore-deprecated true
5253

5354
tools:

0 commit comments

Comments
 (0)