Skip to content
Snippets Groups Projects
Commit 93bedce7 authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Merge branch 'fix-integration-project' into 'main'

Fix integration project separation

Closes #116

See merge request rc/packer-openstack-hpc-image!87
parents 5a68d67e 3fd62daf
No related branches found
No related tags found
No related merge requests found
......@@ -293,26 +293,19 @@ test_ood_image:
curl --retry 10 --retry-delay 20 --retry-connrefused https://knightly.rc.uab.edu/Shibboleth.sso/Metadata --resolve knightly.rc.uab.edu:443:$FLOATING_IP -kf
|| FAILED=true
- |
if [ $CI_PIPELINE_SOURCE == 'merge_request_event' ]; then
ssh -o StrictHostKeyChecking=no acctsvc@$FLOATING_IP '[ $(mount | grep "etc/auto" | wc -l) -eq 6 ]' || FAILED=true
elif [ $CI_PIPELINE_SOURCE == 'schedule' ]; then
cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
until ssh acctsvc@$FLOATING_IP hostname; do sleep 5; done;
ssh acctsvc@$FLOATING_IP '[ $(mount | grep "etc/auto" | wc -l) -eq 6 ]' || FAILED=true
fi
cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
until ssh acctsvc@$FLOATING_IP hostname; do sleep 5; done
ssh acctsvc@$FLOATING_IP '[ $(mount | grep "etc/auto" | wc -l) -eq 6 ]' || FAILED=true
- |
if [ "$FAILED" = true ]; then
if [ "${DELETE_WHEN_FAILED-true}" = true ]; then
openstack server delete $NEW_INSTANCE_ID
openstack image delete $BUILT_OOD_IMAGE_ID
echo "DELETE_BUILT_IMAGE=true" | tee -a instance.env
fi
false
fi
- |
if [ $CI_PIPELINE_SOURCE = "schedule" ]; then
openstack server remove floating ip $NEW_INSTANCE_ID $FLOATING_IP
fi
- openstack server remove floating ip $NEW_INSTANCE_ID $FLOATING_IP
artifacts:
reports:
dotenv: instance.env
......@@ -463,6 +456,10 @@ cleanup_integration:
script:
- OS_PROJECT_ID=$(openstack application credential show $OS_APPLICATION_CREDENTIAL_ID -f value -c project_id)
- openstack image list --sort-column Name --sort-descending -f value -c Name -c ID --property owner=$OS_PROJECT_ID > images.txt
- |
if [ "${DELETE_BUILT_IMAGE-false}" = true ]; then
openstack image delete $BUILT_OOD_IMAGE_ID
fi
- >
OOD_IMAGE_TO_BE_DELETE=($(cat images.txt
| awk -v NITK=$NUM_IMAGE_TO_KEEP -v REGEX=ood-$TIMESTAMP_REGEX
......
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