Revert "Add Jenkins user to Docker image earlier" 54/2154/1
authormarchettim <mmarchetti@sandvine.com>
Sat, 9 Sep 2017 14:12:54 +0000 (16:12 +0200)
committermarchettim <mmarchetti@sandvine.com>
Sat, 9 Sep 2017 14:12:54 +0000 (16:12 +0200)
This reverts commit dda707b51e8ce223a59d454dbd3f5a43f212b2ac.

Change-Id: I8129da9c306d202e722306341d6243b710eb5a31

jenkins/ci-pipelines/ci_stage_2.groovy

index 45bf777..45cbc7d 100644 (file)
@@ -45,12 +45,16 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,build_system) {
     container_name = "${project}-${branch}".toLowerCase()
 
     stage('Docker-Build') {
-       sh "echo 'RUN groupadd -o -g " + "id -g".execute().text + " -r jenkins \\' >> Dockerfile"
-       sh "echo '      && useradd -o -u " + "id -u".execute().text + " --create-home -r -g  jenkins jenkins' >> Dockerfile"
         sh "docker build -t ${container_name} ."
     }
 
     withDockerContainer("${container_name}") {
+        stage('Docker-Setup') {
+            sh '''
+               groupadd -o -g $(id -g) -r jenkins
+               useradd -o -u $(id -u) --create-home -r -g  jenkins jenkins
+               '''
+        }
         stage('Test') {
             sh 'devops-stages/stage-test.sh'
         }