43
43
TF_VAR_cluster_name : slurmci-${{ matrix.os_version }}-${{ github.run_number }}
44
44
CI_CLOUD : ${{ vars.CI_CLOUD }} # default from repo settings
45
45
TF_VAR_os_version : ${{ matrix.os_version }}
46
+ # Once a v1.158 is released including https://github.com/stackhpc/ansible-slurm-appliance/pull/541
47
+ # this can be simplified:
48
+ STACKHPC_TF_DIR_OLD : environments/.stackhpc/terraform/ # v1.158
49
+ STACKHPC_TF_DIR_NEW : environments/.stackhpc/tofu/
46
50
steps :
47
51
48
52
- name : Find the latest release
55
59
ref : ${{ env.LATEST_RELEASE_TAG }}
56
60
fetch-depth : 0
57
61
58
- - name : Find stackhpc tofu/terraform directory at latest release
59
- # changed in https://github.com/stackhpc/ansible-slurm-appliance/pull/541
60
- run : |
61
- echo STACKHPC_TF_DIR_RELEASE=$(find environments/.stackhpc/ -type d \( -name tofu -o -name terraform \)) >> "$GITHUB_ENV"
62
-
63
62
- name : Override CI_CLOUD if PR label is present
64
63
if : ${{ github.event_name == 'pull_request' }}
65
64
run : |
77
76
- name : Record debug info
78
77
run : |
79
78
echo LATEST_RELEASE_TAG: $LATEST_RELEASE_TAG
80
- echo STACKHPC_TF_DIR_RELEASE: $STACKHPC_TF_DIR_RELEASE
81
79
echo CI_CLOUD: $CI_CLOUD
82
80
83
81
- name : Setup ssh
@@ -102,7 +100,7 @@ jobs:
102
100
103
101
- name : Initialise tofu
104
102
run : tofu init
105
- working-directory : ${{ env.STACKHPC_TF_DIR_RELEASE }}
103
+ working-directory : ${{ env.STACKHPC_TF_DIR_OLD }}
106
104
107
105
- name : Write clouds.yaml
108
106
run : |
@@ -124,14 +122,14 @@ jobs:
124
122
run : |
125
123
. venv/bin/activate
126
124
. environments/.stackhpc/activate
127
- cd $STACKHPC_TF_DIR_RELEASE
125
+ cd $STACKHPC_TF_DIR_OLD
128
126
tofu apply -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
129
127
130
128
- name : Delete infrastructure if provisioning failed
131
129
run : |
132
130
. venv/bin/activate
133
131
. environments/.stackhpc/activate
134
- cd $STACKHPC_TF_DIR_RELEASE
132
+ cd $STACKHPC_TF_DIR_OLD
135
133
tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
136
134
if : failure() && steps.provision_servers.outcome == 'failure'
137
135
@@ -192,18 +190,12 @@ jobs:
192
190
- name : Update ansible, pip and galaxy requirements
193
191
run : dev/setup-env.sh
194
192
195
- - name : Find stackhpc tofu/terraform directory in current branch
196
- # changed in https://github.com/stackhpc/ansible-slurm-appliance/pull/541
197
- run : |
198
- echo STACKHPC_TF_DIR_BRANCH=$(find environments/.stackhpc/ -type d \( -name tofu -o -name terraform \)) >> "$GITHUB_ENV"
199
-
200
193
- name : Reimage login and control nodes to image in current branch
201
194
id : reimage_non_compute
202
195
run : |
203
- echo STACKHPC_TF_DIR_BRANCH: $STACKHPC_TF_DIR_BRANCH
204
196
. venv/bin/activate
205
197
. environments/.stackhpc/activate
206
- cd $STACKHPC_TF_DIR_BRANCH
198
+ cd $STACKHPC_TF_DIR_NEW
207
199
tofu apply -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
208
200
209
201
- name : Configure cluster using current branch
@@ -243,6 +235,8 @@ jobs:
243
235
run : |
244
236
. venv/bin/activate
245
237
. environments/.stackhpc/activate
246
- cd $STACKHPC_TF_DIR_BRANCH
247
- tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
238
+ cd $STACKHPC_TF_DIR_OLD
239
+ tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars" || echo "tofu failed in $STACKHPC_TF_DIR_OLD"
240
+ cd $STACKHPC_TF_DIR_NEW
241
+ tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars" || echo "tofu failed in $STACKHPC_TF_DIR_NEW"
248
242
if : ${{ success() || cancelled() }}
0 commit comments