Skip to content

Commit fd3adf6

Browse files
committed
Allows job to be manually cancelled.
1 parent 1596173 commit fd3adf6

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

.github/workflows/stackhpc-all-in-one.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
# NOTE: Runner needs unzip and nodejs packages.
7070
all-in-one:
7171
name: All in one
72-
if: inputs.if
72+
if: inputs.if && !cancelled()
7373
runs-on: arc-skc-aio-runner
7474
permissions: {}
7575
env:
@@ -81,6 +81,7 @@ jobs:
8181
uses: ConorMacBride/install-package@main
8282
with:
8383
apt: build-essential git unzip nodejs python3 python3-pip python3-wheel python-is-python3
84+
if: ${{ !cancelled() }}
8485

8586
- uses: actions/checkout@v4
8687
with:
@@ -89,11 +90,13 @@ jobs:
8990
- name: Make sure dockerd is running and test Docker.
9091
run: |
9192
docker run --rm hello-world
93+
if: ${{ !cancelled() }}
9294

9395
- name: Output image tag
9496
id: image_tag
9597
run: |
9698
echo image_tag=$(grep stackhpc_${{ inputs.os_distribution }}_$(sed s/-/_/ <(echo "${{ inputs.os_release }}"))_overcloud_host_image_version: etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
99+
if: ${{ !cancelled() }}
97100

98101
# Use the image override if set, otherwise use overcloud-os_distribution-os_release-tag
99102
- name: Output image name
@@ -104,24 +107,29 @@ jobs:
104107
else
105108
echo image_name=${{ inputs.vm_image_override }} >> $GITHUB_OUTPUT
106109
fi
110+
if: ${{ !cancelled() }}
107111

108112
- name: Install terraform
109113
uses: hashicorp/setup-terraform@v2
114+
if: ${{ !cancelled() }}
110115

111116
- name: Initialise terraform
112117
run: terraform init
113118
working-directory: ${{ github.workspace }}/terraform/aio
119+
if: ${{ !cancelled() }}
114120

115121
- name: Generate SSH keypair
116122
run: ssh-keygen -f id_rsa -N ''
117123
working-directory: ${{ github.workspace }}/terraform/aio
124+
if: ${{ !cancelled() }}
118125

119126
- name: Generate clouds.yaml
120127
run: |
121128
cat << EOF > clouds.yaml
122129
${{ secrets.CLOUDS_YAML }}
123130
EOF
124131
working-directory: ${{ github.workspace }}/terraform/aio
132+
if: ${{ !cancelled() }}
125133

126134
- name: Generate terraform.tfvars
127135
run: |
@@ -144,6 +152,7 @@ jobs:
144152
VM_NETWORK: ${{ inputs.vm_network }}
145153
VM_SUBNET: ${{ inputs.vm_subnet }}
146154
VM_INTERFACE: ${{ inputs.vm_interface }}
155+
if: ${{ !cancelled() }}
147156

148157
- name: Terraform Plan
149158
run: terraform plan
@@ -152,6 +161,7 @@ jobs:
152161
OS_CLOUD: ${{ inputs.OS_CLOUD }}
153162
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
154163
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
164+
if: ${{ !cancelled() }}
155165

156166
- name: Terraform Apply
157167
run: terraform apply -auto-approve
@@ -160,18 +170,21 @@ jobs:
160170
OS_CLOUD: ${{ inputs.OS_CLOUD }}
161171
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
162172
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
173+
if: ${{ !cancelled() }}
163174

164175
- name: Get Terraform outputs
165176
id: tf_outputs
166177
run: |
167178
terraform output -json
168179
working-directory: ${{ github.workspace }}/terraform/aio
180+
if: ${{ !cancelled() }}
169181

170182
- name: Write Terraform outputs
171183
run: |
172184
cat << EOF > etc/kayobe/environments/$KAYOBE_ENVIRONMENT/tf-outputs.yml
173185
${{ steps.tf_outputs.outputs.stdout }}
174186
EOF
187+
if: ${{ !cancelled() }}
175188

176189
- name: Write Terraform network config
177190
run: |
@@ -186,12 +199,14 @@ jobs:
186199
admin_ips:
187200
controller0: "{{ access_ip_v4.value }}"
188201
EOF
202+
if: ${{ !cancelled() }}
189203

190204
- name: Write Terraform network interface config
191205
run: |
192206
cat << EOF > etc/kayobe/environments/$KAYOBE_ENVIRONMENT/inventory/group_vars/controllers/tf-network-interfaces
193207
admin_interface: "{{ access_interface.value }}"
194208
EOF
209+
if: ${{ !cancelled() }}
195210

196211
- name: Write all-in-one scenario config
197212
run: |
@@ -205,6 +220,7 @@ jobs:
205220
ENABLE_OVN: ${{ inputs.neutron_plugin == 'ovn' }}
206221
OS_DISTRIBUTION: ${{ inputs.os_distribution }}
207222
OS_RELEASE: ${{ inputs.os_release }}
223+
if: ${{ !cancelled() }}
208224

209225
# Use a heredoc to define a multiline string output
210226
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
@@ -214,11 +230,13 @@ jobs:
214230
echo "ssh_key<<EOF" >> $GITHUB_OUTPUT
215231
cat terraform/aio/id_rsa >> $GITHUB_OUTPUT
216232
echo "EOF" >> $GITHUB_OUTPUT
233+
if: ${{ !cancelled() }}
217234

218235
# The same tag may be reused (e.g. pr-123), so ensure we have the latest image.
219236
- name: Pull latest Kayobe image
220237
run: |
221238
docker image pull $KAYOBE_IMAGE
239+
if: ${{ !cancelled() }}
222240

223241
- name: Run growroot
224242
run: |
@@ -229,6 +247,7 @@ jobs:
229247
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh '$KAYOBE_CONFIG_PATH/ansible/growroot.yml'
230248
env:
231249
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
250+
if: ${{ !cancelled() }}
232251

233252
- name: Host configure
234253
run: |
@@ -239,6 +258,7 @@ jobs:
239258
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/overcloud-host-configure.sh
240259
env:
241260
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
261+
if: ${{ !cancelled() }}
242262

243263
- name: Service deploy
244264
run: |
@@ -249,6 +269,7 @@ jobs:
249269
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/overcloud-service-deploy.sh
250270
env:
251271
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
272+
if: ${{ !cancelled() }}
252273

253274
- name: Configure aio resources
254275
run: |
@@ -259,6 +280,8 @@ jobs:
259280
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh etc/kayobe/ansible/configure-aio-resources.yml
260281
env:
261282
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
283+
if: ${{ !cancelled() }}
284+
262285

263286
- name: Tempest tests
264287
run: |
@@ -271,6 +294,7 @@ jobs:
271294
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/tempest.sh -e ansible_user=stack
272295
env:
273296
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
297+
if: ${{ !cancelled() }}
274298

275299
- name: Upload test result artifacts
276300
uses: actions/upload-artifact@v3
@@ -294,4 +318,4 @@ jobs:
294318
- name: Prune Docker images over 1 week old
295319
# May fail if another prune is running
296320
run: docker image prune --all --force --filter until=168h || true
297-
if: always()
321+
if: always()

.github/workflows/stackhpc-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ jobs:
9090
OS_CLOUD: openstack
9191
if: ${{ needs.check-changes.outputs.aio == 'true' }}
9292
secrets: inherit
93-
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
93+
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }} && ${{ !cancelled() }}

0 commit comments

Comments
 (0)