Pipelines

Questions about using Tekton pipelines with Jenkins X

How do I diagnose a step in a pipeline?

If you are wondering what image, command, environment variables are being used in a step in the pipeline you can look at the pipelinerun or the related pod(s). If you use your favourite tool for looking in kubernetes (kubectl, k9s, …) and list the pipelineruns in the jx namespace you will proably be able to identify the one you are interested.

Looking at the details for the piplinerun will give you the details.

If that doesn’t help another option is to edit the pipeline step via the .lighthouse/jenkins-x/release.yaml or .lighthouse/jenkins-x/pullrequest.yaml file to add the command: sleep infinity in the script: value before the command that is not working.

You can then kubectl exec into the pod at that step and look around and try running commands inside the pod/container.

e.g. using the pod name from the above page and the container name you can do something like:

kubectl exec -it -c name-of-step-container name-of-pod sh

How do I access a Secret from my pipeline?

Once you have a kubernetes Secret (see how to create them) you can access then in a pipeline either:

How do I configure pipelines to use GPUs?

You can install the nvidia k8s device plugin as a daemonset to expose which nodes have GPUs and their status.

You can then view the nodes via:

kubectl get nodes "-o=custom-columns=NAME:.metadata.name,GPU:.status.allocatable.nvidia\.com/gpu"  

You can then use the resources on your tekton steps as follows:

- image: gcr.io/kaniko-project/executor:v1.3.0-debug
  name: build-my-image
  resources:
    limits:
      # This job requires an instance with 1 GPU, 4 CPUs and 16GB memory - g4dn.2xlarge
      nvidia.com/gpu: 1
  script: |
        #!/busybox/sh

How can I use a monorepo?

If you have an existing monorepo you want to import into Jenkins X you can; just be aware that you’ll have to create and maintain your own pipelines for your monorepo.

We currently have no special tekton steps to analyse git changes and conditionally run different sets of tekton steps based on what has changed.

So you may need to write your own steps to handle this nicely based on whatever kind of monorepo you have. Or you may want to look at using a tool like Bazel or some similar tool to implement your monorepo build and just invoke that from the Tekton pipeline.

You could start with the automated CI/CD pipelines that most match your technology choices and edit them to suit.

There are a few tools around that could help:

How do I configure a different branch for releases?

If you look at the postsubmits section of the trigger config in your .lighthouse/jenkins-x/triggers.yaml file you will see the post submits (which is prow/lighthouse terminology for release pipelines).

By default the branches: is setup with regular expressions for either main or master branches:

  ...
  postsubmits:
  - name: release
    context: "release"
    source: "release.yaml"
    branches:
    - ^main$
    - ^master$

Modify the branches to use a different regular expression to denote the branch(s) you wish to use to trigger a new release.