gitlab-ci.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. variables:
  2. DRM_CI_PROJECT_PATH: &drm-ci-project-path mesa/mesa
  3. DRM_CI_COMMIT_SHA: &drm-ci-commit-sha d9849ac46623797a9f56fb9d46dc52460ac477de
  4. UPSTREAM_REPO: https://gitlab.freedesktop.org/drm/kernel.git
  5. TARGET_BRANCH: drm-next
  6. IGT_VERSION: f13702b8e4e847c56da3ef6f0969065d686049c5
  7. DEQP_RUNNER_GIT_URL: https://gitlab.freedesktop.org/mesa/deqp-runner.git
  8. DEQP_RUNNER_GIT_TAG: v0.15.0
  9. FDO_UPSTREAM_REPO: helen.fornazier/linux # The repo where the git-archive daily runs
  10. MESA_TEMPLATES_COMMIT: &ci-templates-commit d5aa3941aa03c2f716595116354fb81eb8012acb
  11. DRM_CI_PROJECT_URL: https://gitlab.freedesktop.org/${DRM_CI_PROJECT_PATH}
  12. CI_PRE_CLONE_SCRIPT: |-
  13. set -o xtrace
  14. curl -L --retry 4 -f --retry-all-errors --retry-delay 60 -s ${DRM_CI_PROJECT_URL}/-/raw/${DRM_CI_COMMIT_SHA}/.gitlab-ci/download-git-cache.sh -o download-git-cache.sh
  15. bash download-git-cache.sh
  16. rm download-git-cache.sh
  17. set +o xtrace
  18. S3_JWT_FILE: /s3_jwt
  19. S3_HOST: s3.freedesktop.org
  20. # This bucket is used to fetch the kernel image
  21. S3_KERNEL_BUCKET: mesa-rootfs
  22. # Bucket for git cache
  23. S3_GITCACHE_BUCKET: git-cache
  24. # Bucket for the pipeline artifacts pushed to S3
  25. S3_ARTIFACTS_BUCKET: artifacts
  26. # per-pipeline artifact storage on MinIO
  27. PIPELINE_ARTIFACTS_BASE: ${S3_HOST}/${S3_ARTIFACTS_BUCKET}/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}
  28. # per-job artifact storage on MinIO
  29. JOB_ARTIFACTS_BASE: ${PIPELINE_ARTIFACTS_BASE}/${CI_JOB_ID}
  30. # default kernel for rootfs before injecting the current kernel tree
  31. KERNEL_REPO: "gfx-ci/linux"
  32. KERNEL_TAG: "v6.6.21-mesa-f8ea"
  33. KERNEL_IMAGE_BASE: https://${S3_HOST}/${S3_KERNEL_BUCKET}/${KERNEL_REPO}/${KERNEL_TAG}
  34. PKG_REPO_REV: "3cc12a2a"
  35. LAVA_TAGS: subset-1-gfx
  36. LAVA_JOB_PRIORITY: 30
  37. ARTIFACTS_BASE_URL: https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}/-/${CI_PROJECT_NAME}/-/jobs/${CI_JOB_ID}/artifacts
  38. # Python scripts for structured logger
  39. PYTHONPATH: "$PYTHONPATH:$CI_PROJECT_DIR/install"
  40. default:
  41. id_tokens:
  42. S3_JWT:
  43. aud: https://s3.freedesktop.org
  44. before_script:
  45. - export SCRIPTS_DIR=$(mktemp -d)
  46. - curl -L -s --retry 4 -f --retry-all-errors --retry-delay 60 -O --output-dir "${SCRIPTS_DIR}" "${DRM_CI_PROJECT_URL}/-/raw/${DRM_CI_COMMIT_SHA}/.gitlab-ci/setup-test-env.sh"
  47. - source ${SCRIPTS_DIR}/setup-test-env.sh
  48. - echo -e "\e[0Ksection_start:$(date +%s):unset_env_vars_section[collapsed=true]\r\e[0KUnsetting vulnerable environment variables"
  49. - echo -n "${S3_JWT}" > "${S3_JWT_FILE}"
  50. - unset CI_JOB_JWT S3_JWT
  51. - echo -e "\e[0Ksection_end:$(date +%s):unset_env_vars_section\r\e[0K"
  52. - echo -e "\e[0Ksection_start:$(date +%s):drm_ci_download_section[collapsed=true]\r\e[0KDownloading mesa from $DRM_CI_PROJECT_URL/-/archive/$DRM_CI_COMMIT_SHA/mesa-$DRM_CI_COMMIT_SHA.tar.gz"
  53. - cd $CI_PROJECT_DIR
  54. - curl --output - $DRM_CI_PROJECT_URL/-/archive/$DRM_CI_COMMIT_SHA/mesa-$DRM_CI_COMMIT_SHA.tar.gz | tar -xz
  55. - mv mesa-$DRM_CI_COMMIT_SHA/.gitlab-ci* .
  56. - mv mesa-$DRM_CI_COMMIT_SHA/bin/ci .
  57. - rm -rf mesa-$DRM_CI_COMMIT_SHA/
  58. - echo -e "\e[0Ksection_end:$(date +%s):drm_ci_download_section\r\e[0K"
  59. after_script:
  60. - >
  61. set +x
  62. test -e "${S3_JWT_FILE}" &&
  63. export S3_JWT="$(<${S3_JWT_FILE})" &&
  64. rm "${S3_JWT_FILE}"
  65. include:
  66. - project: 'freedesktop/ci-templates'
  67. ref: 16bc29078de5e0a067ff84a1a199a3760d3b3811
  68. file:
  69. - '/templates/ci-fairy.yml'
  70. - project: 'freedesktop/ci-templates'
  71. ref: *ci-templates-commit
  72. file:
  73. - '/templates/alpine.yml'
  74. - '/templates/debian.yml'
  75. - '/templates/fedora.yml'
  76. - project: *drm-ci-project-path
  77. ref: *drm-ci-commit-sha
  78. file:
  79. - '/.gitlab-ci/container/gitlab-ci.yml'
  80. - '/.gitlab-ci/farm-rules.yml'
  81. - '/.gitlab-ci/lava/lava-gitlab-ci.yml'
  82. - '/.gitlab-ci/test-source-dep.yml'
  83. - '/.gitlab-ci/test/gitlab-ci.yml'
  84. - '/src/amd/ci/gitlab-ci-inc.yml'
  85. - '/src/freedreno/ci/gitlab-ci-inc.yml'
  86. - '/src/gallium/drivers/crocus/ci/gitlab-ci-inc.yml'
  87. - '/src/gallium/drivers/llvmpipe/ci/gitlab-ci-inc.yml'
  88. - '/src/gallium/drivers/nouveau/ci/gitlab-ci-inc.yml'
  89. - '/src/gallium/drivers/softpipe/ci/gitlab-ci-inc.yml'
  90. - '/src/gallium/drivers/virgl/ci/gitlab-ci-inc.yml'
  91. - '/src/gallium/drivers/zink/ci/gitlab-ci-inc.yml'
  92. - '/src/gallium/frontends/lavapipe/ci/gitlab-ci-inc.yml'
  93. - '/src/gallium/frontends/rusticl/ci/gitlab-ci.yml'
  94. - '/src/intel/ci/gitlab-ci-inc.yml'
  95. - '/src/microsoft/ci/gitlab-ci-inc.yml'
  96. - '/src/nouveau/ci/gitlab-ci-inc.yml'
  97. - '/src/virtio/ci/gitlab-ci-inc.yml'
  98. - drivers/gpu/drm/ci/image-tags.yml
  99. - drivers/gpu/drm/ci/container.yml
  100. - drivers/gpu/drm/ci/static-checks.yml
  101. - drivers/gpu/drm/ci/build.yml
  102. - drivers/gpu/drm/ci/test.yml
  103. - 'https://gitlab.freedesktop.org/gfx-ci/lab-status/-/raw/main/lab-status.yml'
  104. stages:
  105. - sanity
  106. - container
  107. - code-validation
  108. - git-archive
  109. - build
  110. - amdgpu
  111. - i915
  112. - mediatek
  113. - meson
  114. - msm
  115. - panfrost
  116. - powervr
  117. - rockchip
  118. - software-driver
  119. # YAML anchors for rule conditions
  120. # --------------------------------
  121. .rules-anchors:
  122. rules:
  123. # Pipeline for forked project branch
  124. - if: &is-forked-branch '$CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE != "mesa"'
  125. when: manual
  126. # Forked project branch / pre-merge pipeline not for Marge bot
  127. - if: &is-forked-branch-or-pre-merge-not-for-marge '$CI_PROJECT_NAMESPACE != "mesa" || ($GITLAB_USER_LOGIN != "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event")'
  128. when: manual
  129. # Pipeline runs for the main branch of the upstream Mesa project
  130. - if: &is-mesa-main '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_COMMIT_BRANCH'
  131. when: always
  132. # Post-merge pipeline
  133. - if: &is-post-merge '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_BRANCH'
  134. when: on_success
  135. # Post-merge pipeline, not for Marge Bot
  136. - if: &is-post-merge-not-for-marge '$CI_PROJECT_NAMESPACE == "mesa" && $GITLAB_USER_LOGIN != "marge-bot" && $CI_COMMIT_BRANCH'
  137. when: on_success
  138. # Pre-merge pipeline
  139. - if: &is-pre-merge '$CI_PIPELINE_SOURCE == "merge_request_event"'
  140. when: on_success
  141. # Pre-merge pipeline for Marge Bot
  142. - if: &is-pre-merge-for-marge '$GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"'
  143. when: on_success
  144. .never-post-merge-rules:
  145. rules:
  146. - if: *is-post-merge
  147. when: never
  148. # Rule to filter for only scheduled pipelines.
  149. .scheduled_pipeline-rules:
  150. rules:
  151. - if: &is-scheduled-pipeline '$CI_PIPELINE_SOURCE == "schedule"'
  152. when: on_success
  153. # Generic rule to not run the job during scheduled pipelines. Jobs that aren't
  154. # something like a nightly run should include this rule.
  155. .no_scheduled_pipelines-rules:
  156. rules:
  157. - if: *is-scheduled-pipeline
  158. when: never
  159. # When to automatically run the CI for build jobs
  160. .build-rules:
  161. rules:
  162. - !reference [.no_scheduled_pipelines-rules, rules]
  163. - !reference [.never-post-merge-rules, rules]
  164. # Run automatically once all dependency jobs have passed
  165. - when: on_success
  166. # When to automatically run the CI for container jobs
  167. .container+build-rules:
  168. rules:
  169. - !reference [.no_scheduled_pipelines-rules, rules]
  170. - !reference [.never-post-merge-rules, rules]
  171. - when: manual
  172. .ci-deqp-artifacts:
  173. artifacts:
  174. name: "mesa_${CI_JOB_NAME}"
  175. when: always
  176. untracked: false
  177. paths:
  178. # Watch out! Artifacts are relative to the build dir.
  179. # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
  180. - artifacts
  181. - _build/meson-logs/*.txt
  182. - _build/meson-logs/strace
  183. .container-rules:
  184. rules:
  185. - !reference [.no_scheduled_pipelines-rules, rules]
  186. - !reference [.never-post-merge-rules, rules]
  187. # Run pipeline by default in the main project if any CI pipeline
  188. # configuration files were changed, to ensure docker images are up to date
  189. - if: *is-post-merge
  190. changes:
  191. - drivers/gpu/drm/ci/**/*
  192. when: on_success
  193. # Run pipeline by default if it was triggered by Marge Bot, is for a
  194. # merge request, and any files affecting the pipeline were changed
  195. - if: *is-pre-merge-for-marge
  196. when: on_success
  197. # Run pipeline by default in the main project if it was not triggered by
  198. # Marge Bot, and any files affecting the pipeline were changed
  199. - if: *is-post-merge-not-for-marge
  200. when: on_success
  201. # Allow triggering jobs manually in other cases
  202. - when: manual
  203. # Git archive
  204. make git archive:
  205. extends:
  206. - .fdo.ci-fairy
  207. stage: git-archive
  208. rules:
  209. - !reference [.scheduled_pipeline-rules, rules]
  210. # ensure we are running on packet
  211. tags:
  212. - packet.net
  213. script:
  214. # Remove drm-ci files we just added
  215. - rm -rf .gitlab-ci.*
  216. - rm -rf ci
  217. # Compactify the .git directory
  218. - git gc --aggressive
  219. # compress the current folder
  220. - tar -cvzf ../$CI_PROJECT_NAME.tar.gz .
  221. # Use id_tokens for JWT auth
  222. - ci-fairy s3cp --token-file "${S3_JWT_FILE}" ../$CI_PROJECT_NAME.tar.gz https://$S3_HOST/${S3_GITCACHE_BUCKET}/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_PROJECT_NAME.tar.gz
  223. # Sanity checks of MR settings and commit logs
  224. sanity:
  225. extends:
  226. - .fdo.ci-fairy
  227. stage: sanity
  228. rules:
  229. - if: *is-pre-merge
  230. when: on_success
  231. # Other cases default to never
  232. variables:
  233. GIT_STRATEGY: none
  234. script:
  235. # ci-fairy check-commits --junit-xml=check-commits.xml
  236. - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
  237. artifacts:
  238. when: on_failure
  239. reports:
  240. junit: check-*.xml
  241. # Rules for tests that should not block merging, but should be available to
  242. # optionally run with the "play" button in the UI in pre-merge non-marge
  243. # pipelines. This should appear in "extends:" after any includes of
  244. # test-source-dep.yml rules, so that these rules replace those.
  245. .test-manual-mr:
  246. rules:
  247. - !reference [.no_scheduled_pipelines-rules, rules]
  248. - if: *is-forked-branch-or-pre-merge-not-for-marge
  249. when: manual
  250. variables:
  251. JOB_TIMEOUT: 80
  252. # Jobs that need to pass before spending hardware resources on further testing
  253. .required-for-hardware-jobs:
  254. needs: []