Skip to content
Snippets Groups Projects
Commit 3d4d83b6 authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

Added OpenStack VM deployment job

- Add `deploy_user_defined_vm` job for configurable VM provisioning
- Implement dynamic OpenStack CLI command construction supporting:
  * Image selection by name/UUID via $VM_IMAGE
  * Flavor specification with $VM_FLAVOR
  * Security group array input ($VM_SECURITY_GROUPS)
  * Network/port options ($VM_NETWORK/$VM_PORT)
  * Floating IP association ($VM_FLOATING_IPS)
- Require core variables: VM_IMAGE, VM_FLAVOR, VM_SECURITY_GROUPS, VM_INSTANCE_NAME
- Add pipeline rule trigger via $DEPLOY_VM == "true"
parent a43040d4
No related branches found
No related tags found
1 merge request!198Added OpenStack VM deployment job
......@@ -426,3 +426,37 @@ deploy_ood_node:
rules:
- if: $PIPELINE_TARGET == "deploy" && $OOD_IMAGE_ID
when: always
deploy_user_defined_vm:
stage: deploy
environment:
name: $ENV
tags:
- build
script:
- |
export cmd="openstack server create"
cmd+=" -c id -f value --image $VM_IMAGE"
cmd+=" --flavor $VM_FLAVOR"
for security_group in ${VM_SECURITY_GROUPS[@]};
do
cmd+=" --security-group $security_group"
done
if [ -n "$VM_NETWORK" ]; then
cmd+=" --network $VM_NETWORK"
fi
if [ -n "$VM_PORT" ]; then
cmd+=" --port $VM_PORT"
fi
cmd+=" --wait $VM_INSTANCE_NAME"
- export VM_INSTANCE_ID=$(bash -c "$cmd")
- |
for FLOATING_IP in ${VM_FLOATING_IPS[@]};
do
openstack server add floating ip $VM_INSTANCE_ID $FLOATING_IP
echo "Associated IP: $FLOATING_IP"
done
rules:
- if: $DEPLOY_VM == "true"
when: always
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment