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, click on
Container Images
. -
Click on
CREATE CONTAINER IMAGE
. -
Select the
Docker
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
.
App Platform will now create the Tekton event listener and configure the webhook 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 doing 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 thegreen
repo and then toWebhooks
. -
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 thegreen
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.