seed script fails to create jobs using job DSL
See original GitHub issue- [latest ] Jenkins version
- [1.4] Plugin version
- [docker ] OS
When using following well-indented simple job dsl script to create seed jobs, the startup fails. The jobs section looks as :
jenkins:
systemMessage: "Welcome to Jenkins "
.
.
jobs:
- script: >
job('apps'){}
job('infra-tools'){}
The error seen in docker logs is
Caused by: io.jenkins.plugins.casc.ConfiguratorException: jobs: error configuring 'jobs' with class io.jenkins.plugins.casc.support.jobdsl.SeedJobConfigurator configurator
at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:626)
at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649)
at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:545)
at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:275)
at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:267)
... 13 more
Caused by: groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.dsl.jobs.FreeStyleJob.job() is applicable for argument types: (java.lang.String, script$_run_closure2) values: [infra-tools, script$_run_closure2@5f0b2f55]
However same script when run from DSL job manually ran fine.
Processing provided DSL script
Added items:
GeneratedJob{name='apps'}
GeneratedJob{name='infra-tools'}
Finished: SUCCESS
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
How to fail the seed job when using the Jenkins Job DSL plug-in
in Jenkins pipelines it is better to use 'error' step if (! binding.variables.get(it)?.trim()) { error "This script expects the $it environment variable to ......
Read more >Jobs created from SEED job no longer getting updated
It doesn't matter if it's an existing SEED job or a new one. ... Seed job's console log: Processing DSL script MyDeploymentPipeline.groovy. Existing...
Read more >Jenkins Tutorial: Implementing a Seed Job - HappyCoders.eu
Tutorial, part 3: Configure Jenkins Script Security - Create a seed job to automatically generate Jenkins jobs for new Java projects.
Read more >How To Automate Jenkins Job Configuration Using Job DSL
The seed job is a normal Jenkins job that runs the Job DSL script; in turn, the script contains instructions that create additional...
Read more >Jenkins DSL seed job - Technotes
Instead of selecting “Use the provided DSL script”, ... Running Jenkins jobs from the Git repository – Groovy Sandbox error message.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok so i found out the issue after debugging specially using this debugging line -> https://github.com/imalik-rms/configuration-as-code-plugin/blob/7aaa58cbc491018d9e23d63aad61af75c7647c26/support/src/main/java/io/jenkins/plugins/casc/support/jobdsl/SeedJobConfigurator.java#L67 that when you dont have a newline between any job definitions, it screams error
is interpreted as
so it gives
Caused by: javaposse.jobdsl.dsl.DslScriptException: (script, line 1) No signature of method: javaposse.jobdsl.dsl.jobs.FreeStyleJob.folder() is applicable for argument types: (java.lang.String, script$_run_closure2) values: [testing, script$_run_closure2@28f04c72]
error. however , the following runs fine since it got newline between jobs/folders DSL definitionI need to have a look then, will get back to you!