Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42327

Add support for defining declarative pipeline templates in shared libraries

XMLWordPrintable

      With the 1.0 release of model definition, we are defining the entire pipeline job as code. However, there is no standard as far as I am aware for sharing multiple Jenkinsfile(s) in an organization in git repository. There is definitely a use case for this, along with existing examples.

      This would be a logical extension for shared libraries and the directory structure perhaps by adding a 'pipelines/' folder. These could appear in a drop down when creating a pipeline job (not multibranch). One way would be to have a 'Pipeline Script from Library' option similar to the 'Pipeline Script from SCM' option.

      A future extension could be to automatically generate Jenkins jobs from pipelines in a library. Right now, this can be done using the CLI as used in this github project.

      1) Create a template pipeline XML with the Git repo and the pipeline definition file paths embedded.

      2) Import as a pipeline job:

      java -jar jenkins-cli.jar -s http://localhost:8080 create-job pipeline < pipeline.xml

            abayer Andrew Bayer
            colourmeamused Abir M
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: