Skip to content
Snippets Groups Projects
Commit 9a2c4115 authored by Ravi Tripathi's avatar Ravi Tripathi
Browse files

Merge branch 'feat-add-target-env-in-image-name' into 'master'

Add target env in image name for creation and cleanup

See merge request !14
parents 5ae31176 e46dcc8d
No related branches found
No related tags found
1 merge request!14Add target env in image name for creation and cleanup
......@@ -42,7 +42,7 @@ build_packer:
script:
- cd CRI_XCBC && git checkout dev && git pull && cd ..
- cd CRI_Cluster_Monitor && git checkout master && git pull && cd ..
- export PKR_VAR_build_image_name="xdmod-$(date +%Y%m%d%H%M%S)"
- export PKR_VAR_build_image_name="xdmod-$TARGET_ENV-$(date +%Y%m%d%H%M%S)"
- 'sed -i -E "s/(enable_selinix_permissive: ).*/\1true/" CRI_Cluster_Monitor/group_vars/all'
- 'sed -i -E "s/(enable_simplesaml: ).*/\1true/" CRI_Cluster_Monitor/group_vars/all'
- 'sed -i -E "s/(openssl_cert_gen: ).*/\1true/" CRI_Cluster_Monitor/group_vars/all'
......@@ -58,7 +58,7 @@ clean_up: # This job removes older built images
stage: clean # It only starts when the job in the build stage completes successfully.
script:
- |
IMAGE_TO_BE_DELETE=($(openstack image list --sort-column Name --sort-descending -f value -c Name -c ID | grep -P ' xdmod-\d{14}$' | sed -n $(($NUM_IMAGE_TO_KEEP+1))',$p' | awk '{print $1}'))
IMAGE_TO_BE_DELETE=($(openstack image list --sort-column Name --sort-descending -f value -c Name -c ID | grep -P ' xdmod-$TARGET_ENV-\d{14}$' | sed -n $(($NUM_IMAGE_TO_KEEP+1))',$p' | awk '{print $1}'))
echo "Images deleted:\n"
for img in ${IMAGE_TO_BE_DELETE[@]}; do
echo ${img}
......
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