我正在尝试使用Jenkins中的常规管道来更新我们的构建过程。但是,我无法弄清楚如何使用属性列表来调用Ant。
node {
echo "Starting client build..."
client()
}
def client() {
stage('Build client') {
echo "build from ${BRANCH} branch and delivered to ${DELIVERY_LOCATION} with update verison ${UPDATE_VERSION}"
git branch: '${BRANCH}', credentialsId: 'XXXXXXXXXXXXXX', url: 'https://[email protected]/REPO/test.git'
properties([[$class: 'JiraProjectProperty'], [$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], parameters([booleanParam(defaultValue: false, description: '', name: 'HTTP'), string(defaultValue: '1.0', description: '', name: 'VERSION', trim: false), choice(choices: ['Packages', 'Updates', 'Release'], description: '', name: 'DELIVERY_LOCATION'), string(defaultValue: '', description: '', name: 'UPDATE_VERSION', trim: false), choice(choices: ['master', 'development'], description: '', name: 'BRANCH'), string(defaultValue: '\\\\shares\\WebHelp', description: '', name: 'WEBHELP_SOURCE_FOLDER', trim: false)])])
echo "properties: $params"
withAnt(installation: 'apache-ant-1.9.14', jdk: 'JDK1.8.0_144') {
Buildfile:'C:\\Program Files (x86)\\Jenkins\\workspace\\Test\\webclient\\build.xml'
sh "ant package $params"
}
}
}
我似乎无法像过去那样使用BuildFile: .....
指定构建文件
一旦我可以指定要传递的构建文件的属性,但我还没有到达那里。。类似:
Properties: rel.dest=$DELIVERY_LOCATION
major.version = $VERSION
webhelp.src.folder = $WEBHELP_SOURCE_FOLDER
任何对此的帮助,将不胜感激!
谢谢!
这可能不是最优雅的解决方案,但是我发现最简单的方法是重现在终端命令中键入的内容:
sh 'ant package\
-f /path/to/build.xml\
-Dparam1=value1\
-Dparam2=value2'