Commit bdf43964 authored by Carlyle, Adam's avatar Carlyle, Adam
Browse files

Ability for CI to deploy only OpenStack VMs (i.e. prevent CLI installations)

Most tags (e.g. `0.50.1`) will trigger all CI defined jobs
Tags with 'openstack' in name (e.g. `0.50.1-openstack`) will only run VM re-deployment
parent 9d7cae2d
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@ deploy-titan:
  stage: deploy-client
  only:
    - tags
  except:
    - /^.*openstack.*$/

deploy-summitdev:
  script:
@@ -19,6 +21,8 @@ deploy-summitdev:
  stage: deploy-client
  only:
    - tags
  except:
    - /^.*openstack.*$/

deploy-summit:
  script:
@@ -28,6 +32,8 @@ deploy-summit:
  stage: deploy-client
  only:
    - tags
  except:
    - /^.*openstack.*$/

deploy-openstack:
  script:
+6 −4
Original line number Diff line number Diff line
@@ -51,7 +51,8 @@ while ! ssh_is_up; do
    sleep 3
done

# Reboot to fix a strange issue with apt-get update: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
# Reboot to fix a strange issue with apt-get update:
# "could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)"
echo "Reboot the server to work around /var/lib/apt/lists/lock issue when using apt"
openstack server reboot --wait ${VM_UUID}
sleep 10
@@ -65,7 +66,8 @@ ssh -o StrictHostKeyChecking=no -i ${KEY_FILE} cades@${VM_IP} 'sudo bash -s' < $
echo "Provisioning the builder"
ssh -o StrictHostKeyChecking=no -i ${KEY_FILE} cades@${VM_IP} 'sudo bash -s' < ${SCRIPT_DIR}/provision-builder.sh

# Copy readonly credentials to the builder, these variables must be set in the gitlab runner that's running this script
# Copy readonly credentials to the builder, these variables must be set in
# the gitlab runner that's running this script
echo "GITLAB_READONLY_USERNAME=${GITLAB_READONLY_USERNAME}" > ./environment.sh
echo "GITLAB_READONLY_TOKEN=${GITLAB_READONLY_TOKEN}" >> ./environment.sh
echo "DOCKERHUB_READONLY_USERNAME=${DOCKERHUB_READONLY_USERNAME}" >> ./environment.sh
@@ -75,7 +77,7 @@ scp -o StrictHostKeyChecking=no -i ${KEY_FILE} ./environment.sh cades@${VM_IP}:/
ssh -o StrictHostKeyChecking=no -i ${KEY_FILE} cades@${VM_IP} 'sudo mv /home/cades/environment.sh /home/builder/environment.sh'
ssh -o StrictHostKeyChecking=no -i ${KEY_FILE} cades@${VM_IP} 'sudo chown builder /home/builder/environment.sh'

echo "Reboot the server to ensure its in a clean state before creating the snapshot"
echo "Rebooting the server to ensure a clean state before creating the snapshot"
openstack server reboot --wait ${VM_UUID}

echo "Shutting down server"
@@ -85,7 +87,7 @@ until openstack server list --status SHUTOFF | grep ${VM_UUID} > /dev/null 2>&1;
done
echo -ne "\n"

echo "Sleeping for a bit to make sure builder is completely shut down"
echo "Sleeping for (1) minute to make sure builder is completely shut down"
sleep 60

echo "Creating builder snapshot image"