Skip to content

Commit

Permalink
wip: If needed, explicitly associated IP with instance
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfr committed May 7, 2024
1 parent 86ddac2 commit fa733da
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/create-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,25 @@ jobs:
INSTANCE_FLAVOR: ${{ steps.labels.outputs.instance_flavor }}
FLOATING_IP_UUID: ${{ steps.ip_create.outputs.floating_ip_uuid }}

- name: Associate floating IP with created instance
run: |
export OS_CLOUD=BIO180006_IU # Select openstack auth settings defined in ".config/openstack/clouds.yaml"
source ~/venv/bin/activate
has_ip=$(
openstack server show $INSTANCE_NAME -c addresses -f json | \
jq -r '.addresses.auto_allocated_network[1] != null'
)
echo "has_ip [$has_ip]"
if [[ ! $has_ip ]]; then
openstack server add floating ip "$INSTANCE_NAME" $FLOATING_IP_ADDRESS
fi
env:
FLOATING_IP_ADDRESS: ${{ steps.ip_create.outputs.floating_ip_address }}
INSTANCE_NAME: ${{ steps.define.outputs.instance_name }}

- name: Poll instance status
id: instance_poll
run: |
Expand Down

0 comments on commit fa733da

Please sign in to comment.