-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins ver. 2.89.3
Ant Plugin 1.8
Build slave OS CentOS 7.2
Ant 1.9.2
The DSL
pipeline { agent { node { label 'lowpriority' } } environment { BRANCH_NAME = 'feature/jenkins-pipline-poc' } tools { ant 'Ant 1.9' jdk 'wca-jdk-prod' } stages{ stage ('Checkout') { steps { cleanWs() checkout scm } } stage ('Build') { steps { sh "ant clean -v" } } } }
Ant property "build-common-ant.dir" depends on ENV vars "NODE_NAME" and "EXECUTOR_NUMBER"
It get following errors
[property] Loading Environment env. Property "NODE_NAME" has not been set Property "EXECUTOR_NUMBER" has not been set
It works if I modify the ant step like this.
steps { sh '''#!/bin/bash env > env.props source env.props ant clean -v ''' }
[JENKINS-49600] Ant in pipeline DSL doesn't import env vars correctly.
Description |
Original:
The DSL {code:java} pipeline { agent { node { label 'lowpriority' } } environment { BRANCH_NAME = 'feature/jenkins-pipline-poc' } tools { ant 'Ant 1.9' jdk 'wca-jdk-prod' } stages{ stage ('Checkout') { steps { cleanWs() checkout scm } } stage ('Build') { steps { sh "ant clean -v" } } } } {code} Ant property "build-common-ant.dir" depends on ENV vars "NODE_NAME" and "EXECUTOR_NUMBER" It get following errors {code:java} [property] Loading Environment env. Property "NODE_NAME" has not been set Property "EXECUTOR_NUMBER" has not been set {code} It works if I modify the ant step like this. {code:java} steps { sh '''#!/bin/bash env > env.props source env.props ant clean -v ''' } {code} |
New:
The DSL {code:java} pipeline { agent { node { label 'lowpriority' } } environment { BRANCH_NAME = 'feature/jenkins-pipline-poc' } tools { ant 'Ant 1.9' jdk 'wca-jdk-prod' } stages{ stage ('Checkout') { steps { cleanWs() checkout scm } } stage ('Build') { steps { sh "ant clean -v" } } } } {code} Ant property "build-common-ant.dir" depends on ENV vars "NODE_NAME" and "EXECUTOR_NUMBER" It get following errors {code:java} [property] Loading Environment env. Property "NODE_NAME" has not been set Property "EXECUTOR_NUMBER" has not been set {code} It works if I modify the ant step like this. {code:java} steps { sh '''#!/bin/bash env > env.props source env.props ant clean -v ''' } {code} |