From c3d35aecf160f13cf8810a8e027309346685eec5 Mon Sep 17 00:00:00 2001
From: cdikonim <chrysoula.dikonimaki@cern.ch>
Date: Tue, 27 Feb 2024 13:25:02 +0100
Subject: [PATCH] refactor

---
 .gitlab-ci.yml      |  7 ++++---
 .gitlab/squashfs.sh | 17 ++++++++---------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c022ade..53e6f48 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -53,6 +53,7 @@ copy:
   after_script: []
 
 # Create squashfs package in an EOS folder
+# Used script from: https://gitlab.cern.ch/gitlabci-examples/kinit_example
 .add_squashfs: &add_squashfs
   stage: squashfs
   before_script:
@@ -62,11 +63,11 @@ copy:
   # tell SSH to forward Kerberos credentials so lxplus can access AFS/EOS on behalf of the user
   - 'echo -e "Host *\n\tGSSAPIDelegateCredentials yes\n\tGSSAPITrustDNS yes\n\n" > ~/.ssh/config'
   script:
-  - PACKAGE_DIR=squashfs/package
-  - CONTENT_DIR=cgi-folder
+  - PACKAGE_DIR=$EOS_PATHsquashfs/package
+  - COPIED_DIR==$EOS_PATHcgi-folder
   # make sure to get a forwardable Kerberos ticket so lxplus can access AFS/EOS on behalf of the user
   - echo "${EOS_ACCOUNT_PASSWORD}" | kinit -f ${EOS_ACCOUNT_USERNAME}@CERN.CH
-  - ssh ${EOS_ACCOUNT_USERNAME}@lxplus "bash -s" < ./.gitlab/squashfs.sh $EOS_PATH $PACKAGE_DIR $CONTENT_DIR
+  - ssh ${EOS_ACCOUNT_USERNAME}@lxplus "bash -s" < ./.gitlab/squashfs.sh $PACKAGE_DIR $COPIED_DIR
 
 
 Test deploy:
diff --git a/.gitlab/squashfs.sh b/.gitlab/squashfs.sh
index e92c6b8..e1e4693 100644
--- a/.gitlab/squashfs.sh
+++ b/.gitlab/squashfs.sh
@@ -1,14 +1,13 @@
 # Create squashfs package with the contents of a EOS directory in an EOS path 
 
 # Input:
-# $1: The EOS path
-# $2: The subdirectory of the package
-# $3: The subdirectory to copy into the package
+# $1: The EOS directory of the package
+# $2: The subdirectory to copy into the package
 
-echo "Params given as input: "
-echo "Package path: $1$2"
-echo "Copied Directory: $1$3"
+echo "Input params: "
+echo "Package path: $1"
+echo "Copied Directory: $2"
 
-eos root://eoshome-a.cern.ch squash new $1$2
-cp -r $1$3/. $1$2/
-eos root://eoshome-a.cern.ch squash pack $1$2
+eos root://eoshome.cern.ch squash new $1
+cp -r $2/. $1/
+eos root://eoshome.cern.ch squash pack $1
-- 
GitLab