diff options
author | Laurent Bonnans <laurent.bonnans@here.com> | 2018-06-27 11:13:06 +0200 |
---|---|---|
committer | Laurent Bonnans <laurent.bonnans@here.com> | 2018-09-06 11:45:07 +0200 |
commit | 1b3616e68408a881df58e1bb806bc9c78828f779 (patch) | |
tree | 11d1a7902ac1fb866284a5ef0e1b7693e02e1338 | |
parent | 7023fdda425f9d5e3b48e2cd12f961c0060ace54 (diff) | |
download | meta-updater-1b3616e68408a881df58e1bb806bc9c78828f779.tar.gz |
Create a user with correct uid inside CI's Dockerfile
-rw-r--r-- | scripts/ci/Dockerfile.bitbake | 5 | ||||
-rw-r--r-- | scripts/ci/Jenkinsfile.bleeding | 14 |
2 files changed, 17 insertions, 2 deletions
diff --git a/scripts/ci/Dockerfile.bitbake b/scripts/ci/Dockerfile.bitbake index 9d34dca..c91f94c 100644 --- a/scripts/ci/Dockerfile.bitbake +++ b/scripts/ci/Dockerfile.bitbake | |||
@@ -31,6 +31,11 @@ RUN apt-get update -q && apt-get install -qy \ | |||
31 | xterm \ | 31 | xterm \ |
32 | xz-utils | 32 | xz-utils |
33 | 33 | ||
34 | ARG uid=1000 | ||
35 | ARG gid=1000 | ||
36 | RUN groupadd -g $gid bitbake | ||
37 | RUN useradd -m -u $uid -g $gid bitbake | ||
38 | |||
34 | RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen | 39 | RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen |
35 | ENV LC_ALL="en_US.UTF-8" | 40 | ENV LC_ALL="en_US.UTF-8" |
36 | ENV LANG="en_US.UTF-8" | 41 | ENV LANG="en_US.UTF-8" |
diff --git a/scripts/ci/Jenkinsfile.bleeding b/scripts/ci/Jenkinsfile.bleeding index f4d8883..e50b4b6 100644 --- a/scripts/ci/Jenkinsfile.bleeding +++ b/scripts/ci/Jenkinsfile.bleeding | |||
@@ -1,8 +1,16 @@ | |||
1 | // This CI setup checks out aktualizr, meta-updater and updater-repo and builds | 1 | // This CI setup checks out aktualizr, meta-updater and updater-repo and builds |
2 | // master branches whenever a change is pushed to any of these | 2 | // master branches whenever a change is pushed to any of these |
3 | 3 | ||
4 | // define these for docker image creation | ||
5 | node { | ||
6 | // might cause some problems: | ||
7 | // https://stackoverflow.com/questions/44805076/setting-build-args-for-dockerfile-agent-using-a-jenkins-declarative-pipeline | ||
8 | JENKINS_UID = sh(returnStdout: true, script: 'id -u').trim() | ||
9 | JENKINS_GID = sh(returnStdout: true, script: 'id -g').trim() | ||
10 | } | ||
11 | |||
4 | pipeline { | 12 | pipeline { |
5 | agent none | 13 | agent any |
6 | environment { | 14 | environment { |
7 | TEST_AKTUALIZR_REMOTE = 'aktualizr' | 15 | TEST_AKTUALIZR_REMOTE = 'aktualizr' |
8 | TEST_AKTUALIZR_DIR = 'aktualizr' | 16 | TEST_AKTUALIZR_DIR = 'aktualizr' |
@@ -11,8 +19,8 @@ pipeline { | |||
11 | } | 19 | } |
12 | stages { | 20 | stages { |
13 | stage('checkout') { | 21 | stage('checkout') { |
14 | agent any | ||
15 | steps { | 22 | steps { |
23 | |||
16 | checkout([$class: 'GitSCM', | 24 | checkout([$class: 'GitSCM', |
17 | userRemoteConfigs: [ | 25 | userRemoteConfigs: [ |
18 | [url: 'https://github.com/advancedtelematic/aktualizr', name: 'aktualizr'] | 26 | [url: 'https://github.com/advancedtelematic/aktualizr', name: 'aktualizr'] |
@@ -61,6 +69,8 @@ pipeline { | |||
61 | dockerfile { | 69 | dockerfile { |
62 | filename 'scripts/ci/Dockerfile.bitbake' | 70 | filename 'scripts/ci/Dockerfile.bitbake' |
63 | args '-v /opt/jenkins/bitbake-common:/opt/jenkins/bitbake-common' | 71 | args '-v /opt/jenkins/bitbake-common:/opt/jenkins/bitbake-common' |
72 | additionalBuildArgs "--build-arg uid=${JENKINS_UID} --build-arg gid=${JENKINS_GID}" | ||
73 | reuseNode true | ||
64 | } | 74 | } |
65 | } | 75 | } |
66 | environment { | 76 | environment { |