Skip to content

Commit

Permalink
wip: exit create workflow if instance already exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfr committed May 12, 2024
1 parent c634272 commit 732e94e
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/create-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,27 @@ jobs:
env:
INSTANCE_NAME: ${{ steps.define.outputs.instance_name }}

- name: instance already exists comment (failure)
if: ${{ fromJSON(steps.check_instance.outputs.exists) }}
uses: peter-evans/[email protected]
with:
issue-number: ${{ github.event.issue.number }}
body: |
### Instance Creation Results ❌
Instance **${{ steps.define.outputs.instance_name }}** already exists.
See details at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: instance already exists exit (failure)
if: ${{ fromJSON(steps.check_instance.outputs.exists) }}
run: |
echo "::error Instance $INSTANCE_NAME already exists"
exit 1
env:
INSTANCE_NAME: ${{ steps.define.outputs.instance_name }}

- name: Create floating IP
id: ip_create
if: ${{ !fromJSON(steps.check_instance.outputs.exists) }}
run: |
export OS_CLOUD=BIO180006_IU # Select openstack auth settings defined in ".config/openstack/clouds.yaml"
Expand All @@ -110,7 +128,6 @@ jobs:
echo "floating_ip_address=$floating_ip_address" >> $GITHUB_OUTPUT
- 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 732e94e

Please sign in to comment.