forked from tektoncd/catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtekton-catalog-publish.yaml
More file actions
78 lines (78 loc) · 2.92 KB
/
Copy pathtekton-catalog-publish.yaml
File metadata and controls
78 lines (78 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
apiVersion: tekton.dev/v1beta1
kind: StepAction
metadata:
name: tekton-catalog-publish
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/categories: Publishing
tekton.dev/pipelines.minVersion: "0.54.0"
tekton.dev/cli.minVersion: "0.34.0"
tekton.dev/tags: catalog, bundles
tekton.dev/displayName: "Publish a Tekton Catalog"
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le"
tekton.dev/deprecated: "true"
spec:
params:
- name: TKN_IMAGE
type: string
description: tkn CLI container image to run this stepaction
default: ghcr.io/tektoncd/plumbing/tkn@sha256:79d21abf8a29128ede5091773078d5d8528f47240e455adb9824222d2fff489a
- name: REGISTRY
type: string
description: The registry where bundles are published to
- name: PATH
type: string
description: The path in the registry
default: tekton/catalog/tasks
- name: RESOURCE
type: string
description: task or stepaction. It must match the resource name in the root of the catalot path.
default: task
- name: TAG
type: string
description: An optional extra tag. If provided, tasks are tagged with it too.
default: ""
- name: catalogPath
description: >-
A directory that holds the catalog to be published. The catalog must be stored
in the root of the directory, and is must follow the
[Tetkon Catalog](https://github.com/tektoncd/catalog#catalog-structure) structure.
- name: dockerconfigPath
description: >-
An optional directory that allows providing a .docker/config.json
file for tkn to access the container registry. The file should be placed at
the root of the Directory with name config.json.
default: "no-path"
image: "$(params.TKN_IMAGE)"
workingDir: "$(params.catalogPath)"
env:
- name: REGISTRY
value: $(params.REGISTRY)
- name: REGISTRY_PATH
value: $(params.PATH)
- name: TAG
value: $(params.TAG)
- name: DOCKER_CONFIG_PATH
value: $(params.dockerconfigPath)
- name: RESOURCE
value: $(params.RESOURCE)
script: |
#!/usr/bin/env sh
set -e -o pipefail
TARGET="${REGISTRY}"
[ "${REGISTRY_PATH}" != "" ] && TARGET="${TARGET}/${REGISTRY_PATH}"
# If a dockerconfig workspace was provided, set DOCKER_CONFIG to point to it
if [ -d "$DOCKER_CONFIG_PATH" ]; then
export DOCKER_CONFIG="${DOCKER_CONFIG_PATH}"
fi
find ${RESOURCE} -type f -mindepth 3 -maxdepth 3 -name '*.yaml' -o -name '*.yml'| while read -r resource_version_dir; do
FOLDER=$(dirname "$resource_version_dir")
VERSION=$(basename "$FOLDER")
RESOURCE_NAME=$(basename "$(dirname "$FOLDER")")
tkn bundle push "${TARGET}/${RESOURCE_NAME}:${VERSION}" -f "$resource_version_dir"
[ "${TAG}" != "" ] && \
tkn bundle push "${TARGET}/${RESOURCE_NAME}:${TAG}" -f "$resource_version_dir"
sleep 0.1
done