Defining and creating pipeline resources

PipelineResources are artifacts that are used as inputs to a Task and can be output by a Task.

Procedure

After you create Task s, create PipelineResources that contain the specifics of the Git repository and the image registry to be used in the Pipeline during execution as follows:

  1. Create a PipelineResource YAML file with a PipelineResource that defines the Git repository and reference for the PetClinic application as follows:

    apiVersion: tekton.dev/v1alpha1
    kind: PipelineResource
    metadata:
      name: petclinic-git
    spec:
      type: git
      params:
      - name: url
        value: https://github.com/spring-projects/spring-petclinic
  2. Add another PipelineResource, which defines the OpenShift internal registry to which you want to push the PetClinic image, to the YAML file as shown below, and save it.

    apiVersion: tekton.dev/v1alpha1
    kind: PipelineResource
    metadata:
      name: petclinic-image
    spec:
      type: image
      params:
      - name: url
        value: image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/spring-petclinic
  3. Create the above pipeline resources as follows:

    $ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/master/pipeline/02-resources.yaml
  4. Verify the resources created as follows:

    $ tkn resource ls
    
    NAME              TYPE    DETAILS
    petclinic-git     git     url: https://github.com/spring-projects/spring-petclinic
    petclinic-image   image   url: image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/spring-petclinic