Jenkinsfile: refactored def to be a function

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

Branch: refs/heads/develop
Commit: 7ae5c96ca3b3a7c97048b9cf1e660796a25505b5
Parents: 1704ab2
Author: Dominik Psenner <[email protected]>
Authored: Mon Jul 3 14:24:57 2017 +0200
Committer: Dominik Psenner <[email protected]>
Committed: Mon Jul 3 14:24:57 2017 +0200

----------------------------------------------------------------------
 Jenkinsfile | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/7ae5c96c/Jenkinsfile
----------------------------------------------------------------------
diff --git a/Jenkinsfile b/Jenkinsfile
index cbd8323..ebad3f9 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -26,7 +26,9 @@ pipeline {
                skipDefaultCheckout()
        }
        // TODO: find a better way to determine nant installation path
-       def NANT = 'F:\\jenkins\\tools\\nant\\nant-0.92\\bin\\NAnt.exe'
+       def getPathToNAntOnWindows() {
+               return 'F:\\jenkins\\tools\\nant\\nant-0.92\\bin\\NAnt.exe'
+       }
        stages {
                stage('checkout') {
                        steps {
@@ -36,7 +38,7 @@ pipeline {
                stage('build net-4.0') {
                        agent { label 'Windows' }
                        environment {
-                               NANT_BIN = NANT
+                               NANT_BIN = getPathToNAntOnWindows()
                        }
                        steps {
                                bat "${NANT_BIN} -buildfile:log4net.build 
compile-net-4.0"
@@ -46,7 +48,7 @@ pipeline {
                stage('build net-4.0-cp') {
                        agent { label 'Windows' }
                        environment {
-                               NANT_BIN = NANT
+                               NANT_BIN = getPathToNAntOnWindows()
                        }
                        steps {
                                bat "${NANT_BIN} -buildfile:log4net.build 
compile-net-4.0-cp"
@@ -56,7 +58,7 @@ pipeline {
                stage('build net-4.5') {
                        agent { label 'Windows' }
                        environment {
-                               NANT_BIN = NANT
+                               NANT_BIN = getPathToNAntOnWindows()
                        }
                        steps {
                                bat "${NANT_BIN} -buildfile:log4net.build 
compile-net-4.5"
@@ -106,7 +108,7 @@ pipeline {
                                jdk 'JDK 1.8 (latest)'
                        }
                        environment {
-                               NANT_BIN = NANT
+                               NANT_BIN = getPathToNAntOnWindows()
                        }
                        steps {
                                bat "${NANT_BIN} -buildfile:log4net.build 
generate-site"
@@ -117,7 +119,7 @@ pipeline {
                stage('test on Windows') {
                        agent { label 'Windows' }
                        environment {
-                               NANT_BIN = NANT
+                               NANT_BIN = getPathToNAntOnWindows()
                        }
                        steps {
                                bat "${NANT_BIN} -buildfile:tests\\nant.build"

Reply via email to