-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(KONFLUX-4892): supply layer size information to pyxis
This is meant to be paired with a change in the step image: konflux-ci/release-service-utils#284 If the layers of the image are found to be gzip compressed, then pull them, decompress them, and include information about their decompressed digests and sizes in the manifest provided to the pyxis script. Signed-off-by: Ralph Bean <[email protected]>
- Loading branch information
Showing
11 changed files
with
175 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
tasks/create-pyxis-image/tests/test-create-pyxis-image-with-gzipped-layers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: test-create-pyxis-image-with-gzipped-layers | ||
spec: | ||
description: | | ||
Run the create-pyxis-image task with an image that has gzipped layers, to | ||
see that we reported the uncompressed digests correctly | ||
workspaces: | ||
- name: tests-workspace | ||
tasks: | ||
- name: setup | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
taskSpec: | ||
workspaces: | ||
- name: data | ||
steps: | ||
- name: setup-values | ||
image: quay.io/konflux-ci/release-service-utils:31c0a95a9604fd16b002b4969cfd74753d9c5e77 | ||
script: | | ||
#!/usr/bin/env bash | ||
set -eux | ||
cat > "$(workspaces.data.path)"/mapped_snapshot.json << EOF | ||
{ | ||
"application": "myapp", | ||
"components": [ | ||
{ | ||
"name": "comp", | ||
"containerImage": "source@sha256:mydigest", | ||
"repository": "registry.io/image-with-gzipped-layers", | ||
"tags": [ | ||
"testtag" | ||
] | ||
} | ||
] | ||
} | ||
EOF | ||
- name: run-task | ||
taskRef: | ||
name: create-pyxis-image | ||
params: | ||
- name: pyxisSecret | ||
value: test-create-pyxis-image-cert | ||
- name: server | ||
value: stage | ||
- name: snapshotPath | ||
value: mapped_snapshot.json | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
runAfter: | ||
- setup | ||
- name: check-result | ||
params: | ||
- name: pyxisDataPath | ||
value: $(tasks.run-task.results.pyxisDataPath) | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
taskSpec: | ||
params: | ||
- name: pyxisDataPath | ||
type: string | ||
workspaces: | ||
- name: data | ||
steps: | ||
- name: check-result | ||
image: quay.io/konflux-ci/release-service-utils:31c0a95a9604fd16b002b4969cfd74753d9c5e77 | ||
script: | | ||
#!/usr/bin/env bash | ||
set -eux | ||
if [ "$(wc -l < "$(workspaces.data.path)"/mock_create_container_image.txt)" != 1 ]; then | ||
echo Error: create_container_image was expected to be called 1 time. Actual calls: | ||
cat "$(workspaces.data.path)/mock_create_container_image.txt" | ||
exit 1 | ||
fi | ||
if [ "$(wc -l < "$(workspaces.data.path)"/mock_oras.txt)" != 5 ]; then | ||
echo Error: oras was expected to be called 4 times. Actual calls: | ||
cat "$(workspaces.data.path)/mock_oras.txt" | ||
exit 1 | ||
fi | ||
[ "$(head -n 1 < "$(workspaces.data.path)"/mock_skopeo.txt)" \ | ||
= "inspect --raw docker://registry.io/image-with-gzipped-layers@sha256:mydigest" ] | ||
# check that the size of the decompressed layers is as expected | ||
jq -e '.uncompressed_layers[0].size == 21' "$(workspaces.data.path)/oras-manifest-fetch.json" | ||
jq -e '.uncompressed_layers[1].size == 9' "$(workspaces.data.path)/oras-manifest-fetch.json" | ||
runAfter: | ||
- run-task |