1# Types of CI pipelines: 2# | pipeline name | context | description | 3# |----------------------|-----------|-------------------------------------------------------------| 4# | merge pipeline | mesa/mesa | pipeline running for an MR; if it passes the MR gets merged | 5# | pre-merge pipeline | mesa/mesa | same as above, except its status doesn't affect the MR | 6# | post-merge pipeline | mesa/mesa | pipeline immediately after merging | 7# | fork pipeline | fork | pipeline running in a user fork | 8# | scheduled pipeline | mesa/mesa | nightly pipelines, running every morning at 4am UTC | 9# | direct-push pipeline | mesa/mesa | when commits are pushed directly to mesa/mesa, bypassing Marge and its gating pipeline | 10# 11# Note that the release branches maintained by the release manager fall under 12# the "direct push" category. 13# 14# "context" indicates the permissions that the jobs get; notably, any 15# container created in mesa/mesa gets pushed immediately for everyone to use 16# as soon as the image tag change is merged. 17# 18# Merge pipelines contain all jobs that must pass before the MR can be merged. 19# Pre-merge pipelines contain the exact same jobs as merge pipelines. 20# Post-merge pipelines contain *only* the `pages` job that deploys the new 21# version of the website. 22# Fork pipelines contain everything. 23# Scheduled pipelines only contain the container+build jobs, and some extra 24# test jobs (typically "full" variants of pre-merge jobs that only run 1/X 25# test cases), but not a repeat of the merge pipeline jobs. 26# Direct-push pipelines contain the same jobs as merge pipelines. 27 28workflow: 29 rules: 30 # do not duplicate pipelines on merge pipelines 31 - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push" 32 when: never 33 # merge pipeline 34 - if: &is-merge-attempt $GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event" 35 variables: 36 KERNEL_IMAGE_BASE: https://${S3_HOST}/mesa-lava/${KERNEL_REPO}/${KERNEL_TAG} 37 MESA_CI_PERFORMANCE_ENABLED: 1 38 VALVE_INFRA_VANGOGH_JOB_PRIORITY: "" # Empty tags are ignored by gitlab 39 # post-merge pipeline 40 - if: &is-post-merge $GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "push" 41 # nightly pipeline 42 - if: &is-scheduled-pipeline $CI_PIPELINE_SOURCE == "schedule" 43 variables: 44 KERNEL_IMAGE_BASE: https://${S3_HOST}/mesa-lava/${KERNEL_REPO}/${KERNEL_TAG} 45 JOB_PRIORITY: 50 46 VALVE_INFRA_VANGOGH_JOB_PRIORITY: priority:low 47 # pipeline for direct pushes that bypassed the CI 48 - if: &is-direct-push $CI_PROJECT_NAMESPACE == "mesa" && $CI_PIPELINE_SOURCE == "push" && $GITLAB_USER_LOGIN != "marge-bot" 49 variables: 50 KERNEL_IMAGE_BASE: https://${S3_HOST}/mesa-lava/${KERNEL_REPO}/${KERNEL_TAG} 51 JOB_PRIORITY: 40 52 VALVE_INFRA_VANGOGH_JOB_PRIORITY: priority:low 53 # pre-merge or fork pipeline 54 - if: $FORCE_KERNEL_TAG != null 55 variables: 56 KERNEL_IMAGE_BASE: https://${S3_HOST}/mesa-lava/${KERNEL_REPO}/${FORCE_KERNEL_TAG} 57 JOB_PRIORITY: 50 58 VALVE_INFRA_VANGOGH_JOB_PRIORITY: priority:low 59 - if: $FORCE_KERNEL_TAG == null 60 variables: 61 KERNEL_IMAGE_BASE: https://${S3_HOST}/mesa-lava/${KERNEL_REPO}/${KERNEL_TAG} 62 JOB_PRIORITY: 50 63 VALVE_INFRA_VANGOGH_JOB_PRIORITY: priority:low 64 65 66variables: 67 FDO_UPSTREAM_REPO: mesa/mesa 68 MESA_TEMPLATES_COMMIT: &ci-templates-commit d5aa3941aa03c2f716595116354fb81eb8012acb 69 CI_PRE_CLONE_SCRIPT: |- 70 set -o xtrace 71 wget -q -O download-git-cache.sh ${CI_PROJECT_URL}/-/raw/${CI_COMMIT_SHA}/.gitlab-ci/download-git-cache.sh 72 bash download-git-cache.sh 73 rm download-git-cache.sh 74 set +o xtrace 75 CI_JOB_JWT_FILE: /minio_jwt 76 S3_HOST: s3.freedesktop.org 77 # per-pipeline artifact storage on MinIO 78 PIPELINE_ARTIFACTS_BASE: ${S3_HOST}/artifacts/${CI_PROJECT_PATH}/${CI_PIPELINE_ID} 79 # per-job artifact storage on MinIO 80 JOB_ARTIFACTS_BASE: ${PIPELINE_ARTIFACTS_BASE}/${CI_JOB_ID} 81 # reference images stored for traces 82 PIGLIT_REPLAY_REFERENCE_IMAGES_BASE: "${S3_HOST}/mesa-tracie-results/$FDO_UPSTREAM_REPO" 83 # For individual CI farm status see .ci-farms folder 84 # Disable farm with `git mv .ci-farms{,-disabled}/$farm_name` 85 # Re-enable farm with `git mv .ci-farms{-disabled,}/$farm_name` 86 # NEVER MIX FARM MAINTENANCE WITH ANY OTHER CHANGE IN THE SAME MERGE REQUEST! 87 ARTIFACTS_BASE_URL: https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}/-/${CI_PROJECT_NAME}/-/jobs/${CI_JOB_ID}/artifacts 88 # Python scripts for structured logger 89 PYTHONPATH: "$PYTHONPATH:$CI_PROJECT_DIR/install" 90 91default: 92 before_script: 93 - > 94 export SCRIPTS_DIR=$(mktemp -d) && 95 curl -L -s --retry 4 -f --retry-all-errors --retry-delay 60 -O --output-dir "${SCRIPTS_DIR}" "${CI_PROJECT_URL}/-/raw/${CI_COMMIT_SHA}/.gitlab-ci/setup-test-env.sh" && 96 . ${SCRIPTS_DIR}/setup-test-env.sh && 97 echo -n "${CI_JOB_JWT}" > "${CI_JOB_JWT_FILE}" && 98 unset CI_JOB_JWT # Unsetting vulnerable env variables 99 100 after_script: 101 # Work around https://gitlab.com/gitlab-org/gitlab/-/issues/20338 102 - find -name '*.log' -exec mv {} {}.txt \; 103 104 - > 105 set +x 106 107 test -e "${CI_JOB_JWT_FILE}" && 108 export CI_JOB_JWT="$(<${CI_JOB_JWT_FILE})" && 109 rm "${CI_JOB_JWT_FILE}" 110 111 # Retry when job fails. Failed jobs can be found in the Mesa CI Daily Reports: 112 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/?sort=created_date&state=opened&label_name%5B%5D=CI%20daily 113 retry: 114 max: 1 115 # Ignore runner_unsupported, stale_schedule, archived_failure, or 116 # unmet_prerequisites 117 when: 118 - api_failure 119 - runner_system_failure 120 - script_failure 121 - job_execution_timeout 122 - scheduler_failure 123 - data_integrity_failure 124 - unknown_failure 125 126stages: 127 - sanity 128 - container 129 - git-archive 130 - build-x86_64 131 - build-misc 132 - code-validation 133 - amd 134 - intel 135 - nouveau 136 - arm 137 - broadcom 138 - freedreno 139 - etnaviv 140 - software-renderer 141 - layered-backends 142 - deploy 143 144include: 145 - project: 'freedesktop/ci-templates' 146 ref: 16bc29078de5e0a067ff84a1a199a3760d3b3811 147 file: 148 - '/templates/ci-fairy.yml' 149 - project: 'freedesktop/ci-templates' 150 ref: *ci-templates-commit 151 file: 152 - '/templates/alpine.yml' 153 - '/templates/debian.yml' 154 - '/templates/fedora.yml' 155 - local: '.gitlab-ci/image-tags.yml' 156 - local: '.gitlab-ci/lava/lava-gitlab-ci.yml' 157 - local: '.gitlab-ci/container/gitlab-ci.yml' 158 - local: '.gitlab-ci/build/gitlab-ci.yml' 159 - local: '.gitlab-ci/test/gitlab-ci.yml' 160 - local: '.gitlab-ci/farm-rules.yml' 161 - local: '.gitlab-ci/test-source-dep.yml' 162 - local: 'docs/gitlab-ci.yml' 163 - local: 'src/amd/ci/gitlab-ci.yml' 164 - local: 'src/broadcom/ci/gitlab-ci.yml' 165 - local: 'src/etnaviv/ci/gitlab-ci.yml' 166 - local: 'src/freedreno/ci/gitlab-ci.yml' 167 - local: 'src/gallium/drivers/crocus/ci/gitlab-ci.yml' 168 - local: 'src/gallium/drivers/d3d12/ci/gitlab-ci.yml' 169 - local: 'src/gallium/drivers/i915/ci/gitlab-ci.yml' 170 - local: 'src/gallium/drivers/r300/ci/gitlab-ci.yml' 171 - local: 'src/gallium/drivers/lima/ci/gitlab-ci.yml' 172 - local: 'src/gallium/drivers/llvmpipe/ci/gitlab-ci.yml' 173 - local: 'src/gallium/drivers/nouveau/ci/gitlab-ci.yml' 174 - local: 'src/gallium/drivers/softpipe/ci/gitlab-ci.yml' 175 - local: 'src/gallium/drivers/virgl/ci/gitlab-ci.yml' 176 - local: 'src/gallium/drivers/zink/ci/gitlab-ci.yml' 177 - local: 'src/gallium/frontends/lavapipe/ci/gitlab-ci.yml' 178 - local: 'src/intel/ci/gitlab-ci.yml' 179 - local: 'src/microsoft/ci/gitlab-ci.yml' 180 - local: 'src/panfrost/ci/gitlab-ci.yml' 181 - local: 'src/virtio/ci/gitlab-ci.yml' 182 183 184# YAML anchors for rule conditions 185# -------------------------------- 186.rules-anchors: 187 # Pre-merge pipeline 188 - &is-pre-merge '$CI_PIPELINE_SOURCE == "merge_request_event"' 189 190 191.never-post-merge-rules: 192 rules: 193 - if: *is-post-merge 194 when: never 195 196 197.container+build-rules: 198 rules: 199 # Run when re-enabling a disabled farm, but not when disabling it 200 - !reference [.disable-farm-mr-rules, rules] 201 # Never run immediately after merging, as we just ran everything 202 - !reference [.never-post-merge-rules, rules] 203 # Build everything in merge pipelines, if any files affecting the pipeline 204 # were changed 205 - if: *is-merge-attempt 206 changes: &all_paths 207 - VERSION 208 - bin/git_sha1_gen.py 209 - bin/install_megadrivers.py 210 - bin/symbols-check.py 211 # GitLab CI 212 - .gitlab-ci.yml 213 - .gitlab-ci/**/* 214 - .ci-farms/* 215 # Meson 216 - meson* 217 - build-support/**/* 218 - subprojects/**/* 219 # clang format 220 - .clang-format 221 - .clang-format-include 222 - .clang-format-ignore 223 # Source code 224 - include/**/* 225 - src/**/* 226 when: on_success 227 # Same as above, but for pre-merge pipelines 228 - if: *is-pre-merge 229 changes: 230 *all_paths 231 when: manual 232 # Skip everything for pre-merge and merge pipelines which don't change 233 # anything in the build 234 - if: *is-merge-attempt 235 when: never 236 - if: *is-pre-merge 237 when: never 238 # Build everything after someone bypassed the CI 239 - if: *is-direct-push 240 when: on_success 241 # Build everything in scheduled pipelines 242 - if: *is-scheduled-pipeline 243 when: on_success 244 # Allow building everything in fork pipelines, but build nothing unless 245 # manually triggered 246 - when: manual 247 248 249.ci-deqp-artifacts: 250 artifacts: 251 name: "mesa_${CI_JOB_NAME}" 252 when: always 253 untracked: false 254 paths: 255 # Watch out! Artifacts are relative to the build dir. 256 # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521 257 - artifacts 258 - _build/meson-logs/*.txt 259 - _build/meson-logs/strace 260 261# Git archive 262 263make git archive: 264 extends: 265 - .fdo.ci-fairy 266 stage: git-archive 267 rules: 268 - !reference [.scheduled_pipeline-rules, rules] 269 # ensure we are running on packet 270 tags: 271 - packet.net 272 script: 273 # Compactify the .git directory 274 - git gc --aggressive 275 # Download & cache the perfetto subproject as well. 276 - rm -rf subprojects/perfetto ; mkdir -p subprojects/perfetto && curl https://android.googlesource.com/platform/external/perfetto/+archive/$(grep 'revision =' subprojects/perfetto.wrap | cut -d ' ' -f3).tar.gz | tar zxf - -C subprojects/perfetto 277 # compress the current folder 278 - tar -cvzf ../$CI_PROJECT_NAME.tar.gz . 279 280 - ci-fairy s3cp --token-file "${CI_JOB_JWT_FILE}" ../$CI_PROJECT_NAME.tar.gz https://$S3_HOST/git-cache/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_PROJECT_NAME.tar.gz 281 282 283# Sanity checks of MR settings and commit logs 284sanity: 285 extends: 286 - .fdo.ci-fairy 287 stage: sanity 288 rules: 289 - if: *is-pre-merge 290 when: on_success 291 - when: never 292 variables: 293 GIT_STRATEGY: none 294 script: 295 # ci-fairy check-commits --junit-xml=check-commits.xml 296 - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml 297 - | 298 set -eu 299 image_tags=( 300 DEBIAN_BASE_TAG 301 DEBIAN_BUILD_TAG 302 DEBIAN_X86_64_TEST_ANDROID_TAG 303 DEBIAN_X86_64_TEST_GL_TAG 304 DEBIAN_X86_64_TEST_VK_TAG 305 ALPINE_X86_64_BUILD_TAG 306 ALPINE_X86_64_LAVA_SSH_TAG 307 FEDORA_X86_64_BUILD_TAG 308 KERNEL_ROOTFS_TAG 309 KERNEL_TAG 310 PKG_REPO_REV 311 WINDOWS_X64_MSVC_TAG 312 WINDOWS_X64_BUILD_TAG 313 WINDOWS_X64_TEST_TAG 314 ) 315 for var in "${image_tags[@]}" 316 do 317 if [ "$(echo -n "${!var}" | wc -c)" -gt 20 ] 318 then 319 echo "$var is too long; please make sure it is at most 20 chars." 320 exit 1 321 fi 322 done 323 artifacts: 324 when: on_failure 325 reports: 326 junit: check-*.xml 327 tags: 328 - placeholder-job 329 330 331# Jobs that need to pass before spending hardware resources on further testing 332.required-for-hardware-jobs: 333 needs: 334 - job: clang-format 335 optional: true 336 - job: rustfmt 337 optional: true 338