Quarkus Tekton
| Describe what the extension does here. |
Installation
If you want to use this extension, you need to add the io.quarkiverse.quarkus:quarkus-tekton extension first to your build file.
For instance, with Maven, add the following dependency to your POM file:
<dependency>
<groupId>io.quarkiverse.quarkus</groupId>
<artifactId>quarkus-tekton</artifactId>
<version>0.0.3</version>
</dependency>
CLI
The extension provides a plugin for the Quarkus CLI to generate, install and execute the Tekton resources of your project.
To register the plugin:
quarkus plug add io.quarkiverse.tekton:quarkus-tekton-cli:0.0.3
From the root of your Quarkus project, you can then:
# Generate the Tekton resources under .tekton/ (tekton.yml and tekton.json)
quarkus tekton generate
# List, install or uninstall the tasks of the project
quarkus tekton task list
quarkus tekton task install --all
# List, install or uninstall the pipelines of the project
quarkus tekton pipeline list
quarkus tekton pipeline install build-test-push
# Execute a pipeline
quarkus tekton pipeline exec build-test-push url=https://github.com/org/my-app.git output-image=quay.io/org/my-app
Generate a pipeline of tasks
You can create your own pipeline from the tasks of the project using the pipeline generate command.
The tasks are executed sequentially, following the order in which they are passed:
quarkus tekton pipeline generate my-pipeline --task git-clone,maven,buildah
The generated pipeline:
-
references each task using
taskRefand runs it after the previous one (runAfter), -
exposes the params of the tasks as pipeline params (with their type, description and default value). When two tasks declare a param having the same name but a different type, the param of the latter is prefixed with the name of its task (
<task>-<param>), -
exposes the workspaces of the tasks as pipeline workspaces. A workspace is optional only if all the tasks using it declare it as optional.
The pipeline is printed on the console and added to the .tekton/tekton.yml and .tekton/tekton.json files (replacing a pipeline having the same name), so it can be installed and executed:
quarkus tekton pipeline install my-pipeline
Options:
-
-t, --task: name of the task(s) to run, in order. Can be repeated or comma separated. -
-r, --regenerate: regenerate the resources of the project before generating the pipeline. -
--tekton-output-dir: the directory containing the Tekton resources (default:.tekton).
Running quarkus tekton generate (or using --regenerate) recreates the .tekton files. A pipeline generated previously must then be generated again.
|
Custom tasks
Besides the tasks provided by the extension (ls, rm, git-clone, maven and buildah), you can declare your own tasks in the application.properties file using the quarkus.tekton.task.<name> properties.
They are generated with the other Tekton resources, so they are kept when running quarkus tekton generate:
quarkus.tekton.task.hello.description=Say hello
quarkus.tekton.task.hello.image=registry.access.redhat.com/ubi9/ubi-minimal
quarkus.tekton.task.hello.script=echo "Hello $(params.who) from $GREETING_ENV"
quarkus.tekton.task.hello.env.GREETING_ENV=tekton
quarkus.tekton.task.hello.param.who.default=world
quarkus.tekton.task.hello.param.who.description=Who to greet
quarkus.tekton.task.hello.workspace.project-dir.optional=true
quarkus.tekton.task.hello.working-dir=$(workspaces.project-dir.path)
A task runs a single step, which executes either a script or a command (with optional args) using the given image. It can declare:
-
env.<name>: the environment variables of the step, -
param.<name>.*: the params of the task (type:string(default),arrayorobject,default,description). The default value of anarrayparam is a comma-separated list, the one of anobjectparam comma-separatedkey=valuepairs. Anobjectparam declares its keys usingproperties(e.g.app,tier) or, when not set, the keys of its default value, -
workspace.<name>.*: the workspaces of the task (mount-path,optional,description).
The task can then be used, like the provided ones, to generate a pipeline:
quarkus tekton generate
quarkus tekton task install hello
quarkus tekton pipeline generate demo --task git-clone,hello
quarkus tekton pipeline install demo
A custom task having the same name as a provided task replaces it (a warning is logged during the build).
An invalid task (e.g. declaring both a script and a command) fails the build.
See the Extension Configuration Reference for all the quarkus.tekton.task properties.
Git server or registry using a self-signed certificate
When the git repository is hosted on a server using a self-signed certificate, the git-clone task fails with SSL certificate problem: self-signed certificate.
To verify the certificate, create a ConfigMap containing the CA certificate on the cluster:
kubectl create configmap git-ca-bundle --from-file=ca-bundle.crt=/path/to/ca.crt
and declare it using the following property. The ConfigMap is then bound to the ssl-ca-directory workspace of the PipelineRun:
quarkus.tekton.pipelinerun.ssl-ca-config-map=git-ca-bundle
# Optional: name of the certificate file within the ConfigMap (default: ca-bundle.crt)
quarkus.tekton.pipelinerun.params.crtFileName=ca-bundle.crt
Alternatively, the TLS verification can be disabled using the pipeline parameter sslVerify=false, which is not advised.
|
Extension Configuration Reference
| Remove this section if you don’t have Quarkus configuration properties in your extension. |
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Configuration property |
Type |
Default |
|---|---|---|
Whether to enable the tekton generation at build time of the PipelineRun. Environment variable: |
boolean |
|
User’s arguments to customize the pipeline Environment variable: |
Map<String,String> |
|
Name of the Secret, expected to exist on the cluster, containing the registry auth file (config.json) which is bound to the Environment variable: |
string |
|
Name of the ConfigMap, expected to exist on the cluster, containing the CA certificate(s) used to verify the TLS certificate of the git server and the image registry (e.g. a self-signed certificate). When set, the ConfigMap is bound to the Environment variable: |
string |
|
Whether to enable tekton generation at build time. Environment variable: |
boolean |
|
Enable the Tekton DevService. Environment variable: |
boolean |
|
Enable the debugging level. Environment variable: |
boolean |
|
If logs should be shown from the Tekton container. Environment variable: |
boolean |
|
The version of Tekton to be installed from the GitHub repository and which corresponds to a tagged release expressed as such: "v0.68.0" Environment variable: |
string |
|
The Tekton controller namespace where Tekton stuffs are deployed The default namespace is: tekton-pipelines Environment variable: |
string |
|
Time to wait till a resource is ready: pod, etc The default value is: 180 seconds Environment variable: |
long |
|
The cluster type to be used: kind or k3 The default value is: kind Environment variable: |
string |
|
The hostname of the tekton ingress route Environment variable: |
string |
|
The host port to be used on the host machine to access the dashboard Environment variable: |
string |
|
The version of the Ingress controller to be installed from the GitHub repository If not specified, it will use the resources published on main branch The version to be used should be specified using the tagged release: v1.12.0, etc Environment variable: |
string |
|
Enable to forward the ingress traffic from the container to the local host Environment variable: |
boolean |
|
Description of the task. Environment variable: |
string |
|
Image of the step running the task. Environment variable: |
string |
required |
Script executed by the step. Cannot be used with Environment variable: |
string |
|
Command executed by the step (e.g. Environment variable: |
list of string |
|
Arguments passed to the command or script of the step. Environment variable: |
list of string |
|
Working directory of the step (e.g. Environment variable: |
string |
|
Environment variables of the step. Environment variable: |
Map<String,String> |
|
Type of the param: Environment variable: |
string |
|
Default value of the param. A comma-separated list for an Environment variable: |
string |
|
Description of the param. Environment variable: |
string |
|
Properties (keys) of an Environment variable: |
list of string |
|
Path where the workspace is mounted (default: Environment variable: |
string |
|
Whether the workspace is optional. Environment variable: |
boolean |
|
Description of the workspace. Environment variable: |
string |