Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/openshift-pipelines/setup-tektoncd

GitHub Action to rollout Tekton Pipeline and auxiliary components
https://github.com/openshift-pipelines/setup-tektoncd

actions pipeline tektoncd

Last synced: 13 days ago
JSON representation

GitHub Action to rollout Tekton Pipeline and auxiliary components

Awesome Lists containing this project

README

        

[![use-action][useActionWorkflowBadge]][useActionWorkflow]

`setup-tektoncd`
----------------

Action to rollout [Tekton Pipeline][githubTektonPipeline], [CLI (`tkn`)][githubTektonCLI] and a [Container-Registry][containerRegistry] instance, setting up the environment for testing using these components.

# GitHub Action Usage

Example usage below with inputs using default values:

```yaml
---
jobs:
setup-tektoncd:
steps:
# using KinD to provide the Kubernetes instance and kubectl
- uses: helm/[email protected]
with:
cluster_name: kind

# setting up Tekton Pipelines, CLI and additional components...
- uses: openshift-pipelines/setup-tektoncd@v1
with:
pipeline_version: latest
feature_flags: '{}'
cli_version: latest
setup_registry: "true"
patch_etc_hosts: "true"
```

The action uses the current Kubernetes instance available ([KinD][sigsKinD] for example), thus requires `kubectl` on the `${PATH}`.

## Inputs

| Input | Required | Description |
|:--------------------|:--------:|:------------------------------------------------|
| `pipeline_version` | `false` | Tekton Pipeline version |
| `feature_flags` | `false` | Tekton Pipeline feature flags (JSON) payload |
| `cli_version` | `false` | Tekton CLI (tkn) version |
| `setup_registry` | `false` | Rollout a Container-Registry (v2) |
| `patch_etc_hosts` | `false` | Add Container-Registry hostname to `/etc/hosts` |

# Components

## Tekton Pipelines

[Tekton Pipelines][githubTektonPipeline] is deployed on the namespace `tekton-pipelines` and the involved deployments are followed until completion, so the setup process waits until the instances are available and in case of error the workflow is interrupted.

### Feature-Flags

Tekton Pipelines exposes [feature-flags][githubTektonFeatureFlags] using a `ConfigMap` named `feature-flags`. These flags can be set using the the input `feature_flags`, a JSON formated string containing the the respective flags and values. For example:

```yaml
---
jobs:
setup-tektoncd:
steps:
- uses: openshift-pipelines/setup-tektoncd@v1
with:
feature_flags: '{ "enable-custom-tasks": "true" }'
```

The result is observed on the following example:

```
$ kubectl --namespace=tekton-pipelines get configmap feature-flags --output=json |jq '.data'
{
// ...
"enable-custom-tasks": "true",
// ...
}
```

## CLI (`tkn`)

[Tekton CLI][githubTektonCLI] is installed on `/usr/local/bin` directory and uses the same Kubernetes context than `kubectl`.

## Container-Registry

A [Container-Registry][containerRegistry] instance is deployed on the `registry` namespace using the same rollout approach than Tekton Pipelines.

The registry is available on port `32222` and uses the Kubernetes internal service hostname, `registry.registry.svc.cluster.local`, which means the fully qualified container images (plus tag) will look like the example below:

```text
registry.registry.svc.cluster.local:32222/namespace/project:tag
```

The registry does not require authentication, uses HTTP protocol, is available outside of the Kubernetes instance as well. The Action Input `patch_etc_hosts` makes the registry hostname resolve to `127.0.0.1` and the service exposes the port `32222` as a `hostPort` too.

# Scripts

Alternatively, you can run the scripts directly to rollout Tekton Pipelines and the other components, the recommended approach is using a `.env` file with the required [inputs](./inputs.sh).

```bash
cat >.env <