summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorLaurent Bonnans <laurent.bonnans@here.com>2019-07-05 17:45:39 +0200
committerLaurent Bonnans <laurent.bonnans@here.com>2019-07-16 16:47:13 +0200
commit5463396b1d47a122f5aef9a619244fd1777c0b56 (patch)
tree8f5430210f314fc3ef7aead29beecf99047b8894 /.gitlab-ci.yml
parent9eebc8d15a297d68fc35dd4d77fcb945d2f395b2 (diff)
downloadmeta-updater-5463396b1d47a122f5aef9a619244fd1777c0b56.tar.gz
Reusable meta-updater pipeline suiteci/oe-selftest
Squashed: * Oe-selftest GitLab pipeline stage * Use credentials for CI's oe-selftest * Setup kvm trick for docker on CI The gid of the kvm group needs to match the one from the host * Run ci scripts from Docker images * Template out jobs and split .gitlab-ci.yml To be easily reused in other branches and projects Rely on this gitlab feature: https://docs.gitlab.com/ee/ci/yaml/#extends * More flexible checkout script for CI - can work without $CURRENT_PROJECT (checks out everything) - can take a list of pinned versions * Add optional CI jobs ptest and other oe-selftests * Publish bitbaked images as artifacts Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml115
1 files changed, 75 insertions, 40 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 94a614c..3682753 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,61 +3,96 @@ stages:
3 - checkout 3 - checkout
4 - test 4 - test
5 5
6# notes:
7# - could be useful https://docs.gitlab.com/ee/ci/yaml/#include
8
9variables: 6variables:
10 # Needs $PR_BASE_BRANCH to be defined as a pipeline variable to work correctly 7 BITBAKE_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${CI_COMMIT_REF_SLUG}-bitbake
11 8 BITBAKE_CHECKOUT_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${CI_COMMIT_REF_SLUG}-checkout
12 CHECKOUT_MASTER_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${PR_BASE_BRANCH}-checkout
13 CHECKOUT_PR_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${CI_COMMIT_REF_SLUG}-checkout
14 9
15 BITBAKE_MASTER_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${PR_BASE_BRANCH}-bitbake 10include:
16 BITBAKE_PR_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${CI_COMMIT_REF_SLUG}-bitbake 11 - local: "scripts/ci/gitlab/docker.yml"
12 - local: "scripts/ci/gitlab/checkout.yml"
13 - local: "scripts/ci/gitlab/tests.yml"
17 14
15Docker setup:
16 extends: .bb_docker_local
18 17
19Docker Setup:
20 image: docker:stable
21 stage: docker 18 stage: docker
22 services: 19 variables:
23 - docker:dind 20 BITBKAE_IMAGE_MASTER: ${CI_REGISTRY_IMAGE}:ci-master-bitbake
21 BITBAKE_CHECKOUT_IMAGE_MASTER: ${CI_REGISTRY_IMAGE}:ci-master-checkout
24 except: 22 except:
25 - pushes 23 - pushes
26 before_script:
27 - docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
28 script:
29 - docker pull "$BITBAKE_PR_IMAGE" || docker pull "$BITBAKE_MASTER_IMAGE" || true
30 - docker build --pull --cache-from "$BITBAKE_MASTER_IMAGE" --cache-from "$BITBAKE_PR_IMAGE" -f ./scripts/ci/Dockerfile.bitbake -t "$BITBAKE_PR_IMAGE" ./scripts/ci
31 - docker push "$BITBAKE_PR_IMAGE"
32
33 - docker pull "$CHECKOUT_PR_IMAGE" || docker pull "$CHECKOUT_MASTER_IMAGE" || true
34 - docker build --pull --cache-from "$CHECKOUT_MASTER_IMAGE" --cache-from "$CHECKOUT_PR_IMAGE" -f ./scripts/ci/Dockerfile.checkout -t "$CHECKOUT_PR_IMAGE" ./scripts/ci
35 - docker push "$CHECKOUT_PR_IMAGE"
36 24
37Checkout: 25Checkout:
38 image: "$CHECKOUT_PR_IMAGE" 26 extends: .bb_checkout
27
39 stage: checkout 28 stage: checkout
29 variables:
30 MANIFEST: master
31 CURRENT_PROJECT: meta-updater
40 except: 32 except:
41 - pushes 33 - pushes
42 cache: 34
43 paths: 35Build core-image-minimal:
44 - updater-repo 36 extends: .bitbake
37
38 stage: test
39 variables:
40 TEST_BUILD_DIR: 'build-core-image-minimal'
41 BITBAKE_TARGETS: 'core-image-minimal'
45 artifacts: 42 artifacts:
46 expire_in: "1 day" 43 name: "core-image-minimal_$CI_COMMIT_REF_SLUG"
47 paths: 44 paths:
48 - updater-repo 45 - $TEST_BUILD_DIR/tmp/deploy/images/*/core-image-minimal*
49 script: 46 except:
50 - MANIFEST=$PR_BASE_BRANCH ./scripts/ci/checkout-oe.sh 47 - pushes
48
49Oe-selftest qemux86_64:
50 extends: .oe-selftest
51
52 stage: test
53 variables:
54 TEST_BUILD_DIR: 'build-oe-qemux86_64'
55 OE_SELFTESTS: 'updater_native updater_qemux86_64'
56 except:
57 - pushes
58
59# Not run by default, triggered on nightlies
60
61Oe-selftest minnowboard:
62 extends: .oe-selftest
63
64 stage: test
65 variables:
66 TEST_BUILD_DIR: 'build-oe-minnowboard'
67 OE_SELFTESTS: 'updater_minnowboard'
68 except:
69 - pushes
70 only:
71 variables:
72 - $OE_MINNOWBOARD
73
74Oe-selftest rpi:
75 extends: .oe-selftest
76
77 stage: test
78 variables:
79 TEST_BUILD_DIR: 'build-oe-rpi'
80 OE_SELFTESTS: 'updater_rpi'
81 except:
82 - pushes
83 only:
84 variables:
85 - $OE_RPI
86
87Ptest qemux86_64:
88 extends: .oe-selftest
51 89
52Build core-image-minimal:
53 image: "$BITBAKE_PR_IMAGE"
54 stage: test 90 stage: test
91 variables:
92 TEST_BUILD_DIR: 'build-oe-qemux86_64-ptest'
93 OE_SELFTESTS: 'updater_qemux86_64_ptest'
55 except: 94 except:
56 - pushes 95 - pushes
57 dependencies: 96 only:
58 - Checkout 97 variables:
59 tags: 98 - $OE_PTEST
60 - bitbake
61 script:
62 - ./scripts/ci/configure.sh
63 - ./scripts/ci/build.sh core-image-minimal