Skip to content

Commit e5e1445

Browse files
committed
multinode: Fixes from Alex's review
1 parent a09fbb9 commit e5e1445

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

.github/workflows/multinode.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# the cloud.
55

66
name: Multinode
7-
87
on:
98
workflow_call:
109
inputs:
@@ -33,7 +32,7 @@ on:
3332
type: string
3433
default: '9'
3534
ssh_username:
36-
description: User for terraform to access the all-in-one VM
35+
description: User for terraform to access the Multinode hosts
3736
type: string
3837
default: cloud-user
3938
neutron_plugin:
@@ -43,6 +42,7 @@ on:
4342
stackhpc_kayobe_config_version:
4443
description: stackhpc-kayobe-config version
4544
type: string
45+
required: true
4646
stackhpc_kayobe_config_previous_version:
4747
description: stackhpc-kayobe-config previous version
4848
type: string
@@ -55,6 +55,7 @@ on:
5555
type: boolean
5656
default: false
5757
break_on:
58+
# Supported values: 'always', 'never', 'failure', 'success'
5859
description: When to break execution for manual interaction
5960
type: string
6061
default: never
@@ -146,6 +147,15 @@ jobs:
146147
ansible-galaxy collection install -r ansible/requirements.yml -p ansible/collections
147148
working-directory: ${{ github.workspace }}/terraform-kayobe-multinode
148149

150+
- name: Generate a VXLAN VNI
151+
id: vxlan_vni
152+
run: |
153+
# VXLAN VNI is 24 bits
154+
max_vni=$(((2 << (24 - 1)) - 1))
155+
timestamp=$(date +%s)
156+
vni=$(((timestamp % max_vni) + 1))
157+
echo vxlan_vni=$vni >> $GITHUB_OUTPUT
158+
149159
- name: Generate SSH keypair
150160
run: ssh-keygen -f id_rsa -N ''
151161
working-directory: ${{ github.workspace }}/terraform-kayobe-multinode
@@ -241,7 +251,7 @@ jobs:
241251
cat << EOF >> ansible/vars/defaults.yml
242252
kayobe_config_version: ${{ inputs.upgrade && inputs.stackhpc_kayobe_config_previous_version || inputs.stackhpc_kayobe_config_version }}
243253
ssh_key_path: ${{ github.workspace }}/terraform-kayobe-multinode/id_rsa
244-
vxlan_vni: 53299
254+
vxlan_vni: ${{ steps.vxlan_vni.outputs.vxlan_vni }}
245255
vault_password_path: ${{ github.workspace }}/terraform-kayobe-multinode/vault-pw
246256
kayobe_config_custom:
247257
- path: zz-multinode.yml
@@ -350,9 +360,20 @@ jobs:
350360
${{ github.workspace }}/logs/
351361
if: ${{ always() && steps.config_ach.outcome == 'success' }}
352362

353-
- name: Break on failure
354-
run: sleep ${{ inputs.break_duration }}m
355-
if: ${{ failure() && steps.config_ach.outcome == 'success' && inputs.break_on == 'failure' }}
363+
- name: Break for manual interaction
364+
run: |
365+
function wait() {
366+
duration=${{ inputs.break_duration }}m
367+
echo "Breaking on failure for $duration"
368+
sleep $duration
369+
}
370+
371+
if [[ ${{ inputs.break_on }} =~ '(failure|always)' ]] && [[ ${{ failure() }} = 'true' ]]; then
372+
wait "failure"
373+
elif [[ ${{ inputs.break_on }} =~ '(success|always)' ]] && [[ ${{ failure() }} = 'false' ]]; then
374+
wait "success"
375+
fi
376+
if: ${{ always() && steps.config_ach.outcome == 'success' }}
356377

357378
- name: Destroy
358379
run: terraform destroy -auto-approve -input=false

0 commit comments

Comments
 (0)