summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManikandan Kandasamy <manikandan.kandasamy@here.com>2019-01-10 13:46:07 +0100
committerKandasamy <manikandan.kandasamy@here.com>2019-03-03 23:46:20 +0100
commita9494095cc75e64542ed1eecac681c99d41492fd (patch)
tree45cc9d63cfa6b0d0effa193fe3443eb63c28bd54
parent29c3476c8286649210ab8d731bfa063c76907f3b (diff)
downloadmeta-updater-a9494095cc75e64542ed1eecac681c99d41492fd.tar.gz
oe-selftest from GitLab resolves OTA-1937ci/gitlab/ota-1937
Signed-off-by: Manikandan Kandasamy <manikandan.kandasamy@here.com>
-rw-r--r--scripts/ci/Dockerfile.bitbake4
-rw-r--r--scripts/ci/gitlab/.gitlab-ci.yml48
-rwxr-xr-xscripts/ci/gitlab/bitbaker.sh82
3 files changed, 134 insertions, 0 deletions
diff --git a/scripts/ci/Dockerfile.bitbake b/scripts/ci/Dockerfile.bitbake
index c91f94c..04e8e79 100644
--- a/scripts/ci/Dockerfile.bitbake
+++ b/scripts/ci/Dockerfile.bitbake
@@ -20,10 +20,12 @@ RUN apt-get update -q && apt-get install -qy \
20 locales \ 20 locales \
21 ovmf \ 21 ovmf \
22 procps \ 22 procps \
23 python-pip \
23 python \ 24 python \
24 python3 \ 25 python3 \
25 python3-pexpect \ 26 python3-pexpect \
26 qemu \ 27 qemu \
28 repo \
27 socat \ 29 socat \
28 texinfo \ 30 texinfo \
29 unzip \ 31 unzip \
@@ -40,3 +42,5 @@ RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
40ENV LC_ALL="en_US.UTF-8" 42ENV LC_ALL="en_US.UTF-8"
41ENV LANG="en_US.UTF-8" 43ENV LANG="en_US.UTF-8"
42ENV LANGUAGE="en_US.UTF-8" 44ENV LANGUAGE="en_US.UTF-8"
45
46RUN pip install awscli \ No newline at end of file
diff --git a/scripts/ci/gitlab/.gitlab-ci.yml b/scripts/ci/gitlab/.gitlab-ci.yml
new file mode 100644
index 0000000..93ab062
--- /dev/null
+++ b/scripts/ci/gitlab/.gitlab-ci.yml
@@ -0,0 +1,48 @@
1stages:
2 - setup_docker
3 - setup_data
4 - execute
5
6variables:
7 DEBIAN_BITBAKE_MASTER_IMAGE: ${CI_REGISTRY_IMAGE}:ci-master-DEBIAN_BITBAKE
8 # The docker images will be specific to the branch we are pushing to
9 DEBIAN_BITBAKE_CI_IMAGE: ${CI_REGISTRY_IMAGE}:ci-${CI_COMMIT_REF_SLUG}-DEBIAN_BITBAKE
10 BITBAKE_CACHE: "/data/bitbake-cache"
11
12# Build the Docker image that will be used in subsequent CI/CD stages
13setup docker image:
14 image: docker:latest
15 stage: setup_docker
16 services:
17 - docker:dind
18 before_script:
19 - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
20 script:
21 - docker pull "$DEBIAN_BITBAKE_CI_IMAGE" || docker pull "$DEBIAN_BITBAKE_MASTER_IMAGE" || true
22 - docker build --pull --cache-from "$DEBIAN_BITBAKE_MASTER_IMAGE" --cache-from "$DEBIAN_BITBAKE_CI_IMAGE" -f "${CI_PROJECT_DIR}/scripts/ci/Dockerfile.bitbake" -t "$DEBIAN_BITBAKE_CI_IMAGE" .
23 - docker push "$DEBIAN_BITBAKE_CI_IMAGE"
24
25setup data:
26 stage: setup_data
27 image: "$DEBIAN_BITBAKE_CI_IMAGE"
28 artifacts:
29 paths:
30 - data/
31
32 script:
33 - mkdir data
34 - aws s3 ls s3://ota-gitlab-ci/
35 - aws s3 cp s3://ota-gitlab-ci/hereotaconnect_prod.zip data/credentials.zip
36 - chmod +x data/credentials.zip
37
38#Build step to perform bitbake or run oe-selftest based on input params
39oe-selftest:
40 image: "$DEBIAN_BITBAKE_CI_IMAGE"
41 stage: execute
42 dependencies:
43 - setup data
44
45 script:
46 - export DEVICE=${DEVICE:-'qemux86-64'}
47 - export REPO_BRANCH=${REPO_BRANCH:-'master'}
48 - scripts/ci/gitlab/bitbaker.sh \ No newline at end of file
diff --git a/scripts/ci/gitlab/bitbaker.sh b/scripts/ci/gitlab/bitbaker.sh
new file mode 100755
index 0000000..7e3def1
--- /dev/null
+++ b/scripts/ci/gitlab/bitbaker.sh
@@ -0,0 +1,82 @@
1#!/bin/bash -x
2
3echo "Device --> $DEVICE"
4echo "Platform --> $PLATFORM"
5echo "Test --> $TEST"
6echo "REPO_BRANCH --> $REPO_BRANCH"
7echo "BITBAKE_CACHE -- $BITBAKE_CACHE"
8
9export DEVICE=${DEVICE:-'qemux86-64'}
10export LANG=en_US.UTF-8
11export REPO_BRANCH=${REPO_BRANCH:-'master'}
12
13repo_sync()
14{
15if [ "${PLATFORM}" == "agl" ] || [ "${PLATFORM}" == "AGL" ]
16then
17 repo init -b eel -m default.xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo.git
18else
19 repo init -u https://github.com/advancedtelematic/updater-repo.git
20fi
21
22echo "Manifest before update"
23REPO_MANIFEST=".repo/manifests/$REPO_BRANCH.xml"
24cat $REPO_MANIFEST
25
26METAUPDATER_REV=`git rev-parse HEAD`
27
28sed -i 's/meta-updater" remote="github" revision="'$REPO_BRANCH'"/meta-updater" remote="github" revision="'$METAUPDATER_REV'"/' $REPO_MANIFEST
29
30echo "Manifest after update"
31cat $REPO_MANIFEST
32
33repo init -m ${REPO_BRANCH}.xml
34repo sync
35
36if [ "${PLATFORM}" == "agl" ] || [ "${PLATFORM}" == "AGL" ]
37then
38 source meta-agl/scripts/aglsetup.sh -m $DEVICE agl-demo agl-appfw-smack agl-sota
39else
40 source meta-updater/scripts/envsetup.sh $DEVICE
41fi
42}
43
44customize_build()
45{
46CONF_FILE_PATH="conf/local.conf"
47if [ -f "$CONF_FILE_PATH" ]
48then
49 echo "SOTA_PACKED_CREDENTIALS = \"${CI_PROJECT_DIR}/data/credentials.zip\"" >> $CONF_FILE_PATH
50 echo 'OSTREE_BRANCHNAME = "ostree_qemu_from_gitlab"' >> $CONF_FILE_PATH
51 echo "DL_DIR = \"${BITBAKE_CACHE}\"" >> $CONF_FILE_PATH
52 echo "SSTATE_DIR = \"${BITBAKE_CACHE}\"" >> $CONF_FILE_PATH
53 echo 'IMAGE_INSTALL_append = " vim dropbear"' >> $CONF_FILE_PATH
54 echo 'SANITY_TESTED_DISTROS = ""' >> conf/local.conf
55 cat $CONF_FILE_PATH
56else
57 echo "$CONF_FILE_PATH not found."
58 exit 1
59fi
60touch conf/sanity.conf
61}
62
63run_command()
64{
65if [ "${PLATFORM}" == "agl" ] || [ "${PLATFORM}" == "AGL" ]; then
66 bitbake agl-demo-platform
67elif [ "${TEST}" == "oe-selftest" ] || [ "${TEST}" == "OE-SELFTEST" ]; then
68 oe-selftest -r updater
69elif [ "${DEVICE}" == "raspberrypi3" ]; then
70 bitbake rpi-basic-image
71elif [ "${DEVICE}" == "qemux86-64" ]; then
72 bitbake core-image-minimal
73else
74 echo "Unknown parameter provided"
75 exit 1
76fi
77}
78
79repo_sync
80customize_build
81run_command
82df -h \ No newline at end of file