Skip to content

robsonbittencourt/jenkins-dry-in-pipelines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenkins DRY in Pipelines

In software engineering, don't repeat yourself (DRY) is a principle of software development aimed at reducing repetition of all kinds.

Documentantion

The documentation with available functions can be found here.

Goal

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)

Normal Jenkinsfile compare

Jenkinsfile using this project compare

How to use

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.

global-pipeline-config

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

Contributing

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.

Meta

Robson Bittencourt - @rluizv - [email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/robsonbittencourt/jenkins-dry-in-pipelines

About

Some useful generic funcions to use with Shared Libraries feature of Jenkins Pipelines

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages