在Jenkins(Jenkins 2.6)中设置Pipeline构建,复制基于git的构建的示例脚本给出:"没有找到名为MSBuild的工具".我已经设置了MSBuild工具Manage Jenkins -> Global Tool Configuration.我在从节点上运行管道.
在Slave配置中,我已经设置了MSBuild工具路径Node Properties -> Tool Locations.
在构建过程中,它无法获得MSBuild工具路径,如果我在没有管道的情况下运行相同的源(不使用Jenkinsfile),它可以正常工作.
请参阅Jenkinsfile语法
pipeline {
agent { label 'win-slave-node' }
stages {
stage('build') {
steps {
bat "\"${tool 'MSBuild'}\" SimpleWindowsProject.sln /t:Rebuild /p:Configuration=Release"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试更改windows slave的环境变量,它没有刷新.
注意:我已在从属节点上安装了MS Build工具