From ddf367d764b9a4b9db20593e6bf3bcdf3b03de74 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: Wed, 17 Jan 2024 22:58:11 +0000
Subject: [PATCH] Update generate-deploy-ops-stages.sh use find command instead
 of ls

---
 generate-deploy-ops-stages.sh | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/generate-deploy-ops-stages.sh b/generate-deploy-ops-stages.sh
index 1e30eaf..bfe90d4 100644
--- a/generate-deploy-ops-stages.sh
+++ b/generate-deploy-ops-stages.sh
@@ -5,19 +5,18 @@ echo "Running CI for ${TAG}"
 if [[ ! -z "${TAG}" ]]; then
   git clone --single-branch --branch ${TAG} https://github.com/MAAP-Project/maap-workspaces.git
   pushd maap-workspaces
-  # Print names of directories in base_images
-  ls -l base_images/ | grep '^d' | awk '{print $NF}' > ${basedir}/images.txt
+  # List paths containing dockerfiles
+  find base_images -name "Dockerfile" -type f > ${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
-      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
+    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
     fi
   done
 fi
-- 
GitLab