Issue Type: Bug Bug
Assignee: Daniel Spilker
Components: job-dsl-plugin
Created: 02/Oct/14 11:21 PM
Description:

When seeding a job that uses the Perforce plugin, the configVersion is not set. This causes certain features to not be supported, such as disableChangeLogOnly(). If I explicitly set the configVersion, such features are used.

Example (does not work):

scm {
	p4(viewspec) { node ->
		node / p4Client("\${JOB_NAME}")
		node / p4Port("server:1666")
		node / disableChangeLogOnly(true)
	}
}

Example (works, using monkey patch):

ScmContext.metaClass.myP4 = { String viewspec, Closure configure = null ->
	p4(viewspec, configure)
	// By default, the DSL does not set configVersion, which should force the Perforce SCM plugin to set configVersion to latest.
	// See: https://github.com/jenkinsci/perforce-plugin/blob/master/src/main/java/hudson/plugins/perforce/PerforceSCM.java#L633
	//
	// However, it doesn't seem to work which requires us to set it explicitly.
	// If it is not set, features such as "disableChangeLogOnly" does not work.
	//
	// Setting configVersion from the closure doesn't seem to work.
	// So, find the Node and set it there.
	Node p4Node = scmNodes.find() { it.name() == "scm" && it.attribute("class") == "hudson.plugins.perforce.PerforceSCM"}
	// configVersion is set to the default version in the Jenkins Perforce SCM plugin.
	// See: https://github.com/jenkinsci/perforce-plugin/blob/master/src/main/java/hudson/plugins/perforce/PerforceSCM.java#L332
	p4Node.appendNode("configVersion", "2")
}

use (my.DslExtensions) {
	scm {
		myP4(viewspec) { node ->
			node / p4Client("\${JOB_NAME}")
			node / p4Port("server:1666")
			node / disableChangeLogOnly(true)
		}
	}
}
Environment: Jenkins 1.571
Jenkins Job DSL Plugin 1.25
Perforce Plugin 1.3.27
Project: Jenkins
Priority: Minor Minor
Reporter: Mario Vuong
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to