openshifttektontekton-pipelines

Tekton pipeline input: source code from local as tar file


Due to restriction on access for corporate git repository, I want to provide the source code as input (tar or zip file) to tekton. Can anyone guide me on how to achieve it.


Solution

  • The details are going to depend on how you are providing the tar/zip to your pipeline.

    But the gist is to remember that Pipeline tasks are really just containers. (Except with a bit of magic around things like arguments, sequencing, UI etc.) So asking "how do I provide source code" is essentially the same question as "how would I do this if I were doing this in a script inside a container".

    If you already have the tar/zip in a PVC, then you can just mount two workspaces (one with your input tar/zip, and one where you are outputting your source files) and execute the tar (or zip) command from the one mount point to the other. (Just make sure to use a base image that has tar in it.)

    If you don't already have the tar/zip, you might need to use scp or something like that first, but all of the principles look the same. Take a look at the YAML for the out of the box Tasks and you will see that they are actually quite simple under the covers.