Trigger Pipeline
Now that the pipeline is created, you can trigger it to execute the tasks specified in the pipeline.
First, you should create a number of PipelineResources that contain the specifics of the git repository and image registry to be used in the pipeline during execution. Expectedly, these are also reusable across multiple pipelines.
The following PipelineResource defines the git repository for the frontend application:
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: ui-repo
spec:
type: git
params:
- name: url
value: http://github.com/openshift-pipelines/vote-ui.gitAnd the following defines the OpenShift internal image registry for the frontend image to be pushed to:
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: ui-image
spec:
type: image
params:
- name: url
value: image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/vote-ui:latestAnd the following PipelineResource defines the git repository for the backend application:
And the following defines the OpenShift internal image registry for the backend image to be pushed to:
Create the above pipeline resources via the OpenShift Web Console or by running the following:
Note :-
If you are not into the
pipelines-tutorialnamespace, and using another namespace for the tutorial steps, please make sure you update the frontend and backend image resource to the correct url with your namespace name like so :
image-registry.openshift-image-registry.svc:5000/<namespace-name>/vote-api:latest
You can see the list of resources created using tkn:
A PipelineRun is how you can start a pipeline and tie it to the git and image resources that should be used for this specific invocation. You can start the pipeline using tkn:
As soon as you start the build-and-deploy pipeline, a pipelinerun will be instantiated and pods will be created to execute the tasks that are defined in the pipeline.
Above we have started build-and-deploy pipeline, with relevant pipeline resources to deploy backend/frontend application using single pipeline
Check out the logs of the pipelinerun as it runs using the tkn pipeline logs command which interactively allows you to pick the pipelinerun of your interest and inspect the logs:
After a few minutes, the pipeline should finish successfully.
Looking back at the project, you should see that the images are successfully built and deployed.

You can get the route of the application by executing the following command and access the application
If you want to re-run the pipeline again, you can use the following short-hand command to rerun the last pipelinerun again that uses the same pipeline resources and service account used in the previous pipeline run:
Whenever there is any change to your repository we need to start pipeline explicitly to see new changes to take effect
Last updated
Was this helpful?