7
7
branches : [ main ]
8
8
9
9
env :
10
- TERRAFORM_VERSION : 1.7.5
10
+ TERRAFORM_VERSION : 1.8.*
11
11
12
12
jobs :
13
13
# Ensure project builds before running testing matrix
14
14
build :
15
- name : Build
16
15
runs-on : ubuntu-latest
17
16
timeout-minutes : 5
18
17
steps :
@@ -21,49 +20,21 @@ jobs:
21
20
with :
22
21
go-version-file : ' go.mod'
23
22
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.
35
23
- uses : hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0
36
24
with :
37
- terraform_version : ' 1.8.0-alpha20240216 '
25
+ terraform_version : " ${{env.TERRAFORM_VERSION}} "
38
26
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
58
27
- name : Install tools
59
28
run : make tools
29
+ - name : Build
30
+ run : make build
60
31
- name : Generate docs
61
32
run : make docs
62
33
- name : Check if working tree is dirty
63
34
run : |
64
35
if [[ $(git diff --stat) != '' ]]; then
65
36
git diff
66
- echo ' run make docs and commit changes'
37
+ echo " run ' make build docs' and commit changes"
67
38
exit 1
68
39
fi
69
40
77
48
fail-fast : false
78
49
matrix :
79
50
terraform :
80
- - ' 1.5.*'
81
- - ' 1.6.*'
82
51
- ' 1.7.*'
52
+ - ' 1.8.*'
83
53
steps :
84
54
- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
85
55
- uses : actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
@@ -127,9 +97,10 @@ jobs:
127
97
run : |
128
98
make build
129
99
make terraformrc
100
+ trc="${PWD}/.terraformrc"
101
+ echo "TF_CLI_CONFIG_FILE=${trc}" >> "$GITHUB_ENV"
130
102
- name : Apply Terraform
131
103
run : |
132
- export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
133
104
cd examples/github-via-ssh
134
105
terraform init
135
106
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:
141
112
flux get all
142
113
- name : No-op apply Terraform
143
114
run : |
144
- export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
145
115
cd examples/github-via-ssh
146
116
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}"
147
117
env :
@@ -152,14 +122,12 @@ jobs:
152
122
kubectl delete ns flux-system
153
123
- name : Restore Flux with Terraform
154
124
run : |
155
- export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
156
125
cd examples/github-via-ssh
157
126
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}"
158
127
env :
159
128
GITHUB_TOKEN : ${{ secrets.GITPROVIDER_BOT_TOKEN }}
160
129
- name : No-op apply Terraform
161
130
run : |
162
- export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
163
131
cd examples/github-via-ssh
164
132
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}"
165
133
env :
@@ -174,12 +142,7 @@ jobs:
174
142
if : ${{ always() }}
175
143
continue-on-error : true
176
144
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
183
146
env :
184
147
GITHUB_TOKEN : ${{ secrets.GITPROVIDER_BOT_TOKEN }}
185
148
e2e-helm-install-with-github :
@@ -215,13 +178,8 @@ jobs:
215
178
with :
216
179
terraform_version : " ${{env.TERRAFORM_VERSION}}"
217
180
terraform_wrapper : false
218
- - name : Build provider
219
- run : |
220
- make build
221
- make terraformrc
222
181
- name : Apply Terraform
223
182
run : |
224
- export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
225
183
cd examples/helm-install
226
184
terraform init
227
185
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:
239
197
if : ${{ always() }}
240
198
continue-on-error : true
241
199
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
248
201
env :
249
202
GITHUB_TOKEN : ${{ secrets.GITPROVIDER_BOT_TOKEN }}
250
203
e2e-flux-bootstrap-with-github-pat :
@@ -284,9 +237,10 @@ jobs:
284
237
run : |
285
238
make build
286
239
make terraformrc
240
+ trc="${PWD}/.terraformrc"
241
+ echo "TF_CLI_CONFIG_FILE=${trc}" >> "$GITHUB_ENV"
287
242
- name : Apply Terraform
288
243
run : |
289
- export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc"
290
244
cd examples/github-via-pat
291
245
terraform init
292
246
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:
304
258
if : ${{ always() }}
305
259
continue-on-error : true
306
260
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
313
262
env :
314
263
GITHUB_TOKEN : ${{ secrets.GITPROVIDER_BOT_TOKEN }}
0 commit comments