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