forked from konflux-ci/release-service-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-create-pyxis-image-include-layers-false.yaml
More file actions
188 lines (182 loc) · 6.45 KB
/
Copy pathtest-create-pyxis-image-include-layers-false.yaml
File metadata and controls
188 lines (182 loc) · 6.45 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: test-create-pyxis-image-include-layers-false
spec:
description: |
Run the create-pyxis-image task with an image that has layers and
.pyxis.includeLayers=false, so the layers will be deleted and not processed.
params:
- name: ociStorage
description: The OCI repository where the Trusted Artifacts are stored.
type: string
- name: ociArtifactExpiresAfter
description: Expiration date for the trusted artifacts created in the
OCI repository. An empty string means the artifacts do not expire.
type: string
default: "1d"
- name: orasOptions
description: oras options to pass to Trusted Artifacts calls
type: string
default: "--insecure"
- name: trustedArtifactsDebug
description: Flag to enable debug logging in trusted artifacts. Set to a non-empty string to enable.
type: string
default: ""
- name: dataDir
description: The location where data will be stored
type: string
tasks:
- name: setup
taskSpec:
results:
- name: sourceDataArtifact
type: string
volumes:
- name: workdir
emptyDir: {}
stepTemplate:
volumeMounts:
- mountPath: /var/workdir
name: workdir
env:
- name: IMAGE_EXPIRES_AFTER
value: $(params.ociArtifactExpiresAfter)
- name: "ORAS_OPTIONS"
value: "$(params.orasOptions)"
- name: "DEBUG"
value: "$(params.trustedArtifactsDebug)"
steps:
- name: setup-values
image: quay.io/konflux-ci/release-service-utils:02a8ddcd16113371a255fd1ef0a196399d300162
script: |
#!/usr/bin/env bash
set -eux
mkdir -p "$(params.dataDir)/$(context.pipelineRun.uid)"
cat > "$(params.dataDir)/$(context.pipelineRun.uid)"/mapped_snapshot.json << EOF
{
"application": "myapp",
"components": [
{
"name": "comp",
"containerImage": "source@sha256:mydigest",
"repositories": [
{
"url": "registry.io/image-with-gzipped-layers",
"tags": [
"testtag"
]
}
]
}
]
}
EOF
cat > "$(params.dataDir)/$(context.pipelineRun.uid)/mydata.json" << EOF
{
"pyxis": {
"skipLayers": true
}
}
EOF
- name: create-trusted-artifact
ref:
name: create-trusted-artifact
params:
- name: ociStorage
value: $(params.ociStorage)
- name: workDir
value: $(params.dataDir)
- name: sourceDataArtifact
value: $(results.sourceDataArtifact.path)
- name: run-task
taskRef:
name: create-pyxis-image
params:
- name: pyxisSecret
value: test-create-pyxis-image-cert
- name: server
value: stage
- name: snapshotPath
value: $(context.pipelineRun.uid)/mapped_snapshot.json
- name: dataPath
value: $(context.pipelineRun.uid)/mydata.json
- name: ociStorage
value: $(params.ociStorage)
- name: orasOptions
value: $(params.orasOptions)
- name: sourceDataArtifact
value: "$(tasks.setup.results.sourceDataArtifact)=$(params.dataDir)"
- name: dataDir
value: $(params.dataDir)
- name: trustedArtifactsDebug
value: $(params.trustedArtifactsDebug)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
- name: check-result
params:
- name: pyxisDataPath
value: $(tasks.run-task.results.pyxisDataPath)
- name: sourceDataArtifact
value: "$(tasks.run-task.results.sourceDataArtifact)=$(params.dataDir)"
- name: dataDir
value: $(params.dataDir)
taskSpec:
params:
- name: pyxisDataPath
type: string
- name: sourceDataArtifact
type: string
- name: dataDir
type: string
volumes:
- name: workdir
emptyDir: {}
stepTemplate:
volumeMounts:
- mountPath: /var/workdir
name: workdir
env:
- name: IMAGE_EXPIRES_AFTER
value: $(params.ociArtifactExpiresAfter)
- name: "ORAS_OPTIONS"
value: "$(params.orasOptions)"
- name: "DEBUG"
value: "$(params.trustedArtifactsDebug)"
steps:
- name: use-trusted-artifact
ref:
name: use-trusted-artifact
params:
- name: workDir
value: $(params.dataDir)
- name: sourceDataArtifact
value: $(params.sourceDataArtifact)
- name: check-result
image: quay.io/konflux-ci/release-service-utils:02a8ddcd16113371a255fd1ef0a196399d300162
script: |
#!/usr/bin/env bash
set -eux
if [ "$(wc -l < \
"$(params.dataDir)/mock_create_container_image.txt")" != 1 ]; then
echo Error: create_container_image was expected to be called 1 time. Actual calls:
cat "$(params.dataDir)/mock_create_container_image.txt"
exit 1
fi
if [ "$(wc -l < "$(params.dataDir)/mock_oras.txt")" != 2 ]; then
echo Error: oras was expected to be called 2 times. Actual calls:
cat "$(params.dataDir)/mock_oras.txt"
exit 1
fi
[ "$(head -n 1 < "$(params.dataDir)/mock_skopeo.txt")" \
= "inspect --retry-times 3 --raw docker://registry.io/image-with-gzipped-layers@sha256:mydigest" ]
# check that decompressed layers info is not included in the oras manifest fetch
jq -e '. | has("uncompressed_layers") == false' \
"$(params.dataDir)/$(context.pipelineRun.uid)/oras-manifest-fetch-0-0.json"
runAfter:
- run-task