Reputation: 19109
I took the DSL from this https://raw.githubusercontent.com/denschu/job-dsl-examples/master/job-dsl-example.groovy and try to create the job on my Jenkins 2.107 version. But its giving the missing tag error. Any help to convert this DSL to new version?
Processing provided DSL script
ERROR: (script, line 10) No signature of method: javaposse.jobdsl.dsl.helpers.scm.GitContext.createTag() is applicable for argument types: (java.lang.Boolean) values: [false]
DSL I am using.
def projectName = "deploy-application"
freeStyleJob("${projectName}"){
triggers { scm("*/5 * * * *") }
scm {
git {
remote {
url("https://github.com/codecentric/spring-samples")
}
createTag(false)
}
}
rootPOM("${projectName}/pom.xml")
goals("clean package")
wrappers {
preBuildCleanup()
release {
preBuildSteps {
maven {
mavenInstallation("Maven 3.0.4")
rootPOM("${projectName}/pom.xml")
goals("build-helper:parse-version")
goals("versions:set")
property("newVersion", "\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}-\${BUILD_NUMBER}")
}
}
postSuccessfulBuildSteps {
maven {
rootPOM("${projectName}/pom.xml")
goals("deploy")
}
maven {
goals("scm:tag")
}
downstreamParameterized {
trigger("deploy-application") {
predefinedProp("STAGE", "development")
}
}
}
}
}
publishers {
groovyPostBuild("manager.addShortText(manager.build.getEnvironment(manager.listener)[\'POM_VERSION\'])")
}
promotions {
promotion("Development") {
icon("star-red")
conditions {
manual('')
}
actions {
downstreamParameterized {
trigger("deploy-application","SUCCESS",false,["buildStepFailure": "FAILURE","failure":"FAILURE","unstable":"UNSTABLE"]) {
predefinedProp("ENVIRONMENT","test-server")
predefinedProp("APPLICATION_NAME", "\${PROMOTED_JOB_FULL_NAME}")
predefinedProp("BUILD_ID","\${PROMOTED_NUMBER}")
}
}
}
}
promotion("QA") {
icon("star-yellow")
conditions {
manual('')
upstream("Development")
}
actions {
downstreamParameterized {
trigger("deploy-application","SUCCESS",false,["buildStepFailure": "FAILURE","failure":"FAILURE","unstable":"UNSTABLE"]) {
predefinedProp("ENVIRONMENT","qa-server")
predefinedProp("APPLICATION_NAME", "\${PROMOTED_JOB_FULL_NAME}")
predefinedProp("BUILD_ID","\${PROMOTED_NUMBER}")
}
}
}
}
promotion("Production") {
icon("star-green")
conditions {
manual('')
upstream("QA")
}
actions {
downstreamParameterized {
trigger("deploy-application","SUCCESS",false,["buildStepFailure": "FAILURE","failure":"FAILURE","unstable":"UNSTABLE"]) {
predefinedProp("ENVIRONMENT","prod-server")
predefinedProp("APPLICATION_NAME", "\${PROMOTED_JOB_FULL_NAME}")
predefinedProp("BUILD_ID","\${PROMOTED_NUMBER}")
}
}
}
}
}
}
Upvotes: 0
Views: 442
Reputation: 657
The syntax of the createTag method has changed slightly. Take a look here at the latest api docs. https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.git If you don't want to create a tag at all though, I would just delete that line. The new Syntax is:
git {
tag(String targetRepo, String name) {
// If set, creates a new tag.
create(boolean create = true)
// Sets a message for the tag.
message(String message)
// If set, updates an existing tag.
update(boolean update = true)
}
}
Upvotes: 1