-
Eleni Mathioulaki authored3e31a298
Forked from
EBRAINS RI / Tech Hub / Platform / EBRAINS Software Distribution / ebrains-spack-builds
118 commits behind the upstream repository.
.gitlab-ci.yml 10.48 KiB
stages:
- build
- test
variables:
BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/ebrains-spack-build-env/base:24.12
SPACK_VERSION: v0.21.1
SPACK_PATH_GITLAB: /mnt/spack_v0.21.1
SYSTEMNAME: ebrainslab
# ===================================================================
# LAB DEPLOYMENTS
# ===================================================================
# start a k8s Job that will build the Spack environment
.deploy-build-environment:
stage: build
tags:
- docker-runner
- read-only
image: alpine:3.21.0
before_script:
- apk add kubectl
script:
# use the site-specific kubectl context
- kubectl config use-context $KUBE_CONTEXT
# create job description file
- sh create_job.sh $CI_PIPELINE_ID $BUILD_ENV_DOCKER_IMAGE $INSTALLATION_ROOT $SPACK_VERSION $SPACK_ENV $CI_COMMIT_BRANCH $RELEASE_NAME $LAB_KERNEL_ROOT
- cat simplejob.yml
# start the deploy job
- kubectl create -f simplejob.yml
# wait for job to finish to get the logs
- while true; do sleep 300; x=$(kubectl get pods -l job-name=simplejob${CI_PIPELINE_ID} -o jsonpath='{.items[0].status.phase}'); if [ $x != "Running" ]; then break; fi; done
# # copy logs of failed packages locally, to keep as job artifacts
# - oc rsync $(oc get pods -l job-name=simplejob${CI_PIPELINE_ID} -o name):/tmp ./ --include="*/" --include="spack/spack-stage/*/*.txt" --exclude="*"
# - mv tmp/spack/spack-stage spack_logs
# # also copy the spec of the created kernel, to keep as job artifacts
# - LAB_KERNEL_PATH = $LAB_KERNEL_ROOT/$(echo "$RELEASE_NAME" | tr '[:upper:]' '[:lower:]')
# - oc rsync $(oc get pods -l job-name=simplejob${CI_PIPELINE_ID} -o name):$LAB_KERNEL_PATH ./
# - mv .$LAB_KERNEL_PATH kernel_specs
# if spack install has failed, fail the pipeline
- kubectl logs jobs/simplejob${CI_PIPELINE_ID} | tee log.txt
- if [ $(kubectl get pods -l job-name=simplejob${CI_PIPELINE_ID} -o jsonpath='{.items[0].status.containerStatuses[0].state.terminated.exitCode}') -ne 0 ]; then exit 1; fi;
# delete the job, as we have the logs here
- kubectl delete job simplejob${CI_PIPELINE_ID} || true
# artifacts:
# paths:
# - spack_logs
# - kernel_specs
# when: always
# -------------------------------------------------------------------
# Lab deployment target environments: dev and prod Lab instances
# -------------------------------------------------------------------
# deploy to a dev lab environment
.deploy-dev-server:
extends: .deploy-build-environment
variables:
LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/int
INSTALLATION_ROOT: /srv/test-build-2402
# deploy to a prod lab environment
.deploy-prod-server:
extends: .deploy-build-environment
variables:
LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
INSTALLATION_ROOT: /srv/main-spack-instance-2402
# deploy to the dev lab environment at CINECA