-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathtest-create-advisory-disk-image-content.yaml
More file actions
89 lines (87 loc) · 3.59 KB
/
Copy pathtest-create-advisory-disk-image-content.yaml
File metadata and controls
89 lines (87 loc) · 3.59 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
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: test-create-advisory-disk-image-content
spec:
description: |
Run the create-advisory task with the contentType param set as disk-image
and check that an advisory url is emitted as a task result
tasks:
- name: setup
taskSpec:
results:
- name: advisory_json
type: string
steps:
- name: generate-advisory-json
image: registry.access.redhat.com/ubi9/ubi-minimal:latest
script: |
#!/usr/bin/env bash
set -euo pipefail
# advisory_json is the gzip+base64 encoding of:
# {"product_id":123,"product_name":"Red Hat Product","product_version":"1.2.3",
# "product_stream":"tp1","cpe":"cpe:/a:example:product:el8","type":"RHSA",
# "synopsis":"test synopsis","topic":"test topic","description":"test description",
# "solution":"test solution","references":["https://docs.example.com/notes"],
# "content":{"artifacts":[{"architecture":"x86_64","os":"linux","component":"test-disk-image",
# "purl":"pkg:generic/test-disk-image@1.0.0?filename=test-image.iso",
# "signingKey":"redhatrelease2"}]}}
advisory_b64="H4sIAAAAAAAAA12RT2sCMRDF736KJeeadbVIWShtb0IvxR6LSEjGdXA3CclsUcTv"
advisory_b64+="3vxD1p6SvN+bNzPkOqsqZp1Ro6Q9KtZWzXL1NBW1GCDIbAuq2giqvrLOHky/4Dwa"
advisory_b64+="HX0NX/LVI/XkQAwRkm0ykjaFhqOtRQtnMdge2lLQQv+SbXTJvu3m+yMr/qKN9ehTG"
advisory_b64+="niq7kIuMBblneVXAgq8dGipTJnwVMvhph8fHHchYQcHcKAlxO4/7EhkfVvXykjPywp"
advisory_b64+="cmqHWJhSzXV7UaAJNoeAankEQjvAgJKWMJFUFFSyPSCBpdGnz88t6v35O/YvDpN171"
advisory_b64+="ON5KofG1ujcKg0/V+hPcxxEB1OfHV0fLfbUtR1ocCjrf/b3hi/44u2APcTff004EY7e"
advisory_b64+="TMM8dhp19wmXGOlAHUX46x6EhyUrtls6d7N4u/0BSEfEJnACAAA="
echo -n "${advisory_b64}" > "$(results.advisory_json.path)"
- name: run-task
runAfter:
- setup
taskRef:
name: create-advisory-task
params:
- name: advisory_json
value: $(tasks.setup.results.advisory_json)
- name: componentGroup
value: "test-app"
- name: origin
value: "not-existing-origin"
- name: config_map_name
value: "create-advisory-test-cm"
- name: advisory_secret_name
value: "create-advisory-secret"
- name: errata_secret_name
value: "create-advisory-errata-secret"
- name: internalRequestPipelineRunName
value: $(context.pipelineRun.name)
- name: contentType
value: "disk-image"
- name: check-result
runAfter:
- run-task
params:
- name: result
value: $(tasks.run-task.results.result)
- name: advisory_url
value: $(tasks.run-task.results.advisory_url)
taskSpec:
params:
- name: result
type: string
- name: advisory_url
type: string
steps:
- name: check-result
image: registry.access.redhat.com/ubi9/ubi-minimal:latest
script: |
#!/usr/bin/env bash
set -euxo pipefail
echo Test that result is Success
test "$(params.result)" == Success
echo Test that advisory_url was properly set
url="$(params.advisory_url)"
if [[ "${url}" != https://access.redhat.com/errata/RHSA-*:1234 ]]; then
echo "Unexpected advisory URL: ${url}"
exit 1
fi