.gitlab-ci.yml 9.9 KB

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