Trigger Builds
In the previous lab we created a build in APL using the blue
repo in Gitea. In this lab we'll create a build for the green
repo and trigger the build based on a webhook.
Create a build in APL with Trigger enabled
-
In the left menu, click on
Builds
. -
Click on
Create Build
. -
Fill in the name
green
for your build. -
Choose
./Dockerfile
and fill in the repo URL for thegreen
repo created in the previous lab:https://gitea.<your-domain>/<gitea-username>/green
. -
Enable
Trigger
. -
Click
Submit
. -
Click
Deploy Changes
.
Get the webhook URL
Before we can configure the webhook for the green
repo in Gitea, we will need the webhook URL. You can find this webhook URL for your build in the list of Builds. Add the webhook URL to your clipboard.
Also notice that the status of the Build shows an exclamation mark. This is because APL created the Pipeline, but the PipelineRun is not yet created because it was not triggered yet.
Create a Webhook
-
In APL Console, click on
apps
the left menu and then openGitea
. -
In the top menu of Gitea, click on
Explore
and then on thegreen
repo. -
Go to
Settings
(top right) and then toWebhooks
. -
Click
Add Webhook
and selectGitea
. -
In the
Target URL
, paste the webhook URL from your clipboard. -
Click
Add Webhook
.
Trigger the build
You can now trigger the build by doing a commit in the green
repo, or by testing the webhook. Let's test the webhook:
-
In Gitea, go to the
Settings
(top right) of thegreen
repo and then toWebhooks
. -
Click on the webhook we just 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 APL Console, click on
Builds
Because the Build was triggered, a PipelineRun is now running and the status of the Build will show in progress
:
When the Build is completed, the status will show healthy
:
-
In the list of Builds, 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 using a Trigger, the PipelineRun resource is created based on a template and APL 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-*
. -
You can now see the the full log of the build.