-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathkonflux-test-product2-push.yaml
More file actions
114 lines (111 loc) · 4.26 KB
/
Copy pathkonflux-test-product2-push.yaml
File metadata and controls
114 lines (111 loc) · 4.26 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
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
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
annotations:
build.appstudio.openshift.io/repo: https://github.com/swickersh/konflux-test-product?rev={{revision}}
build.appstudio.redhat.com/commit_sha: '{{revision}}'
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
pipelinesascode.tekton.dev/cancel-in-progress: "false"
pipelinesascode.tekton.dev/max-keep-runs: "3"
pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch == "main"
labels:
appstudio.openshift.io/application: example-push-artifacts-to-cdn
appstudio.openshift.io/component: konflux-test-product2
pipelines.appstudio.openshift.io/type: build
name: konflux-test-product2-on-push
namespace: releng-test-product-tenant
spec:
params:
- name: git-url
value: '{{source_url}}'
- name: revision
value: '{{revision}}'
- name: output-image
value: quay.io/redhat-user-workloads/releng-test-product-tenant/konflux-test-product2:{{revision}}
pipelineSpec:
params:
- name: git-url
type: string
- name: revision
type: string
default: ""
- name: output-image
type: string
results:
- name: IMAGE_URL
value: $(tasks.push-oras-disk-artifact.results.IMAGE_URL)
- name: IMAGE_DIGEST
value: $(tasks.push-oras-disk-artifact.results.IMAGE_DIGEST)
- name: CHAINS-GIT_URL
value: $(tasks.set-git-results.results.CHAINS_GIT_URL)
- name: CHAINS-GIT_COMMIT
value: $(tasks.set-git-results.results.CHAINS_GIT_COMMIT)
tasks:
- name: set-git-results
taskSpec:
params:
- name: git-url
type: string
- name: revision
type: string
results:
- name: CHAINS_GIT_URL
- name: CHAINS_GIT_COMMIT
steps:
- name: set-results
image: registry.access.redhat.com/ubi9/ubi-minimal:latest
script: |
#!/usr/bin/env bash
set -euo pipefail
echo -n "$(params.git-url)" > "$(results.CHAINS_GIT_URL.path)"
echo -n "$(params.revision)" > "$(results.CHAINS_GIT_COMMIT.path)"
params:
- name: git-url
value: $(params.git-url)
- name: revision
value: $(params.revision)
- name: push-oras-disk-artifact
runAfter:
- set-git-results
taskSpec:
params:
- name: output-image
type: string
results:
- name: IMAGE_URL
description: URL of pushed ORAS artifact image
- name: IMAGE_DIGEST
description: Digest of pushed ORAS artifact image
steps:
- name: generate-and-push
image: quay.io/konflux-ci/release-service-utils@sha256:ab08297c747f953df7eaa0ed85a72c1c6ae7a422a1921a83d8a4ab3624382393
env:
- name: HOME
value: /tekton/home
- name: DOCKER_CONFIG
value: /tekton/home/.docker
script: |
#!/usr/bin/env bash
set -euo pipefail
mkdir -p artifacts
printf 'fake ISO content for amd64\n' > artifacts/install.iso.gz
printf 'fake QCOW content for amd64\n' > artifacts/disk.qcow2
auth_file="$(mktemp)"
select-oci-auth "$(params.output-image)" > "${auth_file}"
push_output="$(
cd artifacts && oras push --registry-config "${auth_file}" "$(params.output-image)" \
install.iso.gz disk.qcow2 2>&1
)"
printf '%s\n' "${push_output}"
echo -n "$(params.output-image)" > "$(results.IMAGE_URL.path)"
digest="$(printf '%s\n' "${push_output}" | awk '/^Digest:/ {print $2}' | tail -n1)"
if [ -z "${digest}" ]; then
echo "Failed to parse digest from oras push output" >&2
exit 1
fi
echo -n "${digest}" > "$(results.IMAGE_DIGEST.path)"
params:
- name: output-image
value: $(params.output-image)
taskRunTemplate:
serviceAccountName: build-pipeline-konflux-test-product2