summaryrefslogtreecommitdiff
path: root/share/spack/gitlab/cloud_pipelines/configs/ci.yaml
blob: c27065b3bed0f7ac5170552303348ca47651bd01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
ci:
  target: gitlab

  broken-tests-packages:
    - gptune
    - superlu-dist    # srun -n 4 hangs
    - papyrus

  broken-specs-url: "https://dummy.io" # s3://spack-binaries/broken-specs"

  pipeline-gen:
  - build-job:
      before_script-:
      - - spack list --count  # ensure that spack's cache is populated
      - - spack env activate --without-view ${SPACK_CONCRETE_ENV_DIR}
        - spack compiler list
        - if [ -n "$SPACK_BUILD_JOBS" ]; then spack config add "config:build_jobs:$SPACK_BUILD_JOBS"; fi
      - - mkdir -p ${SPACK_ARTIFACTS_ROOT}/user_data
        # AWS runners mount E4S public key (verification), UO runners mount public/private (signing/verification)
      - - k=$CI_GPG_KEY_ROOT/e4s.gpg; [[ -r $k ]] && spack gpg trust $k
        # UO runners mount intermediate ci public key (verification), AWS runners mount public/private (signing/verification)
        - k=$CI_GPG_KEY_ROOT/intermediate_ci_signing_key.gpg; [[ -r $k ]] && spack gpg trust $k
        - k=$CI_GPG_KEY_ROOT/spack_public_key.gpg; [[ -r $k ]] && spack gpg trust $k
      script::
      - - spack config blame mirrors
        - spack --color=always --backtrace ci rebuild --tests > >(tee ${SPACK_ARTIFACTS_ROOT}/user_data/pipeline_out.txt) 2> >(tee ${SPACK_ARTIFACTS_ROOT}/user_data/pipeline_err.txt >&2)
      - - spack python ${CI_PROJECT_DIR}/share/spack/gitlab/cloud_pipelines/scripts/common/aggregate_package_logs.spack.py
          --prefix /home/software/spack:${CI_PROJECT_DIR}/opt/spack
          --log install_times.json
          ${SPACK_ARTIFACTS_ROOT}/user_data/install_times.json
      after_script:
      - - cat /proc/loadavg || true
      variables:
        CI_JOB_SIZE: "default"
        CI_GPG_KEY_ROOT: /mnt/key
        # SPACK_VERBOSE_SCRIPT: "1"
      id_tokens:
        GITLAB_OIDC_TOKEN:
          aud: "${OIDC_TOKEN_AUDIENCE}"

  - signing-job:
      image: { "name": "ghcr.io/spack/notary:latest", "entrypoint": [""] }
      tags: ["aws"]
      script:
      - - aws s3 sync --exclude "*" --include "*spec.json*" ${SPACK_BUILDCACHE_DESTINATION}/build_cache /tmp
        - /sign.sh
        - aws s3 sync --exclude "*" --include "*spec.json.sig*" /tmp ${SPACK_BUILDCACHE_DESTINATION}/build_cache
        - aws s3 cp /tmp/public_keys ${SPACK_BUILDCACHE_DESTINATION}/build_cache/_pgp --recursive --exclude "*" --include "*.pub"
      id_tokens:
        GITLAB_OIDC_TOKEN:
          aud: "${OIDC_TOKEN_AUDIENCE}"

  - copy-job:
      tags: ["service", "x86_64"]
      image: "ghcr.io/spack/python-aws-bash:0.0.1"
      before_script:
      - - if [[ $CI_COMMIT_TAG == "v"* ]]; then export SPACK_REPLACE_VERSION=$(echo "$CI_COMMIT_TAG" | sed 's/\(v[[:digit:]]\+\.[[:digit:]]\+\).*/releases\/\1/'); fi
        - if [[ $CI_COMMIT_TAG == "develop-"* ]]; then export SPACK_REPLACE_VERSION=develop; fi
        - export SPACK_COPY_ONLY_SOURCE=${SPACK_BUILDCACHE_SOURCE//SPACK_REPLACE_VERSION/${SPACK_REPLACE_VERSION}}
      script:
      - - spack env activate --without-view ${SPACK_CONCRETE_ENV_DIR}
        - echo Copying environment specs from ${SPACK_COPY_ONLY_SOURCE} to ${SPACK_COPY_ONLY_DESTINATION}
        - spack buildcache sync "${SPACK_COPY_ONLY_SOURCE}" "${SPACK_COPY_ONLY_DESTINATION}"
        - curl -fLsS https://spack.github.io/keys/spack-public-binary-key.pub -o /tmp/spack-public-binary-key.pub
        - aws s3 cp /tmp/spack-public-binary-key.pub "${SPACK_COPY_ONLY_DESTINATION}/build_cache/_pgp/spack-public-binary-key.pub"
        - spack buildcache update-index --keys "${SPACK_COPY_ONLY_DESTINATION}"
      when: "always"
      retry:
        max: 2
        when:
        - "runner_system_failure"
        - "stuck_or_timeout_failure"
        - "script_failure"
      interruptible: true
      variables:
        CI_JOB_SIZE: "medium"
        KUBERNETES_CPU_REQUEST: "4000m"
        KUBERNETES_MEMORY_REQUEST: "16G"
      id_tokens:
        GITLAB_OIDC_TOKEN:
          aud: "${OIDC_TOKEN_AUDIENCE}"

  - reindex-job:
      tags: ["service", "x86_64"]
      image: "ghcr.io/spack/ubuntu20.04-runner-x86_64:2023-01-01"
      variables:
        CI_JOB_SIZE: "medium"
        KUBERNETES_CPU_REQUEST: "4000m"
        KUBERNETES_MEMORY_REQUEST: "16G"
      id_tokens:
        GITLAB_OIDC_TOKEN:
          aud: "${OIDC_TOKEN_AUDIENCE}"

  # TODO: Remove this block in Spack 0.23
  - cleanup-job:
      tags: ["service"]
      variables:
        CI_JOB_SIZE: "small"
        KUBERNETES_CPU_REQUEST: "500m"
        KUBERNETES_MEMORY_REQUEST: "500M"
      id_tokens:
        GITLAB_OIDC_TOKEN:
          aud: "${OIDC_TOKEN_AUDIENCE}"

  - noop-job:
      tags: ["service"]
      variables:
        CI_JOB_SIZE: "small"
        KUBERNETES_CPU_REQUEST: "500m"
        KUBERNETES_MEMORY_REQUEST: "500M"

  - any-job:
      tags: ["spack"]
      image: "ghcr.io/spack/e4s-ubuntu-18.04:v2021-10-18"
      variables:
        # Disable local configs to avoid issues on shell runners
        SPACK_DISABLE_LOCAL_CONFIG: "1"
      before_script:
      - - export SPACK_USER_CACHE_PATH="${CI_PROJECT_DIR}/_user_cache/"
      - - uname -a || true
        - grep -E "vendor|model name" /proc/cpuinfo 2>/dev/null | sort -u || head -n10 /proc/cpuinfo 2>/dev/null || true
        - nproc || true
      - - . "./share/spack/setup-env.sh"
        - spack --version
        - spack arch