-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathrelease.yaml
120 lines (113 loc) · 3.77 KB
/
release.yaml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: cachi2-on-release
annotations:
pipelinesascode.tekton.dev/max-keep-runs: "3"
pipelinesascode.tekton.dev/on-event: "[push]"
pipelinesascode.tekton.dev/on-target-branch: "[refs/tags/*]"
pipelinesascode.tekton.dev/task: "[git-clone]"
spec:
params:
- name: repo_url
value: "{{repo_url}}"
- name: revision
value: "{{revision}}"
- name: slack-webhook-notification-team
value: build
pipelineSpec:
tasks:
- name: fetch-repository
taskRef:
name: git-clone
workspaces:
- name: output
workspace: workspace
params:
- name: depth
value: "0"
- name: url
value: $(params.repo_url)
- name: revision
value: $(params.revision)
- name: release
runAfter:
- fetch-repository
workspaces:
- name: output
workspace: workspace
taskSpec:
results:
- name: version
workspaces:
- name: output
steps:
- name: get-semver-tag
image: registry.access.redhat.com/ubi9/python-39
workingDir: $(workspaces.output.path)
env:
- name: WORKSPACE_OUTPUT_PATH
value: $(workspaces.output.path)
- name: PARAM_REVISION
value: $(params.revision)
script: |
#!/usr/bin/env bash
set -eufx
git config --global --add safe.directory "${WORKSPACE_OUTPUT_PATH}"
git fetch --tag -v
version=$(git --no-pager tag --points-at HEAD)
[[ -z ${version} ]] && {
echo "No tag points at commit $PARAM_REVISION"
exit 1
}
if [[ $version =~ ^([0-9])\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
echo "version: $version"
else
echo "This tag is not proper semantic version form: $version"
exit 1
fi
echo $version > $(results.version.path)
- name: push-semver-tag-to-image
image: registry.access.redhat.com/ubi9/skopeo
workingDir: $(workspaces.output.path)
env:
- name: PARAM_REVISION
value: $(params.revision)
script: |
#!/usr/bin/env bash
set -eufx
version=$(cat $(results.version.path))
skopeo copy docker://quay.io/konflux-ci/cachi2:$PARAM_REVISION \
docker://quay.io/konflux-ci/cachi2:$version
finally:
- name: slack-webhook-notification
taskRef:
resolver: bundles
params:
- name: name
value: slack-webhook-notification
- name: bundle
value: quay.io/konflux-ci/tekton-catalog/task-slack-webhook-notification:0.1
- name: kind
value: task
when:
- input: $(tasks.status)
operator: in
values: ["Failed"]
params:
- name: message
value: |-
Tekton pipelineRun $(context.pipelineRun.name) failed.
See https://console-openshift-console.apps.stone-prd-rh01.pg1f.p1.openshiftapps.com/k8s/ns/konflux-ci/tekton.dev~v1~PipelineRun/$(context.pipelineRun.name)
(Quick! It may disappear soon!)
- name: key-name
value: $(params.slack-webhook-notification-team)
workspaces:
- name: workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi