From 96df7babad4206bac4343830176a8606579899e7 Mon Sep 17 00:00:00 2001
From: Krish Moodbidri <krish94@uab.edu>
Date: Fri, 12 Jan 2024 09:30:31 -0600
Subject: [PATCH] upload image to glance and then create vol from that image

---
 .gitlab-ci.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7d169e6..fd7a28f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -40,7 +40,10 @@ prep-deploy:
     - apt-get install -y awscli
     - s3cmd get --force -r --host=$AWS_HOST --host-bucket=$AWS_HOST s3://xdmod-vol/ /tmp
     - ls -l /tmp
-    - openstack volume create --size 20 --image /tmp/xdmod-dev-volume-snap.raw xdmod-ci-volume
+    - openstack image create --container-format bare --disk-format raw --file /tmp/xdmod-dev-volume-snap.raw xdmod-snapshot-image
+    - IMAGE_ID=$(openstack image show -f value -c id xdmod-snapshot-image)
+    - openstack volume create --size 20 --image $IMAGE_ID xdmod-ci-volume
+    
     - |
       if [ "$TARGET_ENV" = "dev" ]; then
            TF_VAR_data_volume="xdmod-dev-volume-$BUILD_DATE"
-- 
GitLab