summaryrefslogtreecommitdiffstats
path: root/scripts/ci/gitlab
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 /scripts/ci/gitlab
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 'scripts/ci/gitlab')
-rw-r--r--scripts/ci/gitlab/checkout.yml16
-rw-r--r--scripts/ci/gitlab/docker.yml37
-rw-r--r--scripts/ci/gitlab/tests.yml36
3 files changed, 89 insertions, 0 deletions
diff --git a/scripts/ci/gitlab/checkout.yml b/scripts/ci/gitlab/checkout.yml
new file mode 100644
index 0000000..28c9177
--- /dev/null
+++ b/scripts/ci/gitlab/checkout.yml
@@ -0,0 +1,16 @@
1.bb_checkout:
2 # parameters:
3 # - MANIFEST
4 # - REMOTE_SOURCE
5 # - CURRENT_PROJECT (will be symlinked instead of pulled)
6
7 image: $BITBAKE_CHECKOUT_IMAGE
8 cache:
9 paths:
10 - updater-repo
11 artifacts:
12 expire_in: "1 day"
13 paths:
14 - updater-repo
15 script:
16 - /scripts/checkout-oe.sh
diff --git a/scripts/ci/gitlab/docker.yml b/scripts/ci/gitlab/docker.yml
new file mode 100644
index 0000000..827bb47
--- /dev/null
+++ b/scripts/ci/gitlab/docker.yml
@@ -0,0 +1,37 @@
1.bb_docker_local:
2 # intended to be run on meta-updater's master branch which contains the
3 # reference docker files
4 # parameters:
5 # - BITBAKE_IMAGE
6 # - BITBAKE_CHECKOUT_IMAGE
7 # - BITBKAE_IMAGE_MASTER
8 # - BITBAKE_CHECKOUT_IMAGE_MASTER
9 image: docker:stable
10 stage: docker
11 services:
12 - docker:dind
13 before_script:
14 - docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
15 script:
16 - docker pull "$BITBAKE_IMAGE" || docker pull "$BITBKAE_IMAGE_MASTER" || true
17 - docker build --pull --cache-from "$BITBKAE_IMAGE_MASTER" --cache-from "$BITBAKE_IMAGE" -f ./scripts/ci/Dockerfile.bitbake -t "$BITBAKE_IMAGE" ./scripts/ci
18 - docker push "$BITBAKE_IMAGE"
19
20 - docker pull "$BITBAKE_CHECKOUT_IMAGE" || docker pull "$BITBAKE_CHECKOUT_IMAGE_MASTER" || true
21 - docker build --pull --cache-from "$BITBAKE_CHECKOUT_IMAGE_MASTER" --cache-from "$BITBAKE_CHECKOUT_IMAGE" -f ./scripts/ci/Dockerfile.checkout -t "$BITBAKE_CHECKOUT_IMAGE" ./scripts/ci
22 - docker push "$BITBAKE_CHECKOUT_IMAGE"
23
24.bb_docker_remote:
25 # intended to be run on other branches and repos: just pulls the last master image
26 # parameters:
27 # - BITBAKE_IMAGE
28 # - BITBAKE_CHECKOUT_IMAGE
29 image: docker:stable
30 stage: docker
31 services:
32 - docker:dind
33 before_script:
34 - docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
35 script:
36 - docker pull "$BITBAKE_IMAGE"
37 - docker pull "$BITBAKE_CHECKOUT_IMAGE"
diff --git a/scripts/ci/gitlab/tests.yml b/scripts/ci/gitlab/tests.yml
new file mode 100644
index 0000000..4bd5844
--- /dev/null
+++ b/scripts/ci/gitlab/tests.yml
@@ -0,0 +1,36 @@
1.bitbake:
2 # parameters:
3 # - TEST_BUILD_DIR
4 # - TEST_MACHINE (defaults to qemux86-64)
5 # - BITBAKE_TARGETS
6 image: $BITBAKE_IMAGE
7 dependencies:
8 - Checkout
9 tags:
10 - bitbake
11 script:
12 - /scripts/configure.sh
13 - /scripts/build.sh $BITBAKE_TARGETS
14
15.oe-selftest:
16 # parameters:
17 # - TEST_BUILD_DIR
18 # - TEST_MACHINE (defaults to qemux86-64)
19 # - OE_SELFTESTS
20 image: $BITBAKE_IMAGE
21 dependencies:
22 - Checkout
23 tags:
24 - bitbake
25 variables:
26 TEST_AKTUALIZR_CREDENTIALS: $CI_PROJECT_DIR/credentials.zip
27 before_script:
28 - aws s3 cp s3://ota-gitlab-ci/hereotaconnect_prod.zip credentials.zip
29 - sudo /usr/local/bin/setup_kvm.sh
30 script:
31 - |
32 # sg is needed after adding bitbake to the kvm group (see setup_kvm.sh)
33 sg kvm << EOS
34 /scripts/configure.sh
35 /scripts/oe-selftest.sh $OE_SELFTESTS
36 EOS