Skip to content

Commit

Permalink
feat(tasks): Add registry info task (#53)
Browse files Browse the repository at this point in the history
This new task makes it possible to create pipelines that perform
registry replacements on the fly. Also makes it possible to perform
image synchronization.
  • Loading branch information
djzager committed Jul 20, 2022
1 parent a32cef0 commit 1f1d4d7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/clustertasks/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ resources:
- crane-kustomize-init.yaml
- kubectl-apply-kustomize.yaml
- kubectl-apply-files.yaml
- oc-registry-info.yaml
36 changes: 36 additions & 0 deletions config/clustertasks/oc-registry-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: tekton.dev/v1beta1
kind: ClusterTask
metadata:
name: oc-registry-info
annotations:
description: |
Get registry info from an OpenShift cluster.
spec:
params:
- name: context
type: string
description: |
The name of the context from kubeconfig to ask for registry info.
results:
- name: internal
description:
Internal registry URL.
- name: public
description:
Public registry URL.
steps:
- name: oc-registry-info
image: quay.io/konveyor/crane-runner:latest
script: |
oc --context="$(params.context)" registry info --internal | tee $(results.internal.path)
( oc --context="$(params.context)" registry info --public || \
oc --context="$(params.context)" get route default-route -n openshift-image-registry --template='{{ .spec.host }}' || \
oc --context="$(params.context)" get route docker-registry -n default --template='{{ .spec.host }}' \
) | tee $(results.public.path)
env:
- name: KUBECONFIG
value: $(workspaces.kubeconfig.path)/kubeconfig
workspaces:
- name: kubeconfig
description: |
The kubeconfig for accessing the cluster.

0 comments on commit 1f1d4d7

Please sign in to comment.