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 taskRef and 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), array or object, default, description). The default value of an array param is a comma-separated list, the one of an object param comma-separated key=value pairs. An object param declares its keys using properties (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: QUARKUS_TEKTON_PIPELINERUN_ENABLED

boolean

true

User’s arguments to customize the pipeline

Environment variable: QUARKUS_TEKTON_PIPELINERUN_PARAMS__PARAMS_

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 dockerconfig-secret workspace of the PipelineRun.

Environment variable: QUARKUS_TEKTON_PIPELINERUN_REGISTRY_AUTH_SECRET

string

dockerconfig-secret

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 ssl-ca-directory workspace of the PipelineRun. The name of the certificate file within the ConfigMap is defined using the pipeline parameter crtFileName (default: ca-bundle.crt).

Environment variable: QUARKUS_TEKTON_PIPELINERUN_SSL_CA_CONFIG_MAP

string

Whether to enable tekton generation at build time.

Environment variable: QUARKUS_TEKTON_GENERATION_ENABLED

boolean

true

Enable the Tekton DevService.

Environment variable: QUARKUS_TEKTON_DEVSERVICES_ENABLED

boolean

true

Enable the debugging level.

Environment variable: QUARKUS_TEKTON_DEVSERVICES_DEBUG_ENABLED

boolean

false

If logs should be shown from the Tekton container.

Environment variable: QUARKUS_TEKTON_DEVSERVICES_SHOW_LOGS

boolean

false

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: QUARKUS_TEKTON_DEVSERVICES_VERSION

string

v0.68.0

The Tekton controller namespace where Tekton stuffs are deployed The default namespace is: tekton-pipelines

Environment variable: QUARKUS_TEKTON_DEVSERVICES_CONTROLLER_NAMESPACE

string

tekton-pipelines

Time to wait till a resource is ready: pod, etc The default value is: 180 seconds

Environment variable: QUARKUS_TEKTON_DEVSERVICES_TIME_OUT

long

360

The cluster type to be used: kind or k3 The default value is: kind

Environment variable: QUARKUS_TEKTON_DEVSERVICES_CLUSTER_TYPE

string

kind

The hostname of the tekton ingress route

Environment variable: QUARKUS_TEKTON_DEVSERVICES_HOST_NAME

string

tekton.localtest.me

The host port to be used on the host machine to access the dashboard

Environment variable: QUARKUS_TEKTON_DEVSERVICES_HOST_PORT

string

9097

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: QUARKUS_TEKTON_DEVSERVICES_INGRESS_VERSION

string

latest

Enable to forward the ingress traffic from the container to the local host

Environment variable: QUARKUS_TEKTON_DEVSERVICES_INGRESS_PORT_FORWARD_ENABLED

boolean

true

Description of the task.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__DESCRIPTION

string

Image of the step running the task.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__IMAGE

string

required

Script executed by the step. Cannot be used with command.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__SCRIPT

string

Command executed by the step (e.g. sh,-c). Cannot be used with script.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__COMMAND

list of string

Arguments passed to the command or script of the step.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__ARGS

list of string

Working directory of the step (e.g. $(workspaces.project-dir.path)).

Environment variable: QUARKUS_TEKTON_TASK__TASKS__WORKING_DIR

string

Environment variables of the step.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__ENV__ENV_

Map<String,String>

Type of the param: string, array or object.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__PARAM__PARAM__TYPE

string

string

Default value of the param. A comma-separated list for an array param, comma-separated key=value pairs for an object param.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__PARAM__PARAM__DEFAULT

string

Description of the param.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__PARAM__PARAM__DESCRIPTION

string

Properties (keys) of an object param. When not set, the keys of the default value are used.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__PARAM__PARAM__PROPERTIES

list of string

Path where the workspace is mounted (default: /workspace/).

Environment variable: QUARKUS_TEKTON_TASK__TASKS__WORKSPACE__WORKSPACE__MOUNT_PATH

string

Whether the workspace is optional.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__WORKSPACE__WORKSPACE__OPTIONAL

boolean

false

Description of the workspace.

Environment variable: QUARKUS_TEKTON_TASK__TASKS__WORKSPACE__WORKSPACE__DESCRIPTION

string