Extends the functionality available in the GenericPipeline class. This class adds more advanced functionality to build, test, and deploy your JavaScript/TypeScript application.
@Library('fill this out according to your setup') import org.zowe.jenkins_shared_library.pipelines.docker.DockerPipeline node('pipeline-node') { // Create the runner and pass the methods available to the workflow script to the runner DockerPipeline pipeline = new DockerPipeline(this) // Set your config up before calling setup pipeline.admins.add("userid1", "userid2", "userid3") // We have extra branches which can perform release. pipeline.branches.addMap([ // Please note the "releaseTag" can be separated by comma, if you want // to publish the docker image with multiple tags. [name: "special-branch", allowRelease: true, allowFormalRelease: true, isProtected: true, releaseTag: "special-tag"] ]) // MUST BE CALLED FIRST pipeline.setup( // Define the git configuration github: [ email: 'robot-user@example.com', usernamePasswordCredential: 'robot-user' ], // Define docker registry registry: [ url: 'https://registry.my-docker-server.com', usernamePasswordCredential: 'docker-user' ] ) // Create custom stages for your build like this pipeline.createStage(name: 'Some Stage", stage: { echo "This is my stage" }) // Run a build pipeline.build() // Provide required parameters in your pipeline // publish image to Docker registry pipeline.publish() // Provide required parameters in your pipeline // MUST BE CALLED LAST pipeline.end() }
In the example above, the stages will run on a node labeled 'pipeline-node'
. You must
define the node where your pipeline will execute. This node must have the ability to execute an
Expect Script.
Fields inherited from class | Fields |
---|---|
class org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline |
__$stMC, __$stMC |
class org.zowe.jenkins_shared_library.pipelines.base.Pipeline |
__$stMC |
Constructor and description |
---|
DockerPipeline
(java.lang.Object steps) Constructs the class. |
Type Params | Return Type | Name and description |
---|---|---|
|
protected void |
build(java.util.Map arguments = [:]) Pseudo build method, should be overridden by inherited classes |
|
void |
buildDocker(DockerBuildArguments arguments) Creates a stage that will build a DockerPipeline package. |
|
void |
buildDocker(java.util.Map arguments = [:]) Creates a stage that will build a DockerPipeline package. |
|
protected void |
bumpVersion() This method overrides and perform version bump on Dockerfile. |
|
protected void |
defineDefaultBranches() Setup default branch settings |
|
protected void |
publish(java.util.Map arguments = [:]) Pseudo publish method, should be overridden by inherited classes |
|
protected void |
publishDocker(DockerPublishArguments arguments) Publish a Docker image. |
|
void |
publishDocker(java.util.Map arguments = [:]) Publish a Docker image. |
|
protected void |
setup(java.util.Map arguments = [:]) Pseudo setup method, should be overridden by inherited classes |
|
void |
setupDocker(DockerSetupArguments arguments) Calls org.zowe.jenkins_shared_library.pipelines.docker.DockerPipeline#setupDocker() to setup the build. |
|
void |
setupDocker(java.util.Map arguments = [:]) Initialize the pipeline. |
Methods inherited from class | Name |
---|---|
class org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline |
org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#isReleaseBranch(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#isReleaseBranch(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#isFormalReleaseBranch(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#isFormalReleaseBranch(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#isPerformingRelease(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getPreReleaseString(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getBranchTag(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getBranchTag(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setupGeneric(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setupGeneric(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setupGeneric(org.zowe.jenkins_shared_library.pipelines.generic.arguments.GenericSetupStageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#endGeneric(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#endGeneric(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#buildGeneric(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#buildGeneric(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#buildGeneric(org.zowe.jenkins_shared_library.pipelines.generic.arguments.BuildStageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#testGeneric(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#testGeneric(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#testGeneric(org.zowe.jenkins_shared_library.pipelines.generic.arguments.TestStageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#sonarScanGeneric(org.zowe.jenkins_shared_library.pipelines.generic.arguments.SonarScanStageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#sonarScanGeneric(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#sonarScanGeneric(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#packagingGeneric(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#packagingGeneric(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#packagingGeneric(org.zowe.jenkins_shared_library.pipelines.generic.arguments.PackagingStageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getPublishTargetPath(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getPublishTargetPath(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#publishGeneric(org.zowe.jenkins_shared_library.pipelines.generic.arguments.PublishStageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#publishGeneric(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#publishGeneric(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#uploadArtifacts(java.util.List), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#uploadArtifacts(java.util.List, java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#releaseGeneric(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#releaseGeneric(org.zowe.jenkins_shared_library.pipelines.generic.arguments.ReleaseStageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#releaseGeneric(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getBranches(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setBranches(org.zowe.jenkins_shared_library.pipelines.base.Branches), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getChangeInfo(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setPackageInfo(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getPublishTargetVersion(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setPublishTargetVersion(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getArtifactoryUploadTargetPath(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setArtifactoryUploadTargetPath(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getArtifactoryUploadTargetFile(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setArtifactoryUploadTargetFile(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getGithub(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setGithub(org.zowe.jenkins_shared_library.scm.GitHub), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getGithubTagPrefix(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setGithubTagPrefix(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getArtifactory(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setArtifactory(org.zowe.jenkins_shared_library.artifact.JFrogArtifactory), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getPax(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setPax(org.zowe.jenkins_shared_library.package.Pax), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$endBase(org.zowe.jenkins_shared_library.pipelines.base.arguments.EndArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$endBase(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$endBase(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$$getStaticMetaClass(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$setupBase(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$setupBase(org.zowe.jenkins_shared_library.pipelines.base.arguments.SetupStageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$setupBase(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$setBranches(org.zowe.jenkins_shared_library.pipelines.base.Branches), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$getBranches(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$end(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$end(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$setup(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$setup(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#super$2$defineDefaultBranches(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setManifest(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getPackageInfo(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getManifest(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getSteps(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setSteps(java.lang.Object), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setupBase(org.zowe.jenkins_shared_library.pipelines.base.arguments.SetupStageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setupBase(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setupBase(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#createStage(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#createStage(org.zowe.jenkins_shared_library.pipelines.base.arguments.StageArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#addBuildParameter(java.lang.Object), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#addBuildOption(java.lang.Object), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#addBuildParameters([Lorg.jenkinsci.plugins.structs.describable.UninstantiatedDescribable;), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#addBuildParameters(java.util.List), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#addUpstreams([Ljava.lang.String;), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getFirstFailingStage(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getAdmins(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getBuildOptions(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setBuildOptions(java.util.List), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getBuildParameters(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setBuildParameters(java.util.List), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getBuildUpstreams(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setBuildUpstreams(java.util.List), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setVersion(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#endBase(org.zowe.jenkins_shared_library.pipelines.base.arguments.EndArguments), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#endBase(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#endBase(java.util.Map), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getStage(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setPackageName(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setBaseDirectory(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getVersion(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#invokeMethod(java.lang.String, java.lang.Object), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getMetaClass(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setMetaClass(groovy.lang.MetaClass), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setResult(org.zowe.jenkins_shared_library.pipelines.base.enums.ResultEnum), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getBaseDirectory(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#setProperty(java.lang.String, java.lang.Object), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getProperty(java.lang.String), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getPackageName(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#wait(long, int), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#wait(long), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#wait(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#equals(java.lang.Object), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#toString(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#hashCode(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#getClass(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#notify(), org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#notifyAll() |
class org.zowe.jenkins_shared_library.pipelines.base.Pipeline |
org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getSteps(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setSteps(java.lang.Object), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setupBase(org.zowe.jenkins_shared_library.pipelines.base.arguments.SetupStageArguments), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setupBase(java.util.Map), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setupBase(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getBranches(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setBranches(org.zowe.jenkins_shared_library.pipelines.base.Branches), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#createStage(java.util.Map), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#createStage(org.zowe.jenkins_shared_library.pipelines.base.arguments.StageArguments), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#addBuildParameter(java.lang.Object), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#addBuildOption(java.lang.Object), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#addBuildParameters([Lorg.jenkinsci.plugins.structs.describable.UninstantiatedDescribable;), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#addBuildParameters(java.util.List), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#addUpstreams([Ljava.lang.String;), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getFirstFailingStage(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getAdmins(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getBuildOptions(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setBuildOptions(java.util.List), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getBuildParameters(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setBuildParameters(java.util.List), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getBuildUpstreams(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setBuildUpstreams(java.util.List), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setVersion(java.lang.String), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#endBase(org.zowe.jenkins_shared_library.pipelines.base.arguments.EndArguments), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#endBase(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#endBase(java.util.Map), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getStage(java.lang.String), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setPackageName(java.lang.String), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setBaseDirectory(java.lang.String), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getVersion(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#invokeMethod(java.lang.String, java.lang.Object), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getMetaClass(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setMetaClass(groovy.lang.MetaClass), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setResult(org.zowe.jenkins_shared_library.pipelines.base.enums.ResultEnum), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getBaseDirectory(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#setProperty(java.lang.String, java.lang.Object), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getProperty(java.lang.String), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getPackageName(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#wait(long, int), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#wait(long), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#wait(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#equals(java.lang.Object), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#toString(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#hashCode(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#getClass(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#notify(), org.zowe.jenkins_shared_library.pipelines.base.Pipeline#notifyAll() |
A map of branches.
Registry for publishing docker images
Constructs the class.
When invoking from a Jenkins pipeline script, the DockerPipeline must be passed the current environment of the Jenkinsfile to have access to the steps.
def pipeline = new DockerPipeline(this)
steps
- The workflow steps object provided by the Jenkins pipelinePseudo build method, should be overridden by inherited classes
arguments
- A map of arguments to be applied to the BuildStageArguments used to define
the stage.Creates a stage that will build a DockerPipeline package.
Arguments passed to this function will map to the org.zowe.jenkins_shared_library.pipelines.docker.arguments.DockerBuildArguments class.
The stage will be created with the org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#buildGeneric(java.util.Map) method and will have the following additional operations.
registry.build
.arguments
- A map of arguments to be applied to the org.zowe.jenkins_shared_library.pipelines.docker.arguments.DockerBuildArguments used to define
the stage.Creates a stage that will build a DockerPipeline package.
arguments
- A map that can be instantiated as org.zowe.jenkins_shared_library.pipelines.docker.arguments.DockerBuildArgumentsThis method overrides and perform version bump on Dockerfile.
By default, the version
LABEL defined in Dockerfile
will be bumped with patch level.
Setup default branch settings
Pseudo publish method, should be overridden by inherited classes
arguments
- The arguments for the publish step. arguments.operation
must be
provided.Publish a Docker image.
Default behavior of publish stage:
snapshot
.version-pre-release-string
. For example, v1.2.3-RC1
."v1"
"v1.2"
and "v1.2.3"
.Arguments passed to this function will map to the org.zowe.jenkins_shared_library.pipelines.generic.arguments.PublishStageArguments class.
The stage will be created with the org.zowe.jenkins_shared_library.pipelines.generic.GenericPipeline#publishGeneric(java.util.Map) method and will have the following additional operations:
docker push
with defined releaseTag of the branch.arguments
- A map of arguments to be applied to the org.zowe.jenkins_shared_library.pipelines.generic.arguments.PublishStageArguments used to define
the stage.Publish a Docker image.
arguments
- A map that can be instantiated as org.zowe.jenkins_shared_library.pipelines.docker.arguments.DockerPublishArgumentsPseudo setup method, should be overridden by inherited classes
arguments
- A map that can be instantiated as org.zowe.jenkins_shared_library.pipelines.docker.arguments.DockerSetupArgumentsCalls org.zowe.jenkins_shared_library.pipelines.docker.DockerPipeline#setupDocker() to setup the build.
This method adds extra initialization steps to the default setup "Init Generic Pipeline" stage. The initialization will try to run #init() on the Docker Registry instance if a registry is defined.
Initialize the pipeline.
arguments
- A map that can be instantiated as org.zowe.jenkins_shared_library.pipelines.docker.arguments.DockerSetupArgumentsGroovy Documentation