使用Jenkins声明性管道,如何根据exe输出设置阶段中变量的值?
使用Jenkins声明性管道,如何根据.exe输出设置阶段中变量的值 jenkins实例正在windows操作系统上运行。使用Jenkins声明性管道,如何根据exe输出设置阶段中变量的值?,jenkins,jenkins-pipeline,Jenkins,Jenkins Pipeline,使用Jenkins声明性管道,如何根据.exe输出设置阶段中变量的值 jenkins实例正在windows操作系统上运行。 变量可以是作业运行的全局变量,也可以是阶段内的局部变量。明白了。看起来关键是在命令前面加上@,以防止命令本身包含在输出中 stage('Build') { steps { script { // Its very important to prefix the script with "@" or else the command
变量可以是作业运行的全局变量,也可以是阶段内的局部变量。明白了。看起来关键是在命令前面加上@,以防止命令本身包含在输出中
stage('Build') {
steps {
script {
// Its very important to prefix the script with "@" or else the command itself will be included in the output
GITVERSION_FULLSEMVAR = bat( script: '@GitVersion.exe /showvariable FullSemVer', returnStdout: true )
}
bat "dotnet build /p:Version=${GITVERSION_FULLSEMVAR}"
}