diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fffbe6b21750756120f4d071044818ce15de6f2d..9d448490fb6b6e0cb0ae6bd9a2a6acfebb496361 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,104 +1,99 @@ # This variable can be defined here or, if it needs to be hidden, as a secure variable of the project variables: - # Important as the default is xrdcp which doens't preserve file permissions - METHOD: rsync - .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 - + # Important as the default is xrdcp which doens't preserve file permissions + METHOD: rsync + +.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 + - deploy + - squashfs # Copy repo content to folder that is going to be sent to eos copy: - stage: copy - before_script: - - yum install -y rsync && yum clean all - script: - # Create a directory where to move the output generated - - mkdir public - # This is an important step as it allows the artifact to NOT - # include the .git subfolder from the directory where project - # was checked out by CI runners, since cp * will skip the .git folder. - - rsync -a --exclude 'public' --exclude '.git' * public/ - artifacts: - paths: - # Upload as an artifact the folder where the output has been generated - # This will attach to the job the output. It can be browsed or downloaded - - public - # Make it vanish in 1 hour - expire_in: 1 hour - - + stage: copy + before_script: + - yum install -y rsync && yum clean all + script: + # Create a directory where to move the output generated + - mkdir public + # This is an important step as it allows the artifact to NOT + # include the .git subfolder from the directory where project + # was checked out by CI runners, since cp * will skip the .git folder. + - rsync -a --exclude 'public' --exclude '.git' * public/ + artifacts: + paths: + # Upload as an artifact the folder where the output has been generated + # This will attach to the job the output. It can be browsed or downloaded + - public + # Make it vanish in 1 hour + expire_in: 1 hour # Deploy to an EOS folder the contents generated .base_deploy: &base_deploy - # Executed during the deploy stage - stage: deploy - # Custom docker image providing the needed tools to deploy in EOS - image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest - script: - # Script that performs the deploy to EOS. Makes use of the variables defined in the project - # It will copy the generated content to the folder in EOS - - deploy-eos - # do not run any globally defined before_script or after_script for this step - before_script: [] - after_script: [] - + # Executed during the deploy stage + stage: deploy + # Custom docker image providing the needed tools to deploy in EOS + image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest + script: + # Script that performs the deploy to EOS. Makes use of the variables defined in the project + # It will copy the generated content to the folder in EOS + - deploy-eos + # do not run any globally defined before_script or after_script for this step + before_script: [] + after_script: [] # Create squashfs package in an EOS folder .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=squashfs/package - - CONTENT_DIR=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 $EOS_PATH $PACKAGE_DIR $CONTENT_DIR - #- ssh ${EOS_ACCOUNT_USERNAME}@lxplus "eos root://eoshome-a.cern.ch squash new $EOS_PATH$PACKAGE_DIR" - #- ssh ${EOS_ACCOUNT_USERNAME}@lxplus "cp -r $EOS_PATH$CONTENT_DIR/. $EOS_PATH$PACKAGE_DIR/" - #- ssh ${EOS_ACCOUNT_USERNAME}@lxplus "eos root://eoshome-a.cern.ch squash pack $EOS_PATH$PACKAGE_DIR" + 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=squashfs/package + - CONTENT_DIR=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 $EOS_PATH $PACKAGE_DIR $CONTENT_DIR + #- ssh ${EOS_ACCOUNT_USERNAME}@lxplus "eos root://eoshome-a.cern.ch squash new $EOS_PATH$PACKAGE_DIR" + #- ssh ${EOS_ACCOUNT_USERNAME}@lxplus "cp -r $EOS_PATH$CONTENT_DIR/. $EOS_PATH$PACKAGE_DIR/" + #- ssh ${EOS_ACCOUNT_USERNAME}@lxplus "eos root://eoshome-a.cern.ch squash pack $EOS_PATH$PACKAGE_DIR" Test squashfs: - <<: *add_squashfs - variables: - <<: *dev_variables - <<: *common_variables - + <<: *add_squashfs + variables: + <<: *dev_variables + <<: *common_variables squashfs: - <<: *add_squashfs - variables: - <<: *master_variables - <<: *common_variables - only: - - master - + <<: *add_squashfs + variables: + <<: *master_variables + <<: *common_variables + only: + - master Test deploy: - <<: *base_deploy - variables: - <<: *dev_variables - + <<: *base_deploy + variables: + <<: *dev_variables Deploy: - <<: *base_deploy - only: - - master - variables: - <<: *master_variables + <<: *base_deploy + only: + - master + variables: + <<: *master_variables