-
Eleni Mathioulaki authored6d7b15e5
.gitlab-ci.yml 11.09 KiB
stages:
- build
variables:
SPACK_VERSION: v0.18.1
BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/tc/ebrains-spack-build-env/okd:okd_22.12
# start an OpenShift Job that will build the Spack environment
.deploy-build-environment:
stage: build
script:
# login and select project in openshift
- oc login "$OPENSHIFT_SERVER" --token="$OPENSHIFT_TOKEN"
- oc project $OC_PROJECT
# create job description file
- chmod a+x create_job.sh
- ./create_job.sh $CI_PIPELINE_ID $BUILD_ENV_DOCKER_IMAGE update $INSTALLATION_ROOT $SPACK_VERSION $SPACK_ENV $CI_COMMIT_BRANCH $RELEASE_NAME $LAB_KERNEL_ROOT
- cat simplejob.yml
# start the deploy job
- oc create -f simplejob.yml
# wait for job to finish to get the logs
- while true; do sleep 300; x=$(oc get pods | grep simplejob${CI_PIPELINE_ID} | awk '{ print $3}'); if [ $x != "Running" ]; then break; fi; done
- oc logs jobs/simplejob${CI_PIPELINE_ID} | tee log.txt
# if spack install has failed, fail the pipeline
- if [ $(cat log.txt | grep "No module available for package" | wc -l) -gt 0 ]; then exit 1; fi;
# delete the job from OpenShift as we have the logs here
- oc delete job simplejob${CI_PIPELINE_ID} || true
tags:
- shell-runner
# Deploy in the lab-int environment the version of the tools to be
# tested before released to production (push pipeline)
# deploy on the dev environment of the okd dev cluster at CSCS
# runs on protected branches only as the token variable is protected
deploy-int-release-dev-cscs:
extends: .deploy-build-environment
variables:
OPENSHIFT_SERVER: $CSCS_OPENSHIFT_DEV_SERVER
OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_DEV_TOKEN
OC_PROJECT: jupyterhub-int
LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/int
INSTALLATION_ROOT: /srv/test-build-2212
SPACK_ENV: test
RELEASE_NAME: EBRAINS-test
resource_group: shared-NFS-mount-dev-cscs
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_NAMESPACE =~ /technical-coordination/
# Deploy the production release of tools (manual pipeline)
# deploy on the production environment of the okd prod cluster at CSCS
# runs on protected branches only as the token variable is protected
deploy-prod-release-prod-cscs:
extends: .deploy-build-environment
variables:
OPENSHIFT_SERVER: $CSCS_OPENSHIFT_PROD_SERVER
OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_PROD_TOKEN
OC_PROJECT: jupyterhub
LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
INSTALLATION_ROOT: /srv/main-spack-instance-2212
SPACK_ENV: ebrains-23-01
RELEASE_NAME: EBRAINS-23.01
resource_group: shared-NFS-mount-prod-cscs
rules:
- if: $CI_COMMIT_BRANCH =~ /ebrains/
when: manual
# Deploy the production release of tools (manual pipeline)
# deploy on the production environment of the okd prod cluster at JSC
# runs on protected branches only as the token variable is protected
deploy-prod-release-prod-jsc: