Skip to content

Commit fbeea14

Browse files
committed
wip: Tweak workflow to attempt creating server only if does not exists
1 parent 78d762a commit fbeea14

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/create-instance.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,28 @@ jobs:
6767

6868
- uses: actions/checkout@v4
6969

70+
- name: Check instance exists
71+
id: check_instance
72+
run: |
73+
export OS_CLOUD=BIO180006_IU # Select openstack auth settings defined in ".config/openstack/clouds.yaml"
74+
75+
source ~/venv/bin/activate
76+
77+
instance=$(openstack server list -f json | \
78+
jq \
79+
--arg instance_name "$INSTANCE_NAME" \
80+
-c '.[] | select(.Name | contains($instance_name))' | \
81+
jq -r '.Name')
82+
83+
[[ $instance == "$INSTANCE_NAME" ]] && exists="true" || exists="false"
84+
85+
echo "exists=$exists" >> $GITHUB_OUTPUT
86+
87+
env:
88+
INSTANCE_NAME: ${{ steps.define.outputs.instance_name }}
89+
7090
- name: Create instance
91+
if: !fromJSON(steps.check_instance.outputs.exists)
7192
run: |
7293
export OS_CLOUD=BIO180006_IU # Select openstack auth settings defined in ".config/openstack/clouds.yaml"
7394

0 commit comments

Comments
 (0)