-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
0 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,96 +25,6 @@ jobs: | |
name: ["instance:approved"] | ||
}) | ||
- name: Issue Forms Body Parser | ||
id: parse | ||
uses: zentered/[email protected] | ||
|
||
- name: Display parsed data | ||
run: | | ||
echo ${{ toJSON(steps.parse.outputs.data) }} | jq . | ||
- name: Extract fields | ||
id: extract | ||
run: | | ||
email=$( | ||
echo ${{ toJSON(steps.parse.outputs.data) }} | | ||
jq -r ".email.text" | ||
) | ||
echo "email=$email" >> $GITHUB_OUTPUT | ||
instance_flavor=$( | ||
echo ${{ toJSON(steps.parse.outputs.data) }} | | ||
jq -r '."instance-flavor".text | split(" - ")[0]' | ||
) | ||
echo "instance_flavor=$instance_flavor" >> $GITHUB_OUTPUT | ||
- name: Create instance | ||
id: instance_create | ||
run: | | ||
echo Creating instance associated with issue $NUMBER | ||
source ~/app-cred-morpho-cloud-portal_github-runner-openrc.sh > /dev/null 2>&1 | ||
source ~/venv/bin/activate | ||
instance_name="morpho-cloud-portal_instance-$NUMBER" | ||
openstack server create "$instance_name" \ | ||
--nic net-id="auto_allocated_network" \ | ||
--security-group "default" \ | ||
--security-group "exosphere" \ | ||
--flavor $INSTANCE_FLAVOR \ | ||
--image "antsthings-vgl-gpu-image" \ | ||
--wait \ | ||
--column created \ | ||
--column flavor \ | ||
--column image \ | ||
--column name \ | ||
--column status | ||
echo "instance_name=$instance_name" >> $GITHUB_OUTPUT | ||
env: | ||
NUMBER: ${{ github.event.issue.number }} | ||
INSTANCE_FLAVOR: ${{ steps.extract.outputs.instance_flavor }} | ||
|
||
- name: Create floating IP | ||
id: ip_create | ||
run: | | ||
source ~/app-cred-morpho-cloud-portal_github-runner-openrc.sh > /dev/null 2>&1 | ||
source ~/venv/bin/activate | ||
json_output=$(openstack floating ip create public -f json) | ||
echo $json_output | ||
floating_ip_address=$( | ||
echo $json_output | | ||
jq -r ".floating_ip_address" | ||
) | ||
echo "floating_ip_address [$floating_ip_address]" | ||
echo "floating_ip_address=$floating_ip_address" >> $GITHUB_OUTPUT | ||
- name: Associate floating IP with created instance | ||
run: | | ||
source ~/app-cred-morpho-cloud-portal_github-runner-openrc.sh > /dev/null 2>&1 | ||
source ~/venv/bin/activate | ||
openstack server add floating ip "$INSTANCE_NAME" $IP_ADDRESS | ||
env: | ||
IP_ADDRESS: ${{ steps.ip_create.outputs.floating_ip_address }} | ||
INSTANCE_NAME: ${{ steps.instance_create.outputs.instance_name }} | ||
|
||
- name: Send mail | ||
uses: dawidd6/action-send-mail@2cea9617b09d79a095af21254fbcb7ae95903dde # v3.12.0 | ||
with: | ||
server_address: smtp.gmail.com | ||
server_port: 465 | ||
secure: true | ||
username: ${{secrets.MAIL_USERNAME}} | ||
password: ${{secrets.MAIL_PASSWORD}} | ||
from: MorphoCloudPortal | ||
to: ${{ steps.extract.outputs.email }} | ||
subject: | ||
"[MorphoCloudPortal] Instance ${{ github.event.issue.number }} | ||
created" | ||
body: Instance ${{ github.event.issue.number }} created | ||
|
||
- name: Add "instance:created" label | ||
if: ${{ success() }} | ||
uses: actions/github-script@v7 | ||
|