Giter Site home page Giter Site logo

urs-bruelhart / config-driven-pipeline-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jenkinsci/config-driven-pipeline-plugin

0.0 1.0 0.0 110 KB

Reuse Jenkinsfiles across repositories and hydrate commands and settings with config from each repository

License: MIT License

Java 91.45% HTML 2.44% Groovy 6.11%

config-driven-pipeline-plugin's Introduction

Config-Driven Pipeline Plugin

License Jenkins Plugin GitHub release Jenkins Plugin Installs

Purpose

Would you like to share Jenkinsfile without copy-pasting in git (or other SCMs) but would also like to be able to have some variance in your Jenkinsfile (e.g. configuration values such as email address, different unit test scripts, etc...)?

If so, this is the main driver of this plugin. We desired a central git-driven repository of trusted Jenkinsfile templates which are inherently visible, can be contributed to, but also allow us the ability to centrally roll out updates and improvements to hundreds of pipelines at a time.

This plugin will select a Jenkinsfile based on config in the repository. What this means is that you can configure a whole GitHub Organization to use a Jenkinsfile repository and different repos can run different Jenkinsfiles in the central Jenkinsfile repo based on versioned configuration in the repo (no messing around with job configuration and it's all under version control). You simply point your pipeline_template to the path in the repo. This means you can switch between templates for different branches and test out new templates in PRs without having to muck around with job config.

Setup

This plugin provides you with a new Project Recognizer that you can use with any Multibranch Pipeline type such as a GitHub Organization or Multibranch Pipeline.

Config-Driven Pipeline Project Recognizer

You'll simply set the Config File Path to a location where you expect the config file to reside in the repositories (traditionally at the root of the repo).

pipeline_template

The pipeline_template configuration key is reserved for finding the Jenkinsfile template you'd like to use out of the centralized Jenkinsfile repo.

Config File Format - Most Any!

The plugin itself is only going to search for a pipeline_template key/value in your Yaml, JSON, Java property file (and likely some others). This logic is in the ConfigurationValueFinder and we'd be happy to entertain additions to expand compatibility. We recommend using the Pipeline Utility Steps Plugin to parse your config but you're free to implement and validate this however you'd like in your Jenkinsfile templates.

Config File Contents Available for Parsing!

The plugin places the contents of the config file in the PIPELINE_CONFIG environment variable so that you don't have to read the file again.

Why would I use this when I can use ${OTHER_SOLUTION}?

Shared Libraries

Shared libraries are fantastic and are a great way to be able to make your pipeline code testable. However, it was nice to compose overall stages declaratively in Jenkinsfile and simply let each repo pass in configurable values such as the unit test command, Docker container to run under, etc...

Buildpacks

Buildpacks are also awesome! However, sometimes there aren't quite the right buildpacks for your needs (and you could also use them within this ๐Ÿ˜„).

Upcoming Additions To This Repo

  • Example project configured via Job DSL Plugin
  • More configuration information
  • Other shinies
  • FAQs?

config-driven-pipeline-plugin's People

Contributors

dependabot-preview[bot] avatar justinharringa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.