Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing some Job DSL support #3

Closed
wants to merge 5 commits into from
Closed

Introducing some Job DSL support #3

wants to merge 5 commits into from

Conversation

Cervator
Copy link
Owner

What does this PR do?

Adds support for the Job DSL plugin's approach to automatically configure jobs

When the Jenkins master is started now a seed-job automagically appears, runs, then creates several additional jobs that in turn also start running not long after (may want to enter shutdown mode to just observe them queuing up)

The seed job does actually fail then, as the 5th example demonstrates how to include external code which a later Script Security plugin integration seems to have broken. There's even an outright option to disable it for Job DSL in the config but it doesn't seem to work ...

The DSL has nice formatting in IntelliJ at least, although exactly how far it goes is up for debate. Syntax highlighting for everything else isn't always working, the DslScriptLoader class in an init script doesn't connect right yet IntelliJ knows what it is.

Why did you take this approach?

MOAR AUTOMATION!

Contribution checklist

  • THERE ARE NO UNENCRYPTED SECRETS HERE
  • The branch is named something meaningful
  • The branch is rebased off of current master (well, a thing that is)
  • There is a single commit (or very few smaller ones) with a Good commit message that includes the issue if there was one
  • You have tested this locally yourself

A picture of a cute animal (optional)

@Cervator
Copy link
Owner Author

Updates added:

  • Moved the seed job DSL script into the init scripts dir. With the added extension .DSL it doesn't get run as an actual init script, and the extension doesn't hurt its usage as a DSL script
  • Made running the seed job DSL optional based on the presence of an environment variable pointing to a desired Git repo containing the actual DSL scripts

The seed job itself is somewhat of a weird hybrid between init and DSL. Keeping it with the init scripts but letting it be externally configurable leaves a nice clean separate DSL home for the true jobs that matter.

Chances are some actual DSL scripts will be included with the workspace sooner or later, even as a nested Git root.

@Cervator
Copy link
Owner Author

One more update: A second seed job now targets a local path with a single DSL script that creates a restart job. Could probably be tidied up a bit more

@Cervator Cervator closed this Mar 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant