diff --git a/Jenkinsfile b/Jenkinsfile index 3ac5854..56dc00d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,12 +46,15 @@ podTemplate( stage('Test') { try { container('gradle') { - def projectDetails = sh(returnStdout: true, script: "gradle -q projectDetails").trim() + def projectName = sh(returnStdout: true, script: "gradle -q projectName").trim() + def projectVersion = sh(returnStdout: true, script: "gradle -q projectVersion").trim() + env.PROJECT_NAME = projectName + env.PROJECT_VERSION = projectVersion + sh """ pwd echo "GIT_BRANCH=${gitBranch}" >> /etc/environment echo "GIT_COMMIT=${gitCommit}" >> /etc/environment - echo "${projectDetails}" >> /etc/environment gradle test """ } diff --git a/build.gradle b/build.gradle index 5ce7e56..6a908e7 100644 --- a/build.gradle +++ b/build.gradle @@ -21,9 +21,13 @@ tasks.named('test') { useJUnitPlatform() } -task projectDetails { +task projectName { doLast { - println "PROJECT_NAME=${project.name}" - println "PROJECT_VERSION=${project.version}" + println "${project.name}" + } +} +task projectVersion { + doLast { + println "${project.version}" } }