Skip to content

Commit d504363

Browse files
committed
fix stackhpc tf directory change
1 parent e140948 commit d504363

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

.github/workflows/stackhpc.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ jobs:
4343
TF_VAR_cluster_name: slurmci-${{ matrix.os_version }}-${{ github.run_number }}
4444
CI_CLOUD: ${{ vars.CI_CLOUD }} # default from repo settings
4545
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/
4650
steps:
4751

4852
- name: Find the latest release
@@ -55,11 +59,6 @@ jobs:
5559
ref: ${{ env.LATEST_RELEASE_TAG }}
5660
fetch-depth: 0
5761

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-
6362
- name: Override CI_CLOUD if PR label is present
6463
if: ${{ github.event_name == 'pull_request' }}
6564
run: |
@@ -77,7 +76,6 @@ jobs:
7776
- name: Record debug info
7877
run: |
7978
echo LATEST_RELEASE_TAG: $LATEST_RELEASE_TAG
80-
echo STACKHPC_TF_DIR_RELEASE: $STACKHPC_TF_DIR_RELEASE
8179
echo CI_CLOUD: $CI_CLOUD
8280
8381
- name: Setup ssh
@@ -102,7 +100,7 @@ jobs:
102100

103101
- name: Initialise tofu
104102
run: tofu init
105-
working-directory: ${{ env.STACKHPC_TF_DIR_RELEASE }}
103+
working-directory: ${{ env.STACKHPC_TF_DIR_OLD }}
106104

107105
- name: Write clouds.yaml
108106
run: |
@@ -124,14 +122,14 @@ jobs:
124122
run: |
125123
. venv/bin/activate
126124
. environments/.stackhpc/activate
127-
cd $STACKHPC_TF_DIR_RELEASE
125+
cd $STACKHPC_TF_DIR_OLD
128126
tofu apply -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
129127
130128
- name: Delete infrastructure if provisioning failed
131129
run: |
132130
. venv/bin/activate
133131
. environments/.stackhpc/activate
134-
cd $STACKHPC_TF_DIR_RELEASE
132+
cd $STACKHPC_TF_DIR_OLD
135133
tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
136134
if: failure() && steps.provision_servers.outcome == 'failure'
137135

@@ -192,18 +190,12 @@ jobs:
192190
- name: Update ansible, pip and galaxy requirements
193191
run: dev/setup-env.sh
194192

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-
200193
- name: Reimage login and control nodes to image in current branch
201194
id: reimage_non_compute
202195
run: |
203-
echo STACKHPC_TF_DIR_BRANCH: $STACKHPC_TF_DIR_BRANCH
204196
. venv/bin/activate
205197
. environments/.stackhpc/activate
206-
cd $STACKHPC_TF_DIR_BRANCH
198+
cd $STACKHPC_TF_DIR_NEW
207199
tofu apply -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
208200
209201
- name: Configure cluster using current branch
@@ -243,6 +235,9 @@ jobs:
243235
run: |
244236
. venv/bin/activate
245237
. 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 -
241+
cd $STACKHPC_TF_DIR_NEW
242+
tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars" || echo "tofu failed in $STACKHPC_TF_DIR_NEW"
248243
if: ${{ success() || cancelled() }}

0 commit comments

Comments
 (0)