【发布时间】:2021-09-21 17:05:30
【问题描述】:
我有一个管道,我刚刚添加了 2 个参数来构建发布或调试(参数称为发布或调试)。管道使用 cron 语法每 10 分钟检查一次 SCM 中的更改,管道检查每次提交,然后构建发布(C++ 程序),但我想每天构建一次调试,假设每天每个 coomit 从 12 推送到13 将在调试中构建。所有这一切都无需我运行管道并手动更改参数(默认设置为发布)。有没有办法做到这一点?这是管道外观的一个非常简短的版本:
pipeline {
stages {
stage('Setup parameters') {
steps {
script {
properties([
parameters([
choice(
defaultValue: 'RELEASE',
choices: ['RELEASE', 'DEBUG'],
name: 'BUILD_CONFIG'
),
])
])
}
}
}
stage('Build release'){
when {
expression {
return params.BUILD_CONFIG == 'RELEASE'
}
}
steps{
script {
def msbuild = tool name: 'MSBuild', type: 'hudson.plugins.msbuild.MsBuildInstallation'
bat "\"${msbuild}\" /Source/project-GRDK.sln /t:Rebuild /p:configuration=\"Release Steam D3D11\""
}
}
}
stage('Build debug'){
when {
expression {
return params.BUILD_CONFIG == 'DEBUG'
}
}
steps{
script {
def msbuild = tool name: 'MSBuild', type: 'hudson.plugins.msbuild.MsBuildInstallation'
bat "\"${msbuild}\" /Source/project-GRDK.sln /t:Rebuild /p:configuration=\"Debug Steam D3D11\""
}
}
}
}
}
【问题讨论】:
标签: jenkins groovy jenkins-pipeline