diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d59395dd68cf745fc4f436ad55430e60a8469f8..e2d8a27af670d2dc6538e53ebe418f0f9067012e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,13 +5,17 @@ variables: .master_variables: &master_variables EOS_PATH: "/eos/user/o/okdtests/webeos-tests/" - + .dev_variables: &dev_variables EOS_PATH: "/eos/user/o/okdtests/dev-webeos-tests/" + +.common_variables: &common_variables + SSH_SERVER_HOSTKEYS: lxplus ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTA/5AzXgbkSapknIPDoEePTM1PzIBSiyDnpZihdDXKzm8UdXxCDJLUVjBwc1JfBjnaXPEeBKZDuozDss/m98m5qQu+s2Dks000V8cUFTU+BFotzRWX0jWSBpmzse0477b40X2XCPqX0Cqfx9yHdkuMlyF0kJRxXgsGTcwzwbmvqNHJdHHYJJz93hGpBhYMREcDN5VOxXz6Ack3X7xfF29xaC91oOAqq75O11LXF5Y4kAeN9kDG8o6Zsqk4c5at5aqWqzZfnnVtGjhkgU2Mt5aKwptaFMe0Z3ys/zZM4SnsE9NfompnnWsiKk2y09UvrbzuYPWLt43Fp3+IFqRJvBX stages: - copy - deploy + - squashfs # Copy repo content to folder that is going to be sent to eos copy: @@ -48,6 +52,23 @@ copy: before_script: [] 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: + - mkdir -p ~/.ssh + # validate lxplus's SSH key + - 'echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts' + # 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="${EOS_PATH}squashfs/package" + - COPIED_DIR="${EOS_PATH}cgi-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 $PACKAGE_DIR $COPIED_DIR + Test deploy: <<: *base_deploy @@ -60,4 +81,17 @@ Deploy: - master variables: <<: *master_variables - \ No newline at end of file + +Test squashfs: + <<: *add_squashfs + variables: + <<: *dev_variables + <<: *common_variables + +squashfs: + <<: *add_squashfs + only: + - master + variables: + <<: *master_variables + <<: *common_variables \ No newline at end of file diff --git a/.gitlab/squashfs.sh b/.gitlab/squashfs.sh new file mode 100644 index 0000000000000000000000000000000000000000..c9159853bef4ef6b8d6761a0c7eaefc25690c99a --- /dev/null +++ b/.gitlab/squashfs.sh @@ -0,0 +1,14 @@ +# Create squashfs package with the contents of a EOS directory in an EOS path + +# Input: +# $1: The EOS directory of the package +# $2: The subdirectory to copy into the package + +echo "Input params: " +echo "Package path: $1" +echo "Copied Directory: $2" + +eos root://eoshome.cern.ch squash rm $1 +eos root://eoshome.cern.ch squash new $1 +cp -r $2/. $1/ +eos root://eoshome.cern.ch squash pack $1 diff --git a/squashfs/.htaccess b/squashfs/.htaccess new file mode 100644 index 0000000000000000000000000000000000000000..0ee2017bf5bcb2edbb0e28914709832e7efdac66 --- /dev/null +++ b/squashfs/.htaccess @@ -0,0 +1 @@ +Options FollowSymlinks