Skip to content

Commit

Permalink
task-openshift: Auto-update tekton tasks resources\n\nURL: https://gi…
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and openshift-merge-bot[bot] committed Jun 18, 2024
1 parent 07f2aba commit 7683659
Show file tree
Hide file tree
Showing 10 changed files with 611 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tasks/task-kn-apply/0.1.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## `Kn-Apply` Tekton Task

# Abstract

The `kn-apply` deploys a given image to a Knative Service using kn command line interface.

# Usage

Please, consider the usage example below:

```yaml
---
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
name: example-taskrun
spec:
taskRef:
name: kn-apply
params:
- name: SERVICE
value: service-name
- name: IMAGE
value: image-name
```
You'll need to replace `service-name` & `image-name` with values of the Knative Service & Image to be deployed respectively.

In case the Container Registry requires authentication, please consider the [Tekton Pipelines documentation][tektonPipelineAuth]. In a nutshell, you need to create a Kubernetes Secret describing the following attributes:

```bash
kubectl create secret docker-registry imagestreams \
--docker-server="image-registry.openshift-image-registry.svc:5000" \
--docker-username="${REGISTRY_USERNAME}" \
--docker-password="${REGISTRY_TOKEN}"
```

Then make sure the Secret is linked with the Service-Account running the `TaskRun`/`PipelineRun`.

## Params

| Param | Type | Default | Description |
| :-------- | :------: | :--------- | :----------------------------------------------------------- |
| `SERVICE` | `string` | (required) | Knative Service name to which the given image is deployed to |
| `IMAGE` | `string` | (required) | The image that needs to be deployed to the Knative Service |

[tektonPipelineAuth]: https://tekton.dev/docs/pipelines/auth/#configuring-docker-authentication-for-docker
43 changes: 43 additions & 0 deletions tasks/task-kn-apply/0.1.1/task-kn-apply.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
# Source: task-openshift/templates/task-kn-apply.yaml
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: kn-apply
labels:
app.kubernetes.io/version: 0.1.1
annotations:
tekton.dev/source: "https://github.com/openshift-pipelines/task-openshift"
artifacthub.io/category: integration-delivery
artifacthub.io/maintainers: |
- name: OpenShift Pipeline task maintainers
email: [email protected]
artifacthub.io/provider: Red Hat
artifacthub.io/recommendations: |
- url: https://tekton.dev/
tekton.dev/displayName: CLI
tekton.dev/pipelines.minVersion: 0.17.0
tekton.dev/tags: cli
spec:
description: >-
This task deploys a given image to a Knative Service.
It uses `kn service apply` to create or update given knative service.
params:
- name: SERVICE
description: Knative service name
- name: IMAGE
description: Image to deploy

steps:
- name: kn
env:
- name: HOME
value: /tekton/home
image: registry.redhat.io/openshift-serverless-1/client-kn-rhel8:1.11.2-4
command: ["/ko-app/kn"]
args:
["service", "apply", "$(params.SERVICE)", "--image", "$(params.IMAGE)"]
securityContext:
runAsNonRoot: true
runAsUser: 65532
45 changes: 45 additions & 0 deletions tasks/task-kn/0.1.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## `Kn` Tekton Task

# Abstract

The `kn` Task performs operations on Knative resources (services, revisions, routes) using kn CLI.

# Usage

Please, consider the usage example below:

```yaml
---
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
name: example-taskrun
spec:
taskRef:
name: kn
params:
- name: ARGS
value:
- help
```
Here `ARGS` param accepts an array of arguments for usage with kn command.

In case the Container Registry requires authentication, please consider the [Tekton Pipelines documentation][tektonPipelineAuth]. In a nutshell, you need to create a Kubernetes Secret describing the following attributes:

```bash
kubectl create secret docker-registry imagestreams \
--docker-server="image-registry.openshift-image-registry.svc:5000" \
--docker-username="${REGISTRY_USERNAME}" \
--docker-password="${REGISTRY_TOKEN}"
```

Then make sure the Secret is linked with the Service-Account running the `TaskRun`/`PipelineRun`.

## Params

| Param | Type | Default | Description |
| :----- | :-----: | :--------- | :---------------------- |
| `ARGS` | `array` | (required) | kn CLI arguments to run |

