1# Docker image tag helper templates 2 3.incorporate-templates-commit: 4 variables: 5 FDO_DISTRIBUTION_TAG: "${MESA_IMAGE_TAG}--${MESA_TEMPLATES_COMMIT}" 6 7.incorporate-base-tag+templates-commit: 8 variables: 9 FDO_BASE_IMAGE: "${CI_REGISTRY_IMAGE}/${MESA_BASE_IMAGE}:${MESA_BASE_TAG}--${MESA_TEMPLATES_COMMIT}" 10 FDO_DISTRIBUTION_TAG: "${MESA_IMAGE_TAG}--${MESA_BASE_TAG}--${MESA_TEMPLATES_COMMIT}" 11 12.set-image: 13 extends: 14 - .incorporate-templates-commit 15 variables: 16 MESA_IMAGE: "$CI_REGISTRY_IMAGE/${MESA_IMAGE_PATH}:${FDO_DISTRIBUTION_TAG}" 17 image: "$MESA_IMAGE" 18 19.set-image-base-tag: 20 extends: 21 - .set-image 22 - .incorporate-base-tag+templates-commit 23 variables: 24 MESA_IMAGE: "$CI_REGISTRY_IMAGE/${MESA_IMAGE_PATH}:${FDO_DISTRIBUTION_TAG}" 25 26.use-wine: 27 variables: 28 WINEPATH: "/usr/x86_64-w64-mingw32/bin;/usr/x86_64-w64-mingw32/lib;/usr/lib/gcc/x86_64-w64-mingw32/10-posix;c:/windows;c:/windows/system32" 29 30# Build the CI docker images. 31# 32# MESA_IMAGE_TAG is the tag of the docker image used by later stage jobs. If the 33# image doesn't exist yet, the container stage job generates it. 34# 35# In order to generate a new image, one should generally change the tag. 36# While removing the image from the registry would also work, that's not 37# recommended except for ephemeral images during development: Replacing 38# an image after a significant amount of time might pull in newer 39# versions of gcc/clang or other packages, which might break the build 40# with older commits using the same tag. 41# 42# After merging a change resulting in generating a new image to the 43# main repository, it's recommended to remove the image from the source 44# repository's container registry, so that the image from the main 45# repository's registry will be used there as well. 46 47.container: 48 stage: container 49 extends: 50 - .container-rules 51 - .incorporate-templates-commit 52 - .use-wine 53 variables: 54 FDO_DISTRIBUTION_VERSION: bullseye-slim 55 FDO_REPO_SUFFIX: $CI_JOB_NAME 56 FDO_DISTRIBUTION_EXEC: 'env "WINEPATH=${WINEPATH}" FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/container/${CI_JOB_NAME}.sh' 57 # no need to pull the whole repo to build the container image 58 GIT_STRATEGY: none 59 60.use-base-image: 61 extends: 62 - .container 63 - .incorporate-base-tag+templates-commit 64 # Don't want the .container rules 65 - .build-rules 66 67# Debian 11 based x86 build image base 68debian/x86_build-base: 69 extends: 70 - .fdo.container-build@debian 71 - .container 72 variables: 73 MESA_IMAGE_TAG: &debian-x86_build-base ${DEBIAN_BASE_TAG} 74 75.use-debian/x86_build-base: 76 extends: 77 - .fdo.container-build@debian 78 - .use-base-image 79 variables: 80 MESA_BASE_IMAGE: ${DEBIAN_X86_BUILD_BASE_IMAGE} 81 MESA_BASE_TAG: *debian-x86_build-base 82 MESA_ARTIFACTS_BASE_TAG: *debian-x86_build-base 83 needs: 84 - debian/x86_build-base 85 86# Debian 11 based x86 main build image 87debian/x86_build: 88 extends: 89 - .use-debian/x86_build-base 90 variables: 91 MESA_IMAGE_TAG: &debian-x86_build ${DEBIAN_BUILD_TAG} 92 93.use-debian/x86_build: 94 extends: 95 - .set-image-base-tag 96 variables: 97 MESA_BASE_TAG: *debian-x86_build-base 98 MESA_IMAGE_PATH: ${DEBIAN_X86_BUILD_IMAGE_PATH} 99 MESA_IMAGE_TAG: *debian-x86_build 100 needs: 101 - debian/x86_build 102 103# Debian 11 based i386 cross-build image 104debian/i386_build: 105 extends: 106 - .use-debian/x86_build-base 107 variables: 108 MESA_IMAGE_TAG: &debian-i386_build ${DEBIAN_BUILD_TAG} 109 110.use-debian/i386_build: 111 extends: 112 - .set-image-base-tag 113 variables: 114 MESA_BASE_TAG: *debian-x86_build-base 115 MESA_IMAGE_PATH: "debian/i386_build" 116 MESA_IMAGE_TAG: *debian-i386_build 117 needs: 118 - debian/i386_build 119 120# Debian 11 based x86-mingw cross main build image 121debian/x86_build-mingw: 122 extends: 123 - .use-debian/x86_build-base 124 variables: 125 MESA_IMAGE_TAG: &debian-x86_build_mingw ${DEBIAN_BUILD_MINGW_TAG} 126 127.use-debian/x86_build_mingw: 128 extends: 129 - .set-image-base-tag 130 variables: 131 MESA_BASE_TAG: *debian-x86_build-base 132 MESA_IMAGE_PATH: ${DEBIAN_X86_BUILD_MINGW_IMAGE_PATH} 133 MESA_IMAGE_TAG: *debian-x86_build_mingw 134 needs: 135 - debian/x86_build-mingw 136 137# Debian 11 based ppc64el cross-build image 138debian/ppc64el_build: 139 extends: 140 - .use-debian/x86_build-base 141 variables: 142 MESA_IMAGE_TAG: &debian-ppc64el_build ${DEBIAN_BUILD_TAG} 143 144.use-debian/ppc64el_build: 145 extends: 146 - .set-image-base-tag 147 variables: 148 MESA_BASE_TAG: *debian-x86_build-base 149 MESA_IMAGE_PATH: "debian/ppc64el_build" 150 MESA_IMAGE_TAG: *debian-ppc64el_build 151 needs: 152 - debian/ppc64el_build 153 154# Debian 11 based s390x cross-build image 155debian/s390x_build: 156 extends: 157 - .use-debian/x86_build-base 158 variables: 159 MESA_IMAGE_TAG: &debian-s390x_build ${DEBIAN_BUILD_TAG} 160 161.use-debian/s390x_build: 162 extends: 163 - .set-image-base-tag 164 variables: 165 MESA_BASE_TAG: *debian-x86_build-base 166 MESA_IMAGE_PATH: "debian/s390x_build" 167 MESA_IMAGE_TAG: *debian-s390x_build 168 needs: 169 - debian/s390x_build 170 171# Android NDK cross-build image 172debian/android_build: 173 extends: 174 - .use-debian/x86_build-base 175 variables: 176 MESA_IMAGE_TAG: &debian-android_build ${DEBIAN_BUILD_TAG} 177 178.use-debian/android_build: 179 extends: 180 - .set-image-base-tag 181 variables: 182 MESA_BASE_TAG: *debian-x86_build-base 183 MESA_IMAGE_PATH: "debian/android_build" 184 MESA_IMAGE_TAG: *debian-android_build 185 needs: 186 - debian/android_build 187 188# Debian 11 based x86 test image base 189debian/x86_test-base: 190 extends: debian/x86_build-base 191 variables: 192 MESA_IMAGE_TAG: &debian-x86_test-base ${DEBIAN_BASE_TAG} 193 194.use-debian/x86_test-base: 195 extends: 196 - .fdo.container-build@debian 197 - .use-base-image 198 variables: 199 MESA_BASE_IMAGE: ${DEBIAN_X86_TEST_BASE_IMAGE} 200 MESA_BASE_TAG: *debian-x86_test-base 201 needs: 202 - debian/x86_test-base 203 204# Debian 11 based x86 test image for GL 205debian/x86_test-gl: 206 extends: .use-debian/x86_test-base 207 variables: 208 FDO_DISTRIBUTION_EXEC: 'env KERNEL_URL=${KERNEL_URL} FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/container/${CI_JOB_NAME}.sh' 209 KERNEL_URL: &kernel-rootfs-url "https://gitlab.freedesktop.org/gfx-ci/linux/-/archive/v5.17-for-mesa-ci-b78f7870d97b/linux-v5.17-for-mesa-ci-b78f7870d97b.tar.bz2" 210 MESA_IMAGE_TAG: &debian-x86_test-gl ${DEBIAN_X86_TEST_GL_TAG} 211 212.use-debian/x86_test-gl: 213 extends: 214 - .set-image-base-tag 215 variables: 216 MESA_BASE_TAG: *debian-x86_test-base 217 MESA_IMAGE_PATH: ${DEBIAN_X86_TEST_IMAGE_PATH} 218 MESA_IMAGE_TAG: *debian-x86_test-gl 219 needs: 220 - debian/x86_test-gl 221 222# Debian 11 based x86 test image for VK 223debian/x86_test-vk: 224 extends: .use-debian/x86_test-base 225 variables: 226 MESA_IMAGE_TAG: &debian-x86_test-vk ${DEBIAN_X86_TEST_VK_TAG} 227 228.use-debian/x86_test-vk: 229 extends: 230 - .set-image-base-tag 231 variables: 232 MESA_BASE_TAG: *debian-x86_test-base 233 MESA_IMAGE_PATH: "debian/x86_test-vk" 234 MESA_IMAGE_TAG: *debian-x86_test-vk 235 needs: 236 - debian/x86_test-vk 237 238# Debian 11 based ARM build image 239debian/arm_build: 240 extends: 241 - .fdo.container-build@debian 242 - .container 243 tags: 244 - aarch64 245 variables: 246 MESA_IMAGE_TAG: &debian-arm_build ${DEBIAN_BASE_TAG} 247 248.use-debian/arm_build: 249 extends: 250 - .set-image 251 variables: 252 MESA_IMAGE_PATH: "debian/arm_build" 253 MESA_IMAGE_TAG: *debian-arm_build 254 MESA_ARTIFACTS_TAG: *debian-arm_build 255 needs: 256 - debian/arm_build 257 258 259# Fedora 34 based x86 build image 260fedora/x86_build: 261 extends: 262 - .fdo.container-build@fedora 263 - .container 264 variables: 265 FDO_DISTRIBUTION_VERSION: 34 266 MESA_IMAGE_TAG: &fedora-x86_build ${FEDORA_X86_BUILD_TAG} 267 268.use-fedora/x86_build: 269 extends: 270 - .set-image 271 variables: 272 MESA_IMAGE_PATH: "fedora/x86_build" 273 MESA_IMAGE_TAG: *fedora-x86_build 274 needs: 275 - fedora/x86_build 276 277 278.kernel+rootfs: 279 extends: 280 - .build-rules 281 stage: container 282 variables: 283 GIT_STRATEGY: fetch 284 KERNEL_URL: *kernel-rootfs-url 285 MESA_ROOTFS_TAG: &kernel-rootfs ${KERNEL_ROOTFS_TAG} 286 DISTRIBUTION_TAG: &distribution-tag-arm "${MESA_ROOTFS_TAG}--${MESA_ARTIFACTS_TAG}--${MESA_TEMPLATES_COMMIT}" 287 script: 288 - .gitlab-ci/container/lava_build.sh 289 290kernel+rootfs_amd64: 291 extends: 292 - .use-debian/x86_build-base 293 - .kernel+rootfs 294 image: "$FDO_BASE_IMAGE" 295 variables: 296 DEBIAN_ARCH: "amd64" 297 DISTRIBUTION_TAG: &distribution-tag-amd64 "${MESA_ROOTFS_TAG}--${MESA_ARTIFACTS_BASE_TAG}--${MESA_TEMPLATES_COMMIT}" 298 299kernel+rootfs_arm64: 300 extends: 301 - .use-debian/arm_build 302 - .kernel+rootfs 303 tags: 304 - aarch64 305 variables: 306 DEBIAN_ARCH: "arm64" 307 308kernel+rootfs_armhf: 309 extends: 310 - kernel+rootfs_arm64 311 variables: 312 DEBIAN_ARCH: "armhf" 313 314# Cannot use anchors defined here from included files, so use extends: instead 315.use-kernel+rootfs-arm: 316 variables: 317 DISTRIBUTION_TAG: *distribution-tag-arm 318 MESA_ROOTFS_TAG: *kernel-rootfs 319 320.use-kernel+rootfs-amd64: 321 variables: 322 DISTRIBUTION_TAG: *distribution-tag-amd64 323 MESA_ROOTFS_TAG: *kernel-rootfs 324 325# x86 image with ARM64 & armhf kernel & rootfs for baremetal testing 326debian/arm_test: 327 extends: 328 - .fdo.container-build@debian 329 - .container 330 # Don't want the .container rules 331 - .build-rules 332 needs: 333 - kernel+rootfs_arm64 334 - kernel+rootfs_armhf 335 variables: 336 FDO_DISTRIBUTION_EXEC: 'env ARTIFACTS_PREFIX=https://${MINIO_HOST}/mesa-lava ARTIFACTS_SUFFIX=${MESA_ROOTFS_TAG}--${MESA_ARM_BUILD_TAG}--${MESA_TEMPLATES_COMMIT} CI_PROJECT_PATH=${CI_PROJECT_PATH} FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} FDO_UPSTREAM_REPO=${FDO_UPSTREAM_REPO} bash .gitlab-ci/container/${CI_JOB_NAME}.sh' 337 FDO_DISTRIBUTION_TAG: "${MESA_IMAGE_TAG}--${MESA_ROOTFS_TAG}--${MESA_ARM_BUILD_TAG}--${MESA_TEMPLATES_COMMIT}" 338 MESA_ARM_BUILD_TAG: *debian-arm_build 339 MESA_IMAGE_TAG: &debian-arm_test ${DEBIAN_BASE_TAG} 340 MESA_ROOTFS_TAG: *kernel-rootfs 341 342.use-debian/arm_test: 343 image: "$CI_REGISTRY_IMAGE/${MESA_IMAGE_PATH}:${MESA_IMAGE_TAG}--${MESA_ROOTFS_TAG}--${MESA_ARM_BUILD_TAG}--${MESA_TEMPLATES_COMMIT}" 344 variables: 345 MESA_ARM_BUILD_TAG: *debian-arm_build 346 MESA_IMAGE_PATH: "debian/arm_test" 347 MESA_IMAGE_TAG: *debian-arm_test 348 MESA_ROOTFS_TAG: *kernel-rootfs 349 needs: 350 - debian/arm_test 351 352# Native Windows docker builds 353# 354# Unlike the above Linux-based builds - including MinGW builds which 355# cross-compile for Windows - which use the freedesktop ci-templates, we 356# cannot use the same scheme here. As Windows lacks support for 357# Docker-in-Docker, and Podman does not run natively on Windows, we have 358# to open-code much of the same ourselves. 359# 360# This is achieved by first running in a native Windows shell instance 361# (host PowerShell) in the container stage to build and push the image, 362# then in the build stage by executing inside Docker. 363 364.windows-docker-vs2019: 365 variables: 366 MESA_IMAGE: "$CI_REGISTRY_IMAGE/${MESA_IMAGE_PATH}:${MESA_IMAGE_TAG}" 367 MESA_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/$MESA_IMAGE_PATH:${MESA_IMAGE_TAG}" 368 369.windows_container_build: 370 inherit: 371 default: [retry] 372 extends: 373 - .container 374 - .windows-docker-vs2019 375 rules: 376 - if: '$MICROSOFT_FARM == "offline"' 377 when: never 378 - !reference [.container-rules, rules] 379 variables: 380 GIT_STRATEGY: fetch # we do actually need the full repository though 381 MESA_BASE_IMAGE: None 382 tags: 383 - windows 384 - shell 385 - "2022" 386 - mesa 387 script: 388 - .\.gitlab-ci\windows\mesa_container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $MESA_IMAGE $MESA_UPSTREAM_IMAGE ${DOCKERFILE} ${MESA_BASE_IMAGE} 389 390windows_vs2019: 391 inherit: 392 default: [retry] 393 extends: 394 - .windows_container_build 395 variables: 396 MESA_IMAGE_PATH: &windows_vs_image_path ${WINDOWS_X64_VS_PATH} 397 MESA_IMAGE_TAG: &windows_vs_image_tag ${WINDOWS_X64_VS_TAG} 398 DOCKERFILE: Dockerfile_vs 399 MESA_BASE_IMAGE: "mcr.microsoft.com/windows/server:ltsc2022" 400 401windows_build_vs2019: 402 inherit: 403 default: [retry] 404 extends: 405 - .windows_container_build 406 rules: 407 - if: '$MICROSOFT_FARM == "offline"' 408 when: never 409 - !reference [.build-rules, rules] 410 variables: 411 MESA_IMAGE_PATH: &windows_build_image_path ${WINDOWS_X64_BUILD_PATH} 412 MESA_IMAGE_TAG: &windows_build_image_tag ${WINDOWS_X64_BUILD_TAG} 413 DOCKERFILE: Dockerfile_build 414 MESA_BASE_IMAGE_PATH: *windows_vs_image_path 415 MESA_BASE_IMAGE_TAG: *windows_vs_image_tag 416 MESA_BASE_IMAGE: "$CI_REGISTRY_IMAGE/${MESA_BASE_IMAGE_PATH}:${MESA_BASE_IMAGE_TAG}" 417 timeout: 2h 30m # LLVM takes ages 418 needs: 419 - windows_vs2019 420 421windows_test_vs2019: 422 inherit: 423 default: [retry] 424 extends: 425 - .windows_container_build 426 rules: 427 - if: '$MICROSOFT_FARM == "offline"' 428 when: never 429 - !reference [.build-rules, rules] 430 variables: 431 MESA_IMAGE_PATH: &windows_test_image_path ${WINDOWS_X64_TEST_PATH} 432 MESA_IMAGE_TAG: &windows_test_image_tag ${WINDOWS_X64_BUILD_TAG}--${WINDOWS_X64_TEST_TAG} 433 DOCKERFILE: Dockerfile_test 434 MESA_BASE_IMAGE_PATH: *windows_vs_image_path 435 MESA_BASE_IMAGE_TAG: *windows_vs_image_tag 436 MESA_BASE_IMAGE: "$CI_REGISTRY_IMAGE/${MESA_BASE_IMAGE_PATH}:${MESA_BASE_IMAGE_TAG}" 437 needs: 438 - windows_vs2019 439 440.use-windows_build_vs2019: 441 inherit: 442 default: [retry] 443 extends: .windows-docker-vs2019 444 image: "$MESA_IMAGE" 445 variables: 446 MESA_IMAGE_PATH: *windows_build_image_path 447 MESA_IMAGE_TAG: *windows_build_image_tag 448 needs: 449 - windows_build_vs2019 450 451.use-windows_test_vs2019: 452 inherit: 453 default: [retry] 454 extends: .windows-docker-vs2019 455 image: "$MESA_IMAGE" 456 variables: 457 MESA_IMAGE_PATH: *windows_test_image_path 458 MESA_IMAGE_TAG: *windows_test_image_tag 459