I have a code snippet to create an empty workflow project.
def parent = Jenkins.getInstance()
def name = "Test_Name"
def project = parent.getItem(name)
if (project == null) {
project = parent.createProject(WorkflowJob.class, name)
} else print "[INFO] Project $name already exists. Will be updated."
project.setDescription("my description")
project.setDefinition(new CpsFlowDefinition("print \"test\""))
project.addTrigger(new hudson.triggers.TimerTrigger("0 20 * * *"))
project.setBuildDiscarder(new hudson.tasks.LogRotator("", "5", "", ""))
project.save()
I would like to add parameters to that project, something like:
project.addParameter(new StringParameter("name", "default", "description"))
but I cannot find a way how to actually do it.
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/324760f0-02a7-497f-8b5c-3a6e5535a3c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.