diff options
author | Laurent Bonnans <laurent.bonnans@here.com> | 2019-07-04 15:35:44 +0200 |
---|---|---|
committer | Laurent Bonnans <laurent.bonnans@here.com> | 2019-07-16 16:25:55 +0200 |
commit | 9eebc8d15a297d68fc35dd4d77fcb945d2f395b2 (patch) | |
tree | 3539b2bdf61192e63c498b5c0bebce578198005a /.gitlab-ci.yml | |
parent | 5a23aa71c2bd5cfe23207553d04b54c5bdca49b4 (diff) | |
download | meta-updater-9eebc8d15a297d68fc35dd4d77fcb945d2f395b2.tar.gz |
Gitlab pipeline for building core-image-minimal
Including these points (initially as separate commits):
* Try caching updater-repo in gitlab
* Only patch aktualizr recipe in CI if needed
* Run under user 4321 in bitbake docker image
* Add ability to supply METADIR to envsetup.sh
So that we can bypass the "relative path from the script" trick that
doesn't work with symlinks.
* Checkout the PR base branch
* do not run on pushes
* run on runners with "gitlab" tag
* Print all revisions after repo checkout on CI
* Pull CI image from the base branch instead of master
* More robust checkout in CI
* Only store updater-repo artifacts for one day
* Use "stretch" instead of "stable" for Debian release in Dockerfile
(in fact, stable just changed to buster)
* Move UPDATER_REPO variable out of .gitlab-ci.yml
To be defined in the project's settings
* Make docker CI stage buildable on shared runners
Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..94a614c --- /dev/null +++ b/.gitlab-ci.yml | |||
@@ -0,0 +1,63 @@ | |||
1 | stages: | ||
2 | - docker | ||
3 | - checkout | ||
4 | - test | ||
5 | |||
6 | # notes: | ||
7 | # - could be useful https://docs.gitlab.com/ee/ci/yaml/#include | ||
8 | |||
9 | variables: | ||
10 | # Needs $PR_BASE_BRANCH to be defined as a pipeline variable to work correctly | ||
11 | |||
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 | |||
15 | BITBAKE_MASTER_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${PR_BASE_BRANCH}-bitbake | ||
16 | BITBAKE_PR_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${CI_COMMIT_REF_SLUG}-bitbake | ||
17 | |||
18 | |||
19 | Docker Setup: | ||
20 | image: docker:stable | ||
21 | stage: docker | ||
22 | services: | ||
23 | - docker:dind | ||
24 | except: | ||
25 | - 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 | |||
37 | Checkout: | ||
38 | image: "$CHECKOUT_PR_IMAGE" | ||
39 | stage: checkout | ||
40 | except: | ||
41 | - pushes | ||
42 | cache: | ||
43 | paths: | ||
44 | - updater-repo | ||
45 | artifacts: | ||
46 | expire_in: "1 day" | ||
47 | paths: | ||
48 | - updater-repo | ||
49 | script: | ||
50 | - MANIFEST=$PR_BASE_BRANCH ./scripts/ci/checkout-oe.sh | ||
51 | |||
52 | Build core-image-minimal: | ||
53 | image: "$BITBAKE_PR_IMAGE" | ||
54 | stage: test | ||
55 | except: | ||
56 | - pushes | ||
57 | dependencies: | ||
58 | - Checkout | ||
59 | tags: | ||
60 | - bitbake | ||
61 | script: | ||
62 | - ./scripts/ci/configure.sh | ||
63 | - ./scripts/ci/build.sh core-image-minimal | ||