[tektonPipelineAuth]: https://tekton.dev/docs/pipelines/auth/#configuring-docker-authentication-for-docker
43 changes: 43 additions & 0 deletions tasks/task-kn/0.1.1/task-kn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
# Source: task-openshift/templates/task-kn.yaml
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: kn
labels:
app.kubernetes.io/version: 0.1.1
annotations:
tekton.dev/source: "https://github.com/openshift-pipelines/task-openshift"
artifacthub.io/category: integration-delivery
artifacthub.io/maintainers: |
- name: OpenShift Pipeline task maintainers
email: [email protected]
artifacthub.io/provider: Red Hat
artifacthub.io/recommendations: |
- url: https://tekton.dev/
tekton.dev/displayName: CLI
tekton.dev/pipelines.minVersion: 0.17.0
tekton.dev/tags: cli
spec:
description: >-
This Task performs operations on Knative resources
(services, revisions, routes) using kn CLI
params:
- name: ARGS
type: array
description: kn CLI arguments to run
default:
- "help"

steps:
- name: kn
env:
- name: HOME
value: /tekton/home
image: registry.redhat.io/openshift-serverless-1/client-kn-rhel8:1.11.2-4
command: ["/ko-app/kn"]
args: ["$(params.ARGS)"]
securityContext:
runAsNonRoot: true
runAsUser: 65532
56 changes: 56 additions & 0 deletions tasks/task-opc/0.1.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
`opc` Tekton Task
-----------------------

# Abstract

The `opc` Task makes it easy to work with Tekton resources in OpenShift Pipelines.

# Usage

Please, consider the usage example below:

```yaml
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata: {}
spec:
pipelineRef:
name: task-opc
params:
- name: SCRIPT
value: "opc $@"
- name: ARGS
value: opc-command-you-want-to-execute

```
You'll need to replace `opc-command-you-want-to-execute` with opc CLI arguments based on what operation you want to perform with the Tekton resources in OpenShift Pipelines.
In case the Container Registry requires authentication, please consider the [Tekton Pipelines documentation][tektonPipelineAuth]. In a nutshell, you need to create a Kubernetes Secret describing the following attributes:

```bash
kubectl create secret docker-registry imagestreams \
--docker-server="image-registry.openshift-image-registry.svc:5000" \
--docker-username="${REGISTRY_USERNAME}" \
--docker-password="${REGISTRY_TOKEN}"
```

Then make sure the Secret is linked with the Service-Account running the `TaskRun`/`PipelineRun`.

## Workspace

| Name | Optional | Description |
| :------------ | :------------------------: | :--------------------------- |
| `kubeconfig_dir` | `true` | An optional workspace that allows you to provide a .kube/config file for opc to access the cluster. |


## Params

| Param | Type | Default | Description |
| :------------ | :------------------------: | :--------------------------- | :------------------------- |
| `SCRIPT` | `string` | (required) | opc CLI script to execute |
| `ARGS` | `array` | (required) | opc CLI arguments to run |



[tektonPipelineAuth]: https://tekton.dev/docs/pipelines/auth/#configuring-docker-authentication-for-docker

84 changes: 84 additions & 0 deletions tasks/task-opc/0.1.1/task-opc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
# Source: task-openshift/templates/task-opc.yaml
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: opc
labels:
app.kubernetes.io/version: 0.1.1
annotations:
tekton.dev/source: "https://github.com/openshift-pipelines/task-openshift"
artifacthub.io/category: integration-delivery
artifacthub.io/maintainers: |
- name: OpenShift Pipeline task maintainers
email: [email protected]
artifacthub.io/provider: Red Hat
artifacthub.io/recommendations: |
- url: https://tekton.dev/
tekton.dev/displayName: CLI
tekton.dev/pipelines.minVersion: 0.17.0
tekton.dev/tags: cli
spec:
description: >-
The opc task makes it easy to work with Tekton resources in OpenShift Pipelines.
workspaces:
- name: kubeconfig_dir
optional: true
description: >-
An optional workspace that allows you to provide a .kube/config
file for opc to access the cluster. The file should be placed at
the root of the Workspace with name kubeconfig.
params:
- name: SCRIPT
description: opc CLI script to execute
type: string
default: "opc $@"
- name: ARGS
type: array
description: opc CLI arguments to run
default: ["--help"]

stepTemplate:
env:

