https://github.com/nextlayer-ops/jenkins-pipeline-shared-library-example
Jenkins Global Library Example with Unit tests
https://github.com/nextlayer-ops/jenkins-pipeline-shared-library-example
ci-cd jenkins-ci jenkins-global-library jenkins-pipeline jenkinsfile
Last synced: 6 months ago
JSON representation
Jenkins Global Library Example with Unit tests
- Host: GitHub
- URL: https://github.com/nextlayer-ops/jenkins-pipeline-shared-library-example
- Owner: nextlayer-ops
- Created: 2017-10-28T12:07:34.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T00:59:11.000Z (almost 8 years ago)
- Last Synced: 2025-03-24T18:52:24.732Z (7 months ago)
- Topics: ci-cd, jenkins-ci, jenkins-global-library, jenkins-pipeline, jenkinsfile
- Language: Groovy
- Homepage:
- Size: 62.5 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Jenkins Shared Library Example
This repository contains examples of a Jenkins Shared/Global Library with Unit tests.
[](https://travis-ci.org/nextlayer-ops/jenkins-pipeline-shared-library-example)
## Features
* **Gradle** for dependency management and test configuration (using [shared-libraries-gradle-plugin](https://github.com/mkobit/jenkins-pipeline-shared-libraries-gradle-plugin))
* IDE support for IntelliJ (Project detection + Auto-Completion)
* Unit tests with JenkinsPipelineUnit## Testing
Using Jenkins and writing pipeline-as-code is very powerful but can get pretty complex.
To speed up the development cycle this example uses [JenkinsPipelineUnit](https://github.com/jenkinsci/JenkinsPipelineUnit),
which lets you write unit tests on the configuration and conditional logic of the pipeline code, by providing a mock execution of the pipeline. You can mock built-in Jenkins commands, job configurations, see the stacktrace of the whole execution and even track regressions.Run the tests with the following command:
```
gradle test
```## Read more
* https://jenkins.io/doc/book/pipeline/shared-libraries/
* https://www.cloudbees.com/blog/top-10-best-practices-jenkins-pipeline-plugin
* https://github.com/jenkinsci/JenkinsPipelineUnit
* https://github.com/mkobit/jenkins-pipeline-shared-libraries-gradle-plugin