Skip to content

Commit

Permalink
Change testdata to be a bit smaller
Browse files Browse the repository at this point in the history
This has two packages, pretend-baselayout and replayout.

Replayout replaces pretend-baselayout and has a dependency on it.

This also makes those artifacts reproducible via:

$ ./hack/update-packages.sh

My plan is to check in some actual images built from these packages, and
the tzdata package is just a little too big to be comfy doing that.

Also drop some things from .gitignore that are very annoying.

Signed-off-by: Jon Johnson <[email protected]>
  • Loading branch information
jonjohnsonjr committed Dec 19, 2023
1 parent 6a1ded5 commit 81ad5fd
Show file tree
Hide file tree
Showing 25 changed files with 442 additions and 196 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,3 @@ bin/
.idea
tmp/
_output

# Development files
apko.yaml
output.tar
sbom-*.cdx
sbom-*.spdx.json
12 changes: 12 additions & 0 deletions hack/update-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Copyright 2023 Chainguard, Inc.
# SPDX-License-Identifier: Apache-2.0

set -ex

(cd internal/cli/testdata && \
melange build --arch arm64 --arch amd64 -r https://packages.wolfi.dev/os -k https://packages.wolfi.dev/os/wolfi-signing.rsa.pub --signing-key ./melange.rsa pretend-baselayout.melange.yaml && \
melange build --arch arm64 --arch amd64 -r https://packages.wolfi.dev/os -k https://packages.wolfi.dev/os/wolfi-signing.rsa.pub --signing-key ./melange.rsa replayout.melange.yaml)
(cd internal/cli &&
apko lock ./testdata/apko.yaml)
10 changes: 5 additions & 5 deletions internal/cli/publish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestPublish(t *testing.T) {
st := &sentinel{s.Client().Transport}
dst := fmt.Sprintf("%s/test/publish", u.Host)

config := filepath.Join("testdata", "tzdata.yaml")
config := filepath.Join("testdata", "apko.yaml")

outputRefs := ""
archs := types.ParseArchitectures([]string{"amd64", "arm64"})
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestPublish(t *testing.T) {

// This test will fail if we ever make a change in apko that changes the image.
// Sometimes, this is intentional, and we need to change this and bump the version.
want := "sha256:add006b981a4421349eb1a0cb50044d2d7589ed2b3cfbbe2e7c30f005f79438f"
want := "sha256:685a8f5d66554057ea6e697be713d81bdaec276f4ef845243e60fc61df698168"
require.Equal(t, want, digest.String())

sdst := fmt.Sprintf("%s:%s.sbom", dst, strings.ReplaceAll(want, ":", "-"))
Expand All @@ -104,7 +104,7 @@ func TestPublish(t *testing.T) {

// This test will fail if we ever make a change in apko that changes the SBOM.
// Sometimes, this is intentional, and we need to change this and bump the version.
swant := "sha256:2cbdb42a7b4160cdcd44836a583fa23985532e1641f026365f653006545ad90c"
swant := "sha256:89c0c452eab526bebac6d4e4ed8c14a3f9bfdf1e828438add5276a73fb657ae1"
require.Equal(t, swant, got)

im, err := idx.IndexManifest()
Expand All @@ -113,8 +113,8 @@ func TestPublish(t *testing.T) {
// We also want to check the children SBOMs because the index SBOM does not have
// references to the children SBOMs, just the children!
wantBoms := []string{
"sha256:a6acf3531effec2dd296834096fccff905d73f6838d9f680419c9bfbedad42f7",
"sha256:91097a5a791914cf2456e540671d47d369ae980c5376844ae978e56c15e8957c",
"sha256:bef40bcaa24ff513c1add5e0133a663519081ed5fd770a67609089ebb1b4a5a3",
"sha256:c400175e8fb4d7b3e2eb0442b7991716b3f6a770539f5e0f9d47e52a426e5431",
}

for i, m := range im.Manifests {
Expand Down
101 changes: 101 additions & 0 deletions internal/cli/testdata/apko.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"version": "v1",
"contents": {
"keyring": [
{
"name": "./testdata/melange.rsa.pub",
"url": "./testdata/melange.rsa.pub"
}
],
"repositories": [
{
"name": "./testdata/packages/x86_64",
"url": "./testdata/packages/x86_64/APKINDEX.tar.gz",
"architecture": "x86_64"
},
{
"name": "./testdata/packages/aarch64",
"url": "./testdata/packages/aarch64/APKINDEX.tar.gz",
"architecture": "aarch64"
}
],
"packages": [
{
"name": "pretend-baselayout",
"url": "./testdata/packages/x86_64/pretend-baselayout-1.0.0-r0.apk",
"version": "1.0.0-r0",
"architecture": "x86_64",
"signature": {
"range": "bytes=0-684",
"checksum": "sha1-e4mtQNHHROPVjqH3vNZUtKTu5Uc="
},
"control": {
"range": "bytes=685-964",
"checksum": "sha1-cs+Hlyu5sY+1mmwKPedcRWj8E24="
},
"data": {
"range": "bytes=965-2899",
"checksum": "sha256-6Gbikm5tHIqetbTVz/wPcmtCcrO17ed1vPM6xuR0IrU="
},
"checksum": "Q1cs+Hlyu5sY+1mmwKPedcRWj8E24="
},
{
"name": "replayout",
"url": "./testdata/packages/x86_64/replayout-1.0.0-r0.apk",
"version": "1.0.0-r0",
"architecture": "x86_64",
"signature": {
"range": "bytes=0-684",
"checksum": "sha1-UCaIAliqYaIrol8/H5PAi8J5ihg="
},
"control": {
"range": "bytes=685-974",
"checksum": "sha1-ADqt8AXOdbDPVa9UeGNJngcURrk="
},
"data": {
"range": "bytes=975-2848",
"checksum": "sha256-irIVeq+6d/ZEIg59H1sjgVycwhfmwYwD79+Gv5DJXb0="
},
"checksum": "Q1ADqt8AXOdbDPVa9UeGNJngcURrk="
},
{
"name": "pretend-baselayout",
"url": "./testdata/packages/aarch64/pretend-baselayout-1.0.0-r0.apk",
"version": "1.0.0-r0",
"architecture": "aarch64",
"signature": {
"range": "bytes=0-683",
"checksum": "sha1-HFPvVMM/+d7Rm+XbuxpEyWM4wR4="
},
"control": {
"range": "bytes=684-961",
"checksum": "sha1-IhHX8PA1MiPcnOa5ig/Wjr/qhbU="
},
"data": {
"range": "bytes=962-2900",
"checksum": "sha256-HxWjXtCvMsSYOmhE5OUPz9KQ4kpm0Ywg17OzSf3Ikl4="
},
"checksum": "Q1IhHX8PA1MiPcnOa5ig/Wjr/qhbU="
},
{
"name": "replayout",
"url": "./testdata/packages/aarch64/replayout-1.0.0-r0.apk",
"version": "1.0.0-r0",
"architecture": "aarch64",
"signature": {
"range": "bytes=0-688",
"checksum": "sha1-1N7VDS5GSkkT4bzQ5ZJ5VzWiR6w="
},
"control": {
"range": "bytes=689-977",
"checksum": "sha1-twZgE0XMokZ89rlCxtGjp+XgtIc="
},
"data": {
"range": "bytes=978-2849",
"checksum": "sha256-Mkciu4YKl5ibdvTTg7BQOBSN2xVT1GC5VBZ3/D4qz24="
},
"checksum": "Q1twZgE0XMokZ89rlCxtGjp+XgtIc="
}
]
}
}
97 changes: 97 additions & 0 deletions internal/cli/testdata/apko.pre-0.13.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"version": "v1",
"contents": {
"keyring": [
{
"name": "./testdata/melange.rsa.pub",
"url": "./testdata/melange.rsa.pub"
}
],
"repositories": [
{
"name": "./testdata/packages/x86_64",
"url": "./testdata/packages/x86_64/APKINDEX.tar.gz",
"architecture": "x86_64"
},
{
"name": "./testdata/packages/aarch64",
"url": "./testdata/packages/aarch64/APKINDEX.tar.gz",
"architecture": "aarch64"
}
],
"packages": [
{
"name": "pretend-baselayout",
"url": "./testdata/packages/x86_64/pretend-baselayout-1.0.0-r0.apk",
"version": "1.0.0-r0",
"architecture": "x86_64",
"signature": {
"range": "bytes=0-684",
"checksum": "sha1-e4mtQNHHROPVjqH3vNZUtKTu5Uc="
},
"control": {
"range": "bytes=685-964",
"checksum": "sha1-cs+Hlyu5sY+1mmwKPedcRWj8E24="
},
"data": {
"range": "bytes=965-2899",
"checksum": "sha256-6Gbikm5tHIqetbTVz/wPcmtCcrO17ed1vPM6xuR0IrU="
}
},
{
"name": "replayout",
"url": "./testdata/packages/x86_64/replayout-1.0.0-r0.apk",
"version": "1.0.0-r0",
"architecture": "x86_64",
"signature": {
"range": "bytes=0-684",
"checksum": "sha1-UCaIAliqYaIrol8/H5PAi8J5ihg="
},
"control": {
"range": "bytes=685-974",
"checksum": "sha1-ADqt8AXOdbDPVa9UeGNJngcURrk="
},
"data": {
"range": "bytes=975-2848",
"checksum": "sha256-irIVeq+6d/ZEIg59H1sjgVycwhfmwYwD79+Gv5DJXb0="
}
},
{
"name": "pretend-baselayout",
"url": "./testdata/packages/aarch64/pretend-baselayout-1.0.0-r0.apk",
"version": "1.0.0-r0",
"architecture": "aarch64",
"signature": {
"range": "bytes=0-683",
"checksum": "sha1-HFPvVMM/+d7Rm+XbuxpEyWM4wR4="
},
"control": {
"range": "bytes=684-961",
"checksum": "sha1-IhHX8PA1MiPcnOa5ig/Wjr/qhbU="
},
"data": {
"range": "bytes=962-2900",
"checksum": "sha256-HxWjXtCvMsSYOmhE5OUPz9KQ4kpm0Ywg17OzSf3Ikl4="
}
},
{
"name": "replayout",
"url": "./testdata/packages/aarch64/replayout-1.0.0-r0.apk",
"version": "1.0.0-r0",
"architecture": "aarch64",
"signature": {
"range": "bytes=0-688",
"checksum": "sha1-1N7VDS5GSkkT4bzQ5ZJ5VzWiR6w="
},
"control": {
"range": "bytes=689-977",
"checksum": "sha1-twZgE0XMokZ89rlCxtGjp+XgtIc="
},
"data": {
"range": "bytes=978-2849",
"checksum": "sha256-Mkciu4YKl5ibdvTTg7BQOBSN2xVT1GC5VBZ3/D4qz24="
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
contents:
keyring:
- ./testdata/local-melange.rsa.pub
- ./testdata/melange.rsa.pub
repositories:
- ./testdata/packages
packages:
- tzdata
- replayout

entrypoint:
command: /bin/sh -l
Expand Down
14 changes: 0 additions & 14 deletions internal/cli/testdata/local-melange.rsa.pub

This file was deleted.

51 changes: 51 additions & 0 deletions internal/cli/testdata/melange.rsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJJwIBAAKCAgEAuE9aHvpBoe7HNnWxhp2px+HGjbPhzP0CyQYMNMcHjd76UcaP
wWNTVqJI8JMT2u72mPsEXpC+J6KqjIggJoOaQYg87oYEdthoJZjyDaKzezNZKndz
VQkg4RfQPiCPQkm4r9v6So0MCDa4rwRYnqrfs3Je9/wi8B/wG1sz7P4wOG23djxp
ORDsMI9CyZhnAKfNg/uqmF/sxEwO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yjrj0wkZ9JVc3r51Xa6IdUP2o+nK
/4qIHmFnAEWC4wQlKMelFuZe85TiRC/wEnM3dZMpOq8atdNI65UZeKvqFMKYPlqc
B9ypAoIBACwYLGXqloJIwwdCnWuCCrJf8Npkk1eqkB+aO5vJ/YDHKULwgrmKjqN+
H4/gwsCiRnm7TBYPEgkhraYdrULu9BkqyO8w6jUvJ/2y1eN39FuNFyD5cw+riSND
d+JpeUs588Jd3mJR4Co24JYKaK8PxNoAOjMjP9PXD8AlSv7+edNMMNZ0VpsoWs/s
Zl6/u69Mub8dtPD5XaeuO6YZ8dNPnm8vqKaKM9t0GABcEfs/4gY/PkJXxY8mWxv1
jKonpeoaUKmKmBs8fl8t8zYENZrXL6fIplsh/1VrymNGT2hHrGp7ISz2yy9oxUhc
oyfKEqnYNB43OzHU+BX7hzONfBdGkBECggEACsfXS/ey47myNEfIvMOa64ZA+VDC
QGGGL1hwyKp+0DXwmoj/U6pkEu9EZcYF3OXTVYRIdA6+Hxks6JQRgmrNlID/vPC3
lfpvnRXWVJ5cDd68v6fooHOT/Hjg5hlVpXXM8Gsd+mBQtPrYbpnVvYqH7FVUkyfN
3nbLV3q3QsTvA3BR1swSMSbDzO03adUZJ1zO01BtlYn787L1RHMdNdEfKld/XTVd
yuxGbAfzOTWGJB2+qV4RzbN1xTEJGdgKgX7zrq+7cpnz8njiIU2xB34Tm+Nlb43I
IvNCFo4H/f1TAP3rru4AGv6cAu1w6c+8mpzqpqk+OZ2evtvSgHVZ01DFIg==
-----END RSA PRIVATE KEY-----
14 changes: 14 additions & 0 deletions internal/cli/testdata/melange.rsa.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAuE9aHvpBoe7HNnWxhp2p
x+HGjbPhzP0CyQYMNMcHjd76UcaPwWNTVqJI8JMT2u72mPsEXpC+J6KqjIggJoOa
QYg87oYEdthoJZjyDaKzezNZKndzVQkg4RfQPiCPQkm4r9v6So0MCDa4rwRYnqrf
s3Je9/wi8B/wG1sz7P4wOG23djxpORDsMI9CyZhnAKfNg/uqmF/sxEwOL4FaDZMg
0oo7Kx3FjtqqKTV8uFbCDsTxV3CR0pm3WJdX9TNfjXLXfp2a6QDYk1JoYl++UUHK
+7izMXro6xgY7OPT+F48/YNYxS/ciH90DmN7ysJnQ2otZHSqhOkJV4UrYCKBHY55
XjpDe7+nmwXaqVyAlCS6pDqHeYUUpYTpnv4b9bbst9NtYPRY8W00Oc5Cs3KdHeV6
LqvHAGwNTZziv91UTpi0hMf27I+MLaXx+jNWm5j40a+ZyswLAQSLI+u3LxfPlHda
lhpaQw+CoM3ucX9rcnJaBgowXclDAAvRNIj7EJNW5sk+3SbpmKKDkrD7Cl0rMSrd
1dixDZZPzA8UtwheNTmV+I+0r1kQMcNYcB8iUKsoWIpaur0CBCww02WTHpOMcMGw
+rVr/wzPP3Iqo1+EVrzVI5kSnZ7VLRtO5VdMLw0PlIK4ShJ+X5OtVtWnJ9jIiLaI
se0tr8lpqU40eV862X+jKz0CAwEAAQ==
-----END PUBLIC KEY-----
Loading

0 comments on commit 81ad5fd

Please sign in to comment.