Skip to content

Commit

Permalink
wip: Tweak workflow to attempt creating server only if does not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfr committed May 7, 2024
1 parent 78d762a commit 592cbdf
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/create-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,29 @@ jobs:

- uses: actions/checkout@v4

- name: Check instance exists
id: check_instance
run: |
export OS_CLOUD=BIO180006_IU # Select openstack auth settings defined in ".config/openstack/clouds.yaml"
source ~/venv/bin/activate
instance=$(openstack server list -f json | \
jq \
--arg instance_name "$INSTANCE_NAME" \
-c '.[] | select(.Name | contains($instance_name))' | \
jq -r '.Name')
[[ $instance == "$INSTANCE_NAME" ]] && exists="true" || exists="false"
echo "exists [$exists]"
echo "exists=$exists" >> $GITHUB_OUTPUT
env:
INSTANCE_NAME: ${{ steps.define.outputs.instance_name }}

- name: Create instance
if: ${{ !fromJSON(steps.check_instance.outputs.exists) }}
run: |
export OS_CLOUD=BIO180006_IU # Select openstack auth settings defined in ".config/openstack/clouds.yaml"
Expand Down

0 comments on commit 592cbdf

Please sign in to comment.