.gitlab-ci.yml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. image: ${MIRROR_GHCR}/siemens/kas/kas:4.4
  2. variables:
  3. # These are needed as the k8s executor doesn't respect the container
  4. # entrypoint by default
  5. FF_KUBERNETES_HONOR_ENTRYPOINT: 1
  6. FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: 0
  7. # The default value for KUBERNETES_CPU_REQUEST
  8. CPU_REQUEST: ""
  9. # The default machine tag for the build jobs
  10. DEFAULT_TAG: ""
  11. # The machine tag for the ACS test jobs
  12. ACS_TAG: ""
  13. # The directory to use as the persistent cache (the root for DL_DIR, SSTATE_DIR, etc)
  14. CACHE_DIR: $CI_BUILDS_DIR/persist
  15. # The container mirror to use
  16. MIRROR_GHCR: ghcr.io
  17. # Whether to run the SystemReady ACS tests
  18. ACS_TEST: 0
  19. # The list of extra Kas fragments to be used when building
  20. EXTRA_KAS_FILES: ""
  21. # The NVD API key to use when fetching CVEs
  22. NVDCVE_API_KEY: ""
  23. stages:
  24. - prep
  25. - build
  26. # Common job fragment to get a worker ready
  27. .setup:
  28. tags:
  29. - $DEFAULT_TAG
  30. stage: build
  31. interruptible: true
  32. variables:
  33. KAS_WORK_DIR: $CI_PROJECT_DIR/work
  34. KAS_BUILD_DIR: $KAS_WORK_DIR/build
  35. KAS_REPO_REF_DIR: $CACHE_DIR/repos
  36. SSTATE_DIR: $CACHE_DIR/sstate
  37. DL_DIR: $CACHE_DIR/downloads
  38. BB_LOGCONFIG: $CI_PROJECT_DIR/ci/logging.yml
  39. TOOLCHAIN_DIR: $CACHE_DIR/toolchains
  40. IMAGE_DIR: $KAS_BUILD_DIR/tmp/deploy/images
  41. TOOLCHAIN_LINK_DIR: $KAS_BUILD_DIR/toolchains
  42. before_script:
  43. - echo KAS_WORK_DIR = $KAS_WORK_DIR
  44. - echo SSTATE_DIR = $SSTATE_DIR
  45. - echo DL_DIR = $DL_DIR
  46. - rm -rf $KAS_WORK_DIR
  47. - mkdir --verbose --parents $KAS_WORK_DIR $KAS_REPO_REF_DIR $SSTATE_DIR $DL_DIR $TOOLCHAIN_DIR $TOOLCHAIN_LINK_DIR
  48. # Must do this here, as it's the only way to make sure the toolchain is installed on the same builder
  49. - ./ci/get-binary-toolchains $DL_DIR $TOOLCHAIN_DIR $TOOLCHAIN_LINK_DIR
  50. # Generalised fragment to do a Kas build
  51. .build:
  52. extends: .setup
  53. variables:
  54. KUBERNETES_CPU_REQUEST: $CPU_REQUEST
  55. rules:
  56. # Don't run MR pipelines
  57. - if: $CI_PIPELINE_SOURCE == "merge_request_event"
  58. when: never
  59. # Don't run pipelines for tags
  60. - if: $CI_COMMIT_TAG
  61. when: never
  62. # Don't run if BUILD_ENABLE_REGEX is set, but the job doesn't match the regex
  63. - if: '$BUILD_ENABLE_REGEX != null && $CI_JOB_NAME !~ $BUILD_ENABLE_REGEX'
  64. when: never
  65. # Allow the dev kernels to fail and not fail the overall build
  66. - if: '$KERNEL == "linux-yocto-dev"'
  67. allow_failure: true
  68. # Catch all for everything else
  69. - if: '$KERNEL != "linux-yocto-dev"'
  70. script:
  71. - KASFILES=$(./ci/jobs-to-kas "$CI_JOB_NAME" $EXTRA_KAS_FILES):lockfile.yml
  72. - echo KASFILES=$KASFILES
  73. - kas dump --update --force-checkout --resolve-refs --resolve-env $KASFILES
  74. - kas build $KASFILES
  75. - ./ci/check-warnings $KAS_BUILD_DIR/warnings.log
  76. artifacts:
  77. name: "logs"
  78. when: always
  79. paths:
  80. - $KAS_BUILD_DIR/tmp*/work*/**/temp/log.do_*.*
  81. - $KAS_BUILD_DIR/tmp*/work*/**/testimage/*
  82. #
  83. # Prep stage, update repositories once.
  84. # Set the CI variable CI_CLEAN_REPOS=1 to refetch the respositories from scratch
  85. #
  86. update-repos:
  87. extends: .setup
  88. stage: prep
  89. allow_failure:
  90. exit_codes: 128
  91. script:
  92. - |
  93. flock --verbose --timeout 60 $KAS_REPO_REF_DIR ./ci/update-repos
  94. # Only generate if doesn't already exist, to allow feature branches to drop one in.
  95. if test -f lockfile.yml; then
  96. echo Using existing lockfile.yml
  97. else
  98. # Be sure that this is the complete list of layers being fetched
  99. kas dump --lock --update ci/qemuarm64.yml:ci/meta-openembedded.yml:ci/clang.yml:ci/meta-virtualization.yml | tee lockfile.yml
  100. fi
  101. artifacts:
  102. name: "lockfile"
  103. paths:
  104. - lockfile.yml
  105. #
  106. # Build stage, the actual build jobs
  107. #
  108. # Available options for building are
  109. # DISTRO: [poky, poky-altcfg, poky-tiny]
  110. # KERNEL: [linux-yocto, linux-yocto-dev, linux-yocto-rt]
  111. # TOOLCHAINS: [gcc, clang, external-gccarm]
  112. # TCLIBC: [glibc, musl]
  113. # FIRMWARE: [u-boot, edk2]
  114. # TS: [none, trusted-services]
  115. # VIRT: [none, xen]
  116. # TESTING: testimage
  117. # SECUREDEBUG: [none, secure-debug]
  118. arm-systemready-ir-acs:
  119. extends: .build
  120. timeout: 12h
  121. parallel:
  122. matrix:
  123. # arm-systemready-ir-acs must be specified after fvp-base for ordering
  124. # purposes for the jobs-to-kas output. It is not enough to just have it
  125. # in the job name because fvp-base.yml overwrites the target.
  126. - PLATFORM: [fvp-base, corstone1000-fvp]
  127. ARM_SYSTEMREADY_IR_ACS: arm-systemready-ir-acs
  128. tags:
  129. - ${ACS_TAG}
  130. # Validate layers are Yocto Project Compatible
  131. check-layers:
  132. extends: .setup
  133. script:
  134. - kas shell --update --force-checkout ci/base.yml:ci/meta-openembedded.yml:lockfile.yml --command \
  135. "yocto-check-layer-wrapper $CI_PROJECT_DIR/$LAYER --dependency $CI_PROJECT_DIR/meta-* $KAS_WORK_DIR/meta-openembedded/meta-oe --no-auto-dependency"
  136. parallel:
  137. matrix:
  138. - LAYER: [meta-arm, meta-arm-bsp, meta-arm-toolchain]
  139. corstone1000-fvp:
  140. extends: .build
  141. parallel:
  142. matrix:
  143. - FIRMWARE: corstone1000-firmware-only
  144. TESTING: [testimage, tftf]
  145. - FIRMWARE: none
  146. TESTING: testimage
  147. - SYSTEMREADY_FIRMWARE: arm-systemready-firmware
  148. corstone1000-mps3:
  149. extends: .build
  150. parallel:
  151. matrix:
  152. - FIRMWARE: corstone1000-firmware-only
  153. TESTING: [none, tftf]
  154. - FIRMWARE: none
  155. SECUREDEBUG: [none, secure-debug]
  156. documentation:
  157. extends: .setup
  158. script:
  159. - |
  160. # This can be removed when the kas container has python3-venv installed
  161. sudo apt-get update && sudo apt-get install --yes python3-venv
  162. python3 -m venv venv
  163. . ./venv/bin/activate
  164. pip3 install -r meta-arm-bsp/documentation/requirements.txt
  165. for CONF in meta-*/documentation/*/conf.py ; do
  166. echo Building $CONF...
  167. SOURCE_DIR=$(dirname $CONF)
  168. MACHINE=$(basename $SOURCE_DIR)
  169. sphinx-build -vW $SOURCE_DIR build-docs/$MACHINE
  170. done
  171. test -d build-docs/
  172. artifacts:
  173. paths:
  174. - build-docs/
  175. fvp-base:
  176. extends: .build
  177. parallel:
  178. matrix:
  179. - TS: [none, fvp-base-ts]
  180. TESTING: testimage
  181. - FIRMWARE: [u-boot, edk2]
  182. TESTING: testimage
  183. - SYSTEMREADY_FIRMWARE: arm-systemready-firmware
  184. fvps:
  185. extends: .build
  186. genericarm64:
  187. extends: .build
  188. parallel:
  189. matrix:
  190. - TOOLCHAINS: [gcc, clang]
  191. TESTING: testimage
  192. - KERNEL: linux-yocto-dev
  193. TESTING: testimage
  194. juno:
  195. extends: .build
  196. parallel:
  197. matrix:
  198. - TOOLCHAINS: [gcc, clang]
  199. FIRMWARE: [u-boot, edk2]
  200. # What percentage of machines in the layer do we build
  201. machine-coverage:
  202. extends: .setup
  203. script:
  204. - ./ci/check-machine-coverage
  205. coverage: '/Coverage: \d+/'
  206. metrics:
  207. extends: .setup
  208. artifacts:
  209. reports:
  210. metrics: metrics.txt
  211. script:
  212. - kas shell --update --force-checkout ci/base.yml --command \
  213. "$CI_PROJECT_DIR/ci/patchreview $CI_PROJECT_DIR/meta-* --verbose --metrics $CI_PROJECT_DIR/metrics.txt"
  214. musca-b1:
  215. extends: .build
  216. musca-s1:
  217. extends: .build
  218. pending-updates:
  219. extends: .setup
  220. artifacts:
  221. paths:
  222. - update-report
  223. script:
  224. - rm -fr update-report
  225. # This configuration has all of the layers we need enabled
  226. - kas shell --update --force-checkout ci/qemuarm64.yml:ci/meta-openembedded.yml:ci/meta-secure-core.yml:lockfile.yml --command \
  227. "$CI_PROJECT_DIR/scripts/machine-summary.py -t report -o $CI_PROJECT_DIR/update-report $($CI_PROJECT_DIR/ci/listmachines.py meta-arm meta-arm-bsp)"
  228. # Do this on x86 whilst the compilers are x86-only
  229. tags:
  230. - x86_64
  231. qemuarm64-secureboot:
  232. extends: .build
  233. parallel:
  234. matrix:
  235. - KERNEL: [linux-yocto, linux-yocto-rt]
  236. TOOLCHAINS: [gcc, clang]
  237. TCLIBC: [glibc, musl]
  238. TS: [none, qemuarm64-secureboot-ts]
  239. TESTING: testimage
  240. - KERNEL: linux-yocto-dev
  241. TESTING: testimage
  242. qemuarm64:
  243. extends: .build
  244. parallel:
  245. matrix:
  246. - DISTRO: poky
  247. KERNEL: [linux-yocto, linux-yocto-rt]
  248. TOOLCHAINS: [gcc, clang]
  249. FIRMWARE: [u-boot, edk2]
  250. TESTING: testimage
  251. - DISTRO: poky-tiny
  252. TESTING: testimage
  253. - VIRT: xen
  254. - KERNEL: linux-yocto-dev
  255. TESTING: testimage
  256. qemuarm-secureboot:
  257. extends: .build
  258. parallel:
  259. matrix:
  260. - KERNEL: [linux-yocto, linux-yocto-rt]
  261. TOOLCHAINS: [gcc, clang]
  262. TCLIBC: [glibc, musl]
  263. TESTING: testimage
  264. - TOOLCHAINS: external-gccarm
  265. TESTING: testimage
  266. - KERNEL: linux-yocto-dev
  267. TESTING: testimage
  268. qemuarm:
  269. extends: .build
  270. parallel:
  271. matrix:
  272. - DISTRO: poky
  273. KERNEL: [linux-yocto, linux-yocto-rt]
  274. TOOLCHAINS: [gcc, clang]
  275. FIRMWARE: [u-boot, edk2]
  276. TESTING: testimage
  277. - DISTRO: poky-tiny
  278. TESTING: testimage
  279. - VIRT: xen
  280. - KERNEL: linux-yocto-dev
  281. TESTING: testimage
  282. qemuarmv5:
  283. extends: .build
  284. parallel:
  285. matrix:
  286. - DISTRO: poky
  287. KERNEL: [linux-yocto, linux-yocto-dev, linux-yocto-rt]
  288. TESTING: testimage
  289. - DISTRO: poky-tiny
  290. TESTING: testimage
  291. sbsa-ref:
  292. extends: .build
  293. parallel:
  294. matrix:
  295. - KERNEL: [linux-yocto, linux-yocto-rt]
  296. TOOLCHAINS: [gcc, clang]
  297. TESTING: testimage
  298. - DISTRO: poky-altcfg
  299. TESTING: testimage
  300. - KERNEL: linux-yocto-dev
  301. TESTING: testimage
  302. selftest:
  303. extends: .setup
  304. script:
  305. - KASFILES=./ci/qemuarm64.yml:./ci/selftest.yml:lockfile.yml
  306. - kas shell --update --force-checkout $KASFILES -c 'oe-selftest --num-processes 2 --select-tag meta-arm --run-all-tests'
  307. sgi575:
  308. extends: .build
  309. toolchains:
  310. extends: .build