Skip to content

Steps

Pipeline Templates represent generic software delivery workflows.

Pipeline Templates use Steps to represent tasks in that workflow.

Best Practice

It is recommended that Steps are named generically. For example, rather than npm_build() the Step should be named build().

By naming Steps generically, multiple libraries can implement the same Step. This allows teams to share the same Pipeline Template by loading different libraries via the Pipeline Configuration.

Placeholder Steps

Users can create Placeholder Steps that do nothing and serve as a no-op1 Step.

The primary purpose of these Placeholder Steps is to avoid a NoSuchMethodError being thrown when the Pipeline Template attempts to invoke a Step that hasn't been contributed by a library.

To define Placeholder Steps, use the template_methods{} block.

Example: Defining Placeholder Steps

In the following example, a Pipeline Template expects to invoke a unit_test() and a build() step.

It's expected that users will declare in their Pipeline Configurations libraries that implement these steps.

In case that's not true, the template_methods{} block has been configured to substitute Placeholder Steps to avoid an exception being thrown.

Jenkinsfile
unit_test()
build()
pipeline_config.groovy
template_methods{
  unit_test
  build
}
[Pipeline] Start of Pipeline
[JTE][Step - null/unit_test.call()]
[Pipeline] echo
Step unit_test is not implemented.
[JTE][Step - null/build.call()]
[Pipeline] echo
Step build is not implemented.
[Pipeline] End of Pipeline
Finished: SUCCESS

Library Steps

Library Steps are contributed by libraries.

Users define in the Pipeline Configuration which libraries to load, if any.

Learn More

Learn more about how to create libraries over in the Library Development section.


  1. No Operation: a command that does nothing. 

Back to top