@@ -37,20 +37,34 @@ jobs:
37
37
ANSIBLE_FORCE_COLOR : True
38
38
OS_CLOUD : openstack
39
39
TF_VAR_cluster_name : slurmci-${{ matrix.os_version }}-${{ github.run_number }}
40
- CI_CLOUD : ${{ vars.CI_CLOUD }}
40
+ CI_CLOUD : ${{ vars.CI_CLOUD }} # default from repo settings
41
41
TF_VAR_os_version : ${{ matrix.os_version }}
42
42
steps :
43
43
- uses : actions/checkout@v2
44
44
45
+ - name : Override CI_CLOUD if PR label is present
46
+ if : ${{ github.event_name == 'pull_request' }}
47
+ run : |
48
+ # Iterate over the labels
49
+ labels=$(echo '${{ toJSON(github.event.pull_request.labels) }}' | jq -r '.[].name')
50
+ echo $labels
51
+ for label in $labels; do
52
+ if [[ $label == CI_CLOUD=* ]]; then
53
+ # Extract the value after 'CI_CLOUD='
54
+ CI_CLOUD_OVERRIDE=${label#CI_CLOUD=}
55
+ echo "CI_CLOUD=${CI_CLOUD_OVERRIDE}" >> $GITHUB_ENV
56
+ fi
57
+ done
58
+
45
59
- name : Record settings for CI cloud
46
60
run : |
47
- echo CI_CLOUD: ${{ vars .CI_CLOUD }}
61
+ echo CI_CLOUD: ${{ env .CI_CLOUD }}
48
62
49
63
- name : Setup ssh
50
64
run : |
51
65
set -x
52
66
mkdir ~/.ssh
53
- echo "${{ secrets[format('{0}_SSH_KEY', vars .CI_CLOUD)] }}" > ~/.ssh/id_rsa
67
+ echo "${{ secrets[format('{0}_SSH_KEY', env .CI_CLOUD)] }}" > ~/.ssh/id_rsa
54
68
chmod 0600 ~/.ssh/id_rsa
55
69
shell : bash
56
70
73
87
- name : Write clouds.yaml
74
88
run : |
75
89
mkdir -p ~/.config/openstack/
76
- echo "${{ secrets[format('{0}_CLOUDS_YAML', vars .CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
90
+ echo "${{ secrets[format('{0}_CLOUDS_YAML', env .CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
77
91
shell : bash
78
92
79
93
- name : Setup environment-specific inventory/terraform inputs
@@ -91,14 +105,14 @@ jobs:
91
105
. venv/bin/activate
92
106
. environments/.stackhpc/activate
93
107
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
94
- terraform apply -auto-approve -var-file="${{ vars .CI_CLOUD }}.tfvars"
108
+ terraform apply -auto-approve -var-file="${{ env .CI_CLOUD }}.tfvars"
95
109
96
110
- name : Delete infrastructure if provisioning failed
97
111
run : |
98
112
. venv/bin/activate
99
113
. environments/.stackhpc/activate
100
114
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
101
- terraform destroy -auto-approve -var-file="${{ vars .CI_CLOUD }}.tfvars"
115
+ terraform destroy -auto-approve -var-file="${{ env .CI_CLOUD }}.tfvars"
102
116
if : failure() && steps.provision_servers.outcome == 'failure'
103
117
104
118
- name : Configure cluster
@@ -196,7 +210,7 @@ jobs:
196
210
. venv/bin/activate
197
211
. environments/.stackhpc/activate
198
212
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
199
- terraform destroy -auto-approve -var-file="${{ vars .CI_CLOUD }}.tfvars"
213
+ terraform destroy -auto-approve -var-file="${{ env .CI_CLOUD }}.tfvars"
200
214
if : ${{ success() || cancelled() }}
201
215
202
216
# - name: Delete images
0 commit comments