In software engineering, don't repeat yourself (DRY) is a principle of software development aimed at reducing repetition of all kinds.
The documentation with available functions can be found here.
The goal of this project is to provide useful generic functions to use with Shared Libraries feature of Jenkins Pipelines. These functions are often common to many pipelines causing code replication. With this grouping of functions it is possible to eliminate duplications by making pipeline files simpler and leaner. See the example below. (Both produce the same result)
Jenkinsfile using this project
It is necessary to import as functions of this project into your Jenkins. To do this, go to Manage Jenkins » Configure System » Global Pipeline Libraries and fill the following information.
In the default version option choose the version you want to use. This project has tags following SEMVER, you can use them to get specific versions. To always use the latest version, complete with master and the master branch will be used.
If you prefer it's not necessary check Load implicitly option. If you don't use this option it will be necessary import manually this script using the following instruction in top of the Jenkinsfile.
@Library('jenkins-dry-in-pipelines') _
If you want to use a version other than the configured version you can tell this in import.
@Library('[email protected]') _
More details can be found here.
The examples in the documentation assume that the option has been checked, so the imports are not displayed
If you have some function in your pipelines that you believe is generic enough feel free to submit a Pull Request.
In order to understand the operation of the scripts it is possible to observe the code of this project and the Jenkins Shared Libraries documentation.
Robson Bittencourt - @rluizv - [email protected]
Distributed under the MIT license. See LICENSE for more information.
https://github.com/robsonbittencourt/jenkins-dry-in-pipelines