Pipelines Questions

Questions on how to use Serverless Jenkins X Pipelines

For more background see the guide on Serverless Jenkins X Pipelines using Tekton. There is also the Jenkins X Pipelines Syntax Reference

How do I add a custom step?

To add a new custom step to your jenkins-x.yml file see how to use the jx create step

How do Jenkins X Pipelines compare to Jenkins pipelines?

See the differences between Jenkins X and Jenkins Pipelines

How do I get IDE completion editing jenkins-x.yml

See the IDE guide for IDEA and VS Code

What environment variables are available by default inside a pipeline?

See the default environment variables created for pipeline steps

Is there a reference for the syntax?

See the Jenkins X Pipelines Syntax Reference

How do I mount a Secret or ConfigMap?

Each step in a Jenkins X Pipeline in the jenkins-x.yml file is basically a Container from kubernetes so you can specify the image, resource limitts, environment variables and mount them from a ConfigMap or Secret

You can see an example of mounting a Secrett to an environment variable here

If you are inside a shell script you can also use the jx step credential

Can I mount a Persistent Volume in my pipeline?

Tekton already mounts a separate Persistent Volume for each build pod at /workspace so the build results are kept around for a while until they are garbage collected.

On most kubernetes clusters you cannot easily share a single Persistent Volume across multiple pods; so having a shared PV across builds isn’t generally easy or compatible. You can however add a step to populate your PV on startup from a cloud bucket and at the end of a pipeline copy data into a bucket to speed up caching.

You can also do things like use Nexus as a network cache for fetching maven dependencies (which happens OOTB with Maven builds in Jenkins X) or add the Athens proxy for Go.

Hopefully the Tekton community will figure out some even better caching solutions to speed up builds.

How do I define an environment variable inside a step for other steps to use?

Files are the easiest approach as the /workspace directory is shared with all steps. So write in one step and use the value from other steps etc.

The other option is mounting a ConfigMap as environment variables into each step and modifying that on one step; but files are easier really.

Last modified October 22, 2019: release 0.0.1167 (242139c)