项目作者: wcm-io-devops

项目描述 :
wcm.io Jenkins Pipeline Library for CI/CD
高级语言: Groovy
项目地址: git://github.com/wcm-io-devops/jenkins-pipeline-library.git
创建时间: 2017-11-29T13:32:20Z
项目社区:https://github.com/wcm-io-devops/jenkins-pipeline-library

开源协议:Apache License 2.0

下载


Build
Maven Central
Sonatype Snapshots

:information_source: Unmaintained

This project is currently not maintained.

Jenkins Pipeline Library

Since Jenkins Pipeline has reached a certain state of production scripted
pipelines are the way to go.

But: Not everything known from the UI is available in Pipeline and
configuring and writing scripts is not so easy for the normal developer.

The target of this library is to take out some complexity (and yes
adding some too) of the pipeline creation and to bring back some known
functionality (for example GIT_BRANCH and SCM_URL environment
variables, mail notification on still unstable etc.)

Want to see an example? Have look at
Usage examples

Table of contents

Key concepts

The pipeline library was developed with a focus to ease Java and Maven
build processes within companies which have a more or less similiar
project structure e.g.

  • Maven/Java
  • local Artifact Server (like Sonatype Nexus or Artifactory)
  • GIT

The assumption is that in these environments

  • Jenkins has a dedicated user account to checkout code (or one per project)
  • the artifact server caches public artifacts and acts as a internal
    artifact server

:question: So why configure maven repositories and scm credentials in
every pipeline?

So the key concepts of the pipeline enable you to

  • Auto provide credentials (no worries, only Jenkins credential ids, not
    the credential itself) (see Credentials)
  • Auto provide maven settings (see ManagedFiles)
  • configure each job the same way (see ConfigStructure)
  • log and see the things you are interested in (see Logging)

to builds.

Running this pipeline library will result in more structured and easier
to maintain pipeline scripts.

Configured properly this library enables you to checkout scm
with these lines of code:

  1. import static io.wcm.devops.jenkins.pipeline.utils.ConfigConstants.*
  2. checkoutScm( (SCM) : [
  3. (SCM_URL) : "git@domain.tld/group/project.git",
  4. ]
  5. )

Or running maven with local and global maven settings with these lines
of code:

  1. import static io.wcm.devops.jenkins.pipeline.utils.ConfigConstants.*
  2. execMaven(
  3. (SCM) : [
  4. (SCM_URL) : "git@domain.tld/group/project.git",
  5. ],
  6. (MAVEN): [
  7. (MAVEN_GOALS) : [ "clean", "install" ]
  8. ]
  9. )

:question: Looking for an example on how a pipeline script looks like
when using Pipeline? Have a look at
Usage examples

:bulb: Have a look at the setup tutorial to
start using Pipeline Library.

Requirements

Have a look at requirements to get the library running.

Steps

The pipeline library comes with the following steps:

Utilities

Credential and managed file auto lookup

Support for command line execution

Setup your environment to use the pipeline library

Please refer to SetupTutorial for detailed
instruction on how to setup the library in your environment.

Building/Testing

The library uses two approaches for testing.

The class parts are tested by unit testing using JUnit/Surefire. All
unit tests have the naming format *Test.groovy and are located below
test/io.

The step parts are tested by using
Jenkins Pipeline Unit
with jUnit/Failsafe. All integration tests have the naming format
*IT.groovy and are located below test/vars.

Building with maven

  1. mvn clean install

Add license file headers

  1. mvn license:update-file-header

Changes / Version History

Please have a look at the Releases