Skip to content

Commit ca610f8

Browse files
committed
simplify TF_DIR path handling
1 parent 9ac9bac commit ca610f8

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

.github/workflows/stackhpc.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ 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/
46+
STACKHPC_TF_DIR: environemnts/.stackhpc/tofu
5047
steps:
5148

5249
- name: Find the latest release
@@ -100,7 +97,7 @@ jobs:
10097

10198
- name: Initialise tofu
10299
run: tofu init
103-
working-directory: ${{ env.STACKHPC_TF_DIR_OLD }}
100+
working-directory: ${{ env.STACKHPC_TF_DIR }}
104101

105102
- name: Write clouds.yaml
106103
run: |
@@ -122,14 +119,14 @@ jobs:
122119
run: |
123120
. venv/bin/activate
124121
. environments/.stackhpc/activate
125-
cd $STACKHPC_TF_DIR_OLD
122+
cd $STACKHPC_TF_DIR
126123
tofu apply -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
127124
128125
- name: Delete infrastructure if provisioning failed
129126
run: |
130127
. venv/bin/activate
131128
. environments/.stackhpc/activate
132-
cd $STACKHPC_TF_DIR_OLD
129+
cd $STACKHPC_TF_DIR
133130
tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
134131
if: failure() && steps.provision_servers.outcome == 'failure'
135132

@@ -195,8 +192,7 @@ jobs:
195192
run: |
196193
. venv/bin/activate
197194
. environments/.stackhpc/activate
198-
cp $STACKHPC_TF_DIR_OLD/terraform.tfstate $STACKHPC_TF_DIR_NEW
199-
cd $STACKHPC_TF_DIR_NEW
195+
cd $STACKHPC_TF_DIR
200196
tofu init
201197
tofu apply -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
202198
@@ -237,9 +233,6 @@ jobs:
237233
run: |
238234
. venv/bin/activate
239235
. environments/.stackhpc/activate
240-
cd $STACKHPC_TF_DIR_OLD
241-
tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars" || echo "tofu failed in $STACKHPC_TF_DIR_OLD"
242-
cd -
243-
cd $STACKHPC_TF_DIR_NEW
244-
tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars" || echo "tofu failed in $STACKHPC_TF_DIR_NEW"
236+
cd $STACKHPC_TF_DIR
237+
tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars" || echo "tofu failed in $STACKHPC_TF_DIR"
245238
if: ${{ success() || cancelled() }}

0 commit comments

Comments
 (0)