- name: PARAMS_SCRIPT
value: "$(params.SCRIPT)"
- name: WORKSPACES_KUBECONFIG_DIR_BOUND
value: "$(workspaces.kubeconfig_dir.bound)"
- name: WORKSPACES_KUBECONFIG_DIR_PATH
value: "$(workspaces.kubeconfig_dir.path)"

steps:
- name: load-scripts
image: registry.access.redhat.com/ubi8-minimal:latest
workingDir: /scripts
script: |
set -e
printf '%s' "IyEvdXNyL2Jpbi9lbnYgYmFzaAoKIyB0ZWt0b24ncyB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QkVDT05GSUdfRElSX1BBVEh9L2t1YmVjb25maWcKCmV2YWwgJHtQQVJBTVNfU0NSSVBUfQo=" |base64 -d >opc-client.sh
printf '%s' "IyEvdXNyL2Jpbi9lbnYgYmFzaAoKZGVjbGFyZSAtcnggUEFSQU1TX1NDUklQVD0iJHtQQVJBTVNfU0NSSVBUOi19IgoKZGVjbGFyZSAtcnggV09SS1NQQUNFU19LVUJFQ09ORklHX0RJUl9QQVRIPSIke1dPUktTUEFDRVNfS1VCRUNPTkZJR19ESVJfUEFUSDotfSIKZGVjbGFyZSAtcnggV09SS1NQQUNFU19LVUJFQ09ORklHX0RJUl9CT1VORD0iJHtXT1JLU1BBQ0VTX0tVQkVDT05GSUdfRElSX0JPVU5EOi19IgoKIwojIEFzc2VydGluZyBFbnZpcm9ubWVudAojCgpleHBvcnRlZF9vcl9mYWlsIFwKICAgIFdPUktTUEFDRVNfS1VCRUNPTkZJR19ESVJfQk9VTkQgXAogICAgUEFSQU1TX1NDUklQVCBcCiAgIAo=" |base64 -d >opc-common.sh
chmod +x opc-*.sh
volumeMounts:
- name: scripts-dir
mountPath: /scripts

- name: opc
image: registry.redhat.io/openshift-pipelines/pipelines-cli-opc-rhel8:1.15.0
env:
- name: HOME
value: /tekton/home
command:
- /scripts/opc-client.sh
args: ["$(params.ARGS)"]
securityContext:
runAsNonRoot: true
runAsUser: 65532
volumeMounts:
- name: scripts-dir
mountPath: /scripts

volumes:
- name: scripts-dir
emptyDir: {}
57 changes: 57 additions & 0 deletions tasks/task-openshift-client/0.1.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
`OpenShift-Cient` Tekton Task
-----------------------

# Abstract

The `openshift-client` Task is the binary for OpenShift CLI that complements kubectl for simplifying deployment and configuration applications on OpenShift.

# Usage

Please, consider the usage example below:

```yaml
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata: {}
spec:
pipelineRef:
name: task-openshift-client
params:
- name: SCRIPT
value: openShift-CLI-arguments
- name: VERSION
value: oc-version

```
You'll need to replace `openShift-CLI-arguments` with OpenShift CLI arguments that you want to run and replace `oc-version` with the version of OpenShift you want to use.
In case the Container Registry requires authentication, please consider the [Tekton Pipelines documentation][tektonPipelineAuth]. In a nutshell, you need to create a Kubernetes Secret describing the following attributes:

```bash
kubectl create secret docker-registry imagestreams \
--docker-server="image-registry.openshift-image-registry.svc:5000" \
--docker-username="${REGISTRY_USERNAME}" \
--docker-password="${REGISTRY_TOKEN}"
```

Then make sure the Secret is linked with the Service-Account running the `TaskRun`/`PipelineRun`.

## Workspace

| Name | Optional | Description |
| :------------ | :------------------------: | :--------------------------- |
| `manifest_dir` | `true` | The workspace which contains kubernetes manifests which we want to apply on the cluster. |
| `kubeconfig_dir` | `true` | The workspace which contains the the kubeconfig file if in case we want to run the oc command on another cluster. |


## Params

| Param | Type | Default | Description |
| :------------ | :------------------------: | :--------------------------- | :------------------------- |
| `SCRIPT` | `string` | (required) | The OpenShift CLI arguments to run |
| `VERSION` | `string` | (required) | The OpenShift version to use |



[tektonPipelineAuth]: https://tekton.dev/docs/pipelines/auth/#configuring-docker-authentication-for-docker

Loading

0 comments on commit 7683659

Please sign in to comment.