Trigger builds
In the previous lab we created a container Image using the blue repo in Gitea. In this lab we'll create a container image using the green repo and trigger the build based on a webhook event.
Create a Container Image with create webhook listener enabled
-
In the left menu, navigate to Container Images.
-
Click the Create Container Image button.
-
Select Docker as the build task.
-
Select the green repository from the Repository drop-down list.
-
Select the Reference (branch or tag). The green repo only has one branch (
main
). -
Select Create webhook listener.
-
Click Create Container Image. A Tekton event listener is created within the App Platform and a webhook is configured for the green repo. Because the build task has not been triggered yet, the status of the container image will show a status waiting for first event.
Trigger the build
You can now trigger the build pipeline by adding a commit in the green repo, or by testing the delivery of the webhook. Let's test the delivery of the webhook:
-
In Gitea, go to the Settings (top right) of the green repo and then navigate to Webhooks.
-
Click on the webhook that has been created.
-
In the bottom, click on Test Delivery.
Check the status of the build
The build should now have started. Based on the webhook, Tekton has now created a PipelineRun
. Let's check the status of the PipelineRun:
-
In the Console, click on Container Images. Because the build for the green-main image was triggered, a PipelineRun is now running and the status of the Container Image will now show in progress. When the build task has completed, the status will show ready.
-
In the list of Container Images, click on the PipelineRun link of the green build.
-
Tekton Dashboard will open and show a list of all the PipelineRuns. It will show all PipelineRuns because when starting the pipeline based on a trigger event, the Tekton PipelineRun resource is created based on a template and the Console will not know the exact name of the PipelineRun because the name is automatically generated.
-
Click on the PipelineRun with the name
docker-trigger-build-green-main-*
. -
You can now see the the full log of the build task.
Updated 13 days ago