Jenkinsfile: refactoring

Project: http://git-wip-us.apache.org/repos/asf/logging-log4net/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4net/commit/358a6cdf
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4net/tree/358a6cdf
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4net/diff/358a6cdf

Branch: refs/heads/feature/RollingFileAppender-NG
Commit: 358a6cdfbac29ffbc1f2352ec3be91d5975cda1a
Parents: 6736631
Author: Dominik Psenner <dpsen...@apache.org>
Authored: Tue Jul 18 21:15:33 2017 +0200
Committer: Dominik Psenner <dpsen...@apache.org>
Committed: Tue Jul 18 21:15:33 2017 +0200

----------------------------------------------------------------------
 Jenkinsfile | 43 +++++++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/358a6cdf/Jenkinsfile
----------------------------------------------------------------------
diff --git a/Jenkinsfile b/Jenkinsfile
index 5176263..5d0d07c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -41,32 +41,31 @@ pipeline {
                        steps {
                                script {
                                        checkout scm
+                                       def builder_dir = 
"buildtools/docker/builder-netstandard"
 
-                                       dir 
('buildtools/docker/builder-netstandard') {
-                                               // calculate args required to 
build the docker container
-                                               def JENKINS_UID = sh (
-                                                       script: 'stat -c \"%u\" 
.',
-                                                       returnStdout: true
-                                               ).trim()
-                                               def JENKINS_GID = sh (
-                                                       script: 'stat -c \"%g\" 
.',
-                                                       returnStdout: true
-                                               ).trim()
-                                               echo "$JENKINS_UID"
-                                               echo "$JENKINS_GID"
+                                       // calculate args required to build the 
docker container
+                                       def JENKINS_UID = sh (
+                                               script: "stat -c \"%u\" 
$builder_dir",
+                                               returnStdout: true
+                                       ).trim()
+                                       def JENKINS_GID = sh (
+                                               script: "stat -c \"%g\" 
$builder_dir",
+                                               returnStdout: true
+                                       ).trim()
+                                       echo "$JENKINS_UID"
+                                       echo "$JENKINS_GID"
 
-                                               // build docker container
-                                               def docker_container = 
docker.build 'builder-netstandard:latest', "--build-arg 
JENKINS_UID=$JENKINS_UID --build-arg JENKINS_GID=$JENKINS_GID ."
+                                       // build docker container
+                                       def builder = docker.build 
'builder-netstandard:latest', "--file $builder_dir/Dockerfile --build-arg 
JENKINS_UID=$JENKINS_UID --build-arg JENKINS_GID=$JENKINS_GID $builder_dir"
 
-                                               // run docker container
-                                               docker_container.inside {
-                                                       // compile
-                                                       sh "nant 
compile-netstandard"
-                                                       stash includes: 
'bin/**/*.*', name: 'netstandard-assemblies'
+                                       // run docker container
+                                       builder.inside {
+                                               // compile
+                                               sh "nant compile-netstandard"
+                                               stash includes: 'bin/**/*.*', 
name: 'netstandard-assemblies'
 
-                                                       // test
-                                                       sh 'cd 
netstandard/log4net.tests && dotnet test'
-                                               }
+                                               // test
+                                               sh 'cd 
netstandard/log4net.tests && dotnet test'
                                        }
                                }
 

Reply via email to