Hello all,
I'm currently automating the deployment of a Jenkins platform using Puppet.
Currently, as far as the Jenkins configuration via groovy and Job-DSL portion of automation goes we
- create seed job directly from an XML file stored in our SCM using the jenkins CLI.
- build the seed job using the jenkins CLI
- run a groovy script through the script console that sets up tool configurations (programmatically configuring Jenkins)
I was wondering if it would be possible to simplify this process by doing one of two things:
- Rather than kicking off job generation through processing Job-DSL scripts in a seed job, make it possible to process Job-DSL scripts as part of a groovy script on the groovy script console
- Enable you write DSL code - and then specify that you're done with Job-DSL so the jobs get created - and then you can perform additional actions with these jobs if need be.
This would allow you to write one groovy script that configures Jenkins both from a tool/settings perspective and from a jobs perspective.
I realize that the seed job that gets generated from an XML could just contain the groovy script that also configures settings.. but i'm just thinking it would be more elegant if this could all take place from one script.
My specific use case of this is i'm creating a folder - within that folder i create a view - i set this new view as the primary view but it's not possible with Job DSL to not create the "All" view and i can't delete it programmatically because at the time of script execution - the folder doesn't actually exist yet.
This means that i have to execute the Job-DSL that creates this folder/view and then in a next step - as part of an "execute groovy step" build step - i delete the "All" view.
TL;DR
It would be nice if you could specify in a Job-DSL script that you're done scripting jobs and have those jobs get created so that code moving forward could reference the generated items.
An alternative solution would be to enable a mechanism to process Job-DSL scripts as part of a system groovy script from the Jenkins script console.
I appreciate any feedback - perhaps what i'm trying to do is already possible.
Thank you,
Steven