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
'''
}
Originally reported by samarth2892, imported from: Ant in pipeline DSL doesn't import env vars correctly.
- assignee:
armfergom
- status: Open
- priority: Major
- component(s): ant-plugin
- resolution: Unresolved
- votes: 0
- watchers: 1
- imported: 20251216-182730
Raw content of original issue
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
'''
}
environment
Jenkins ver. 2.89.3<br/>
Ant Plugin 1.8<br/>
Build slave OS CentOS 7.2<br/>
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
It works if I modify the ant step like this.
steps { sh '''#!/bin/bash env > env.props source env.props ant clean -v ''' }Originally reported by samarth2892, imported from: Ant in pipeline DSL doesn't import env vars correctly.
Raw content of original issue
environment