1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-21 05:55:35 +00:00

Port openshift-client to v1beta1 🦇

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
This commit is contained in:
Vincent Demeester 2020-03-05 14:59:01 +01:00 committed by tekton-robot
parent 0702a8e651
commit 4341bae32d
3 changed files with 46 additions and 48 deletions

View File

@ -52,41 +52,40 @@ oc policy add-role-to-user edit -z default -n <namespace>
This `TaskRun` runs an `oc rollout` command to deploy the latest image version for `myapp` on OpenShift.
```
apiVersion: tekton.dev/v1alpha1
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: deploy-myapp
spec:
taskRef:
name: openshift-client
inputs:
params:
- name: ARGS
value:
- "rollout"
- "latest"
- "myapp"
params:
- name: ARGS
value:
- "rollout"
- "latest"
- "myapp"
```
The following `TaskRun` runs the commands against a different cluster than the one the `TaskRun` is running on. The cluster credentials are provided via a `PipelineResource` called `stage-cluster`.
```
apiVersion: tekton.dev/v1alpha1
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: deploy-myapp-stage
spec:
taskRef:
name: openshift-client-kubecfg
inputs:
resources:
resources:
inputs:
- name: cluster
resourceRef:
name: stage-cluster
params:
- name: ARGS
value:
- "rollout"
- "latest"
- "myapp"
```
params:
- name: ARGS
value:
- "rollout"
- "latest"
- "myapp"
```

View File

@ -1,26 +1,26 @@
apiVersion: tekton.dev/v1alpha1
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: openshift-client-kubecfg
spec:
inputs:
resources:
resources:
inputs:
- name: cluster
type: cluster
params:
- name: SCRIPT
description: The OpenShift CLI arguments to run
type: string
default: "oc $@"
- name: ARGS
description: The OpenShift CLI arguments to run
type: array
default:
- "help"
params:
- name: SCRIPT
description: The OpenShift CLI arguments to run
type: string
default: "oc $@"
- name: ARGS
description: The OpenShift CLI arguments to run
type: array
default:
- "help"
steps:
- name: oc
image: quay.io/openshift/origin-cli:latest
script: "$(inputs.params.SCRIPT)"
script: "$(params.SCRIPT)"
args:
- "--kubeconfig /workspace/$(inputs.resources.cluster.name)/kubeconfig --context $(inputs.resources.cluster.name)"
- "$(inputs.params.ARGS)"
- "--kubeconfig /workspace/$(resources.inputs.cluster.name)/kubeconfig --context $(resources.inputs.cluster.name)"
- "$(params.ARGS)"

View File

@ -1,22 +1,21 @@
apiVersion: tekton.dev/v1alpha1
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: openshift-client
spec:
inputs:
params:
- name: SCRIPT
description: The OpenShift CLI arguments to run
type: string
default: "oc $@"
- name: ARGS
description: The OpenShift CLI arguments to run
type: array
default:
- "help"
params:
- name: SCRIPT
description: The OpenShift CLI arguments to run
type: string
default: "oc $@"
- name: ARGS
description: The OpenShift CLI arguments to run
type: array
default:
- "help"
steps:
- name: oc
image: quay.io/openshift/origin-cli:latest
script: "$(inputs.params.SCRIPT)"
script: "$(params.SCRIPT)"
args:
- "$(inputs.params.ARGS)"
- "$(params.ARGS)"