我想在我的jenkins工作中运行p4插件,这将取决于jenkins工作参数,例如打开/关闭
想在步骤> systemGroovyCommand中检查booleanParam是否为“ true”,但是如何运行或传递基于booleanParam的SCM perforce同步?
job("test-job") {
parameters {
booleanParam('Sync_code', false,'sync code from depot')
}
scm {
perforceP4('credentials') {
workspace {
manual('workspace_name', '')
}
configure { node ->
node / workspace / spec / streamName('//perforce_path')
}
}
}
steps {
systemGroovyCommand("""
def build = this.getProperty('binding').getVariable('build')
def listener = this.getProperty('binding').getVariable('listener')
def env = build.getEnvironment(listener)
println "Sync_code : "+ env.Sync_code
""")
}
configure {
it / 'builders' / 'hudson.plugins.python.Python' {
command("""
here some python
""")
}
}
}
预期当我从管道运行'test-job'并将参数'Sync_code'设置为true时,它将同步来自perforce的代码,并且如果'Sync_code'设置为'false'则不执行任何操作