1
votes

At the moment, we are generating Jenkins jobs using the Job DSL plugin. Typically, we have the following jobs per project:

  • CI build (SNAPSHOT build)
  • Deployment, one per stage
  • Integration test (nightly build)
  • Creation of a release
  • Reports (Maven site, during the night)

Am I right that there can be only one Jenkins file in the project's repository? How could I map our requirements to the new Jenkins pipeline?

I'm asking because we're going to install version 2 of Jenkins, and I'm not sure whether we should abandon our Jenkins job generation and use Jenkins files.

1
yes, given plentiful time, you should use declarative pipeline Jenkinsfiles. we model a pipeline very similar to yours using the same (just one Jenkinsfile), and each of those bullet points are in a different stage.burnettk

1 Answers

1
votes

There are a couple of options, which might help you to migrate over to Jenkins pipelines. But you don't have to, especially not all at once.

  • You can use a shared library to define functions that can be used in multiple jobs, e.g. a buildOurThing function.
  • You can trigger an existing job (of whatever kind) using the build step. So you could model your new pipeline around existing jobs.
  • You can still use parameterized builds, if you want to use the deployment job with different targets.

Jenkins pipeline is really worth using, but maybe don't force you to an immediate switch. If JobDSL works for you, keep it. If you have new jobs (pipelines) to create, get familiar with pipelines.