问题
I am using DSL Plugin 1.64. I have DSL script for generating jobs. generating pipeline jobs, somehow wrappers and publishers syntax are not working. I have already asked one question for wrappers, now I am trying to use publishers and its not working in pipeline job. I can not see for example groovyPostBuild step. even I can not not see a postbuild action in pipeline job, I don`t want to put this is pipeline jenkinsfile.
pipelineJob('Dump_File_Verification ') {
parameters {
stringParam('DUMP_BUCKET', 'xxxxxxxx')
}
logRotator(-1, 50, -1, -1)
configure {
it / definition / lightweight(true)
}
triggers {
cron('0 */6 * * *')
}
concurrentBuild(false)
definition {
cpsScm {
scm {
scriptPath ('Jenkinsfile')
git {
branches('*/dev')
remote {
url ('git@github.com:xxxxxxx.git')
credentials ('xxxxxxxx')
}
extensions{
cloneOptions {
noTags(true)
shallow(true)
timeout(30)
}
}
}
}
}
}
publishers {
groovyPostBuild('println "hello, world"', Behavior.MarkFailed)
}}
回答1:
The Pipeline job type does not support publishers or post-build actions. It's a problem in Job DSL that the syntax is available and does not cause a runtime error. See JENKINS-31832 in the Jenkins bug tracker.
来源:https://stackoverflow.com/questions/48193600/jenkins-dsl-pipeline-syntax-for-wrappers-or-publishers