Skip to content
Snippets Groups Projects
.gitlab-ci.yml 13.07 KiB
stages:
  - prepare
  - frontend
  - buildnode


variables:
  GITLAB_BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/tc/ebrains-spack-build-env/gitlab_runners_nfs:gitlab_runners_nfs_23.06
  YASHCHIKI_HOME: ${CI_PROJECT_DIR}/.yashchiki
  http_proxy: "http://proxy.kip.uni-heidelberg.de:8080"
  https_proxy: "http://proxy.kip.uni-heidelberg.de:8080"
  HTTP_PROXY: "http://proxy.kip.uni-heidelberg.de:8080"
  HTTPS_PROXY: "http://proxy.kip.uni-heidelberg.de:8080"
  ALL_PROXY: "http://proxy.kip.uni-heidelberg.de:8080"
  SYSTEMNAME: "image_laptop"
  SPACK_ENVIRONMENT_REPO: "${CI_PROJECT_DIR}/esd_spack/var/spack/repos/ebrains-spack-builds"
  SPACK_ENVIRONMENT_PATH: "${CI_PROJECT_DIR}/esd_spack/var/spack/environments/default"
  TMPDIR: "/tmp"

# the image build tool needs Python `yaml` and `apptainer` — we build it via spack
buildenv:
  stage: prepare
  tags:
    - esd_image
  image: $GITLAB_BUILD_ENV_DOCKER_IMAGE
  variables:
    SPACK_DEV_ENV: ebrains-dev
  script:
    # FIXME: that's probably not what we want → we should always clone and install from buildcache!
    - env
    - date
    - ls -lisa
    - test -d esd_spack_buildenv || git clone -b eric_testing https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/spack esd_spack_buildenv
    - pushd esd_spack_buildenv; git fetch origin HEAD && git reset --hard FETCH_HEAD; popd
    - test -d esd_spack_buildenv/var/spack/repos/ebrains-spack-builds || git clone -b image_build https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/ebrains-spack-builds esd_spack_buildenv/var/spack/repos/ebrains-spack-builds
    - pushd esd_spack_buildenv/var/spack/repos/ebrains-spack-builds; git fetch origin image_build && git reset --hard FETCH_HEAD; popd
    - esd_spack_buildenv/bin/spack repo add --scope=site esd_spack_buildenv/var/spack/repos/ebrains-spack-builds || true
    - . esd_spack_buildenv/share/spack/setup-env.sh
    - spack compiler find --scope=site /usr/bin
    - spack external find --scope=site python
    - spack bootstrap root esd_spack_buildenv/opt/spack/bootstrap
    - spack bootstrap now
    - date
    - (nohup spack install -j $(( ($(nproc) * 2 - 4) / 4 + 1)) py-pyyaml 2>&1 | sed -e "s:^:[py-pyyaml] :g") &
    - (nohup spack install -j $(( ($(nproc) * 2 - 4) / 4 + 1)) rsync     2>&1 | sed -e "s:^:[rsync] :g") &
    - (nohup spack install -j $(( ($(nproc) * 2 - 4) / 4 + 1)) proot     2>&1 | sed -e "s:^:[proot-0] :g") &
    - (nohup spack install -j $(( ($(nproc) * 2 - 4) / 4 + 1)) proot     2>&1 | sed -e "s:^:[proot-1] :g") &
    - wait
    - date
    - (nohup spack install -v -j $(( ($(nproc) * 2 - 2) / 2 + 1)) fakeroot  2>&1 | sed -e "s:^:[fakeroot-0] :g") &
    - (nohup spack install -v -j $(( ($(nproc) * 2 - 2) / 2 + 1)) fakeroot  2>&1 | sed -e "s:^:[fakeroot-1] :g") &
    - wait
    - date
    # some more parallelism for apptainer (and oversubscribe!)
    - (nohup spack install -j $(( ($(nproc) * 2 - 3) / 3 + 1)) apptainer~suid 2>&1 | sed -e "s:^:[apptainer-0] :g") &
    - (nohup spack install -j $(( ($(nproc) * 2 - 3) / 3 + 1)) apptainer~suid 2>&1 | sed -e "s:^:[apptainer-1] :g") &
    - (nohup spack install -j $(( ($(nproc) * 2 - 3) / 3 + 1)) apptainer~suid 2>&1 | sed -e "s:^:[apptainer-2] :g") &
    - wait
    - date
    - (nohup spack install -j $(( $(nproc) * 2 )) "skopeo@1.6:" 2>&1 | sed -e "s:^:[skopeo] :g") &
    - wait
    - date
    - (nohup spack install -j $(( $(nproc) * 2 )) "oras" 2>&1 | sed -e "s:^:[oras] :g") &
    - wait
    - date
    - (nohup spack install -j $(( $(nproc) * 2 )) "fakechroot" 2>&1 | sed -e "s:^:[fakechroot] :g") &
    - wait
    - date
    - spack load "oras@1.1:"
  cache: