diff --git a/deploy_custom_images.yml.tmpl b/deploy_custom_images.yml.tmpl new file mode 100644 index 0000000000000000000000000000000000000000..fb85508f719ee2a2e210140374d37eb88062c08b --- /dev/null +++ b/deploy_custom_images.yml.tmpl @@ -0,0 +1,9 @@ +${CUSTOM_IMAGE_TYPE}: + script: + - docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" $CI_REGISTRY + - docker pull $DIT_REGISTRY/custom_images/${CUSTOM_IMAGE_TYPE}:main + - docker tag $DIT_REGISTRY/custom_images/${CUSTOM_IMAGE_TYPE}:main $CI_REGISTRY/root/maap-workspaces/custom_images/${CUSTOM_IMAGE_TYPE}:${TAG} + - docker push $CI_REGISTRY/root/maap-workspaces/custom_images/${CUSTOM_IMAGE_TYPE}:${TAG} + + tags: + - shell diff --git a/generate-deploy-stages.sh b/generate-deploy-stages.sh index bde1925d67286b8f2bcacf765341ffd1ea57813e..c417639412716d26b53de3328c98d3429659f2d3 100644 --- a/generate-deploy-stages.sh +++ b/generate-deploy-stages.sh @@ -11,17 +11,26 @@ if [ ! -z "${TAG}" ]; then git clone --single-branch --branch ${TAG} https://github.com/MAAP-Project/maap-workspaces.git pushd maap-workspaces ls -d base_images/*/* > ${basedir}/images.txt + ls -d custom_images/*/* > ${basedir}/images.txt popd cat ${basedir}/images.txt - template="${basedir}/deploy.yml.tmpl" + cat ${basedir}/images.txt | while read image do if [[ "$image" == base_images/*/* ]]; then + template="${basedir}/deploy.yml.tmpl" second_dir=$(echo "$image" | cut -d'/' -f2) export BASE_IMAGE_TYPE=${second_dir} export TAG=${TAG} export DIT_REGISTRY=${DIT_REGISTRY} cat ${template} | CI_JOB_TOKEN='$CI_JOB_TOKEN' envsubst >> deploy.yml + elif [[ "$image" == custom_images/*/* ]]; then + template="${basedir}/deploy_custom_images.yml.tmpl" + second_dir=$(echo "$image" | cut -d'/' -f2) + export CUSTOM_IMAGE_TYPE=${second_dir} + export TAG=${TAG} + export DIT_REGISTRY=${DIT_REGISTRY} + cat ${template} | CI_JOB_TOKEN='$CI_JOB_TOKEN' envsubst >> deploy.yml fi done fi