Skip to content

Commit

Permalink
fix: generation of SBC images
Browse files Browse the repository at this point in the history
Fixes #43

Depends on siderolabs/talos#7907

Installer image size got bigger, add assertions for additional arm64
files.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Oct 30, 2023
1 parent 354baca commit 3d99e0a
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 39 deletions.
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ require (
github.com/opencontainers/go-digest v1.0.0
github.com/siderolabs/gen v0.4.7
github.com/siderolabs/go-pointer v1.0.0
github.com/siderolabs/talos v1.6.0-alpha.1.0.20231018180437-c23bc2f4a77c
github.com/siderolabs/talos/pkg/machinery v1.6.0-alpha.1.0.20231018180437-c23bc2f4a77c
github.com/siderolabs/talos v1.6.0-alpha.1.0.20231030094658-cbe6e7622d01
github.com/siderolabs/talos/pkg/machinery v1.6.0-alpha.1.0.20231030094658-cbe6e7622d01
github.com/sigstore/cosign/v2 v2.2.0
github.com/sigstore/sigstore v1.7.2
github.com/stretchr/testify v1.8.4
Expand Down Expand Up @@ -241,7 +241,7 @@ require (
github.com/segmentio/ksuid v1.0.4 // indirect
github.com/shibumi/go-pathspec v1.3.0 // indirect
github.com/siderolabs/crypto v0.4.1 // indirect
github.com/siderolabs/go-api-signature v0.3.0 // indirect
github.com/siderolabs/go-api-signature v0.3.1 // indirect
github.com/siderolabs/go-blockdevice v0.4.6 // indirect
github.com/siderolabs/go-circular v0.1.0 // indirect
github.com/siderolabs/go-cmd v0.1.1 // indirect
Expand Down Expand Up @@ -281,15 +281,15 @@ require (
github.com/vultr/metadata v1.1.0 // indirect
github.com/xanzy/go-gitlab v0.90.0 // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/v2 v2.305.9 // indirect
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
go.etcd.io/etcd/etcdutl/v3 v3.5.9 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.9 // indirect
go.etcd.io/etcd/raft/v3 v3.5.9 // indirect
go.etcd.io/etcd/server/v3 v3.5.9 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.etcd.io/etcd/api/v3 v3.5.10 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect
go.etcd.io/etcd/client/v2 v2.305.10 // indirect
go.etcd.io/etcd/client/v3 v3.5.10 // indirect
go.etcd.io/etcd/etcdutl/v3 v3.5.10 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.10 // indirect
go.etcd.io/etcd/raft/v3 v3.5.10 // indirect
go.etcd.io/etcd/server/v3 v3.5.10 // indirect
go.mongodb.org/mongo-driver v1.11.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0 // indirect
Expand Down
48 changes: 24 additions & 24 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,8 @@ github.com/siderolabs/discovery-client v0.1.5 h1:CyaOOynanZdB29v46lyEOaNfPoBnKjj
github.com/siderolabs/discovery-client v0.1.5/go.mod h1:XFSNX7ADu+4r3j/m299V6pP7f4vEDnSJJhgc5yZE73g=
github.com/siderolabs/gen v0.4.7 h1:lM69UYggT7yzpubf7hEFaNujPdY55Y9zvQf/NC18GvA=
github.com/siderolabs/gen v0.4.7/go.mod h1:4PBYMdXxTg292IDRq4CGn5AymyDxJVEDvobVKDqFBEA=
github.com/siderolabs/go-api-signature v0.3.0 h1:RSJ210iLD6p2FouRvRvkB6FMvz8ZltXvt9+g+5EGbC4=
github.com/siderolabs/go-api-signature v0.3.0/go.mod h1:RZQFRiZ4midsdC9XCGhhWyS8QcIWtpEFeigvqoDPYJY=
github.com/siderolabs/go-api-signature v0.3.1 h1:ePXOxBT2fxRICsDntXed9kivmVK269nZe5UXvOxgtnM=
github.com/siderolabs/go-api-signature v0.3.1/go.mod h1:RZQFRiZ4midsdC9XCGhhWyS8QcIWtpEFeigvqoDPYJY=
github.com/siderolabs/go-blockdevice v0.4.6 h1:yfxFYzXezzszB0mSF2ZG8jPPampoNXa9r8W8nM0IoZI=
github.com/siderolabs/go-blockdevice v0.4.6/go.mod h1:4PeOuk71pReJj1JQEXDE7kIIQJPVe8a+HZQa+qjxSEA=
github.com/siderolabs/go-circular v0.1.0 h1:zpBJNUbCZSh0odZxA4Dcj0d3ShLLR2WxKW6hTdAtoiE=
Expand Down Expand Up @@ -1021,10 +1021,10 @@ github.com/siderolabs/protoenc v0.2.0 h1:QFxWIAo//12+/bm27GNYoK/TpQGTYsRrrZCu9jS
github.com/siderolabs/protoenc v0.2.0/go.mod h1:mu4gc6pJxhdJYpuloacKE4jsJojj87qDXwn8LUvs2bY=
github.com/siderolabs/siderolink v0.3.1 h1:n0pkf7dEhiqX0nfcwWiEqGKoD5CuBRTrWdPBvmvQ8vs=
github.com/siderolabs/siderolink v0.3.1/go.mod h1:LrkE9BoHzfi/m43EQx/Fk6kSal6Uvthu5AtRC3W5GcI=
github.com/siderolabs/talos v1.6.0-alpha.1.0.20231018180437-c23bc2f4a77c h1:IQbEy1mw7q5ElzcQDNDl/3TpCXaioWIzDU3jMnSOtnU=
github.com/siderolabs/talos v1.6.0-alpha.1.0.20231018180437-c23bc2f4a77c/go.mod h1:fHGb8e5c9hZYgCxDaeWux86rf0N4jGpwObrevrB3Jdw=
github.com/siderolabs/talos/pkg/machinery v1.6.0-alpha.1.0.20231018180437-c23bc2f4a77c h1:NY0goHanT1flMVCnlO9RC5NDV2kLw8TqFEG+jC5iP+k=
github.com/siderolabs/talos/pkg/machinery v1.6.0-alpha.1.0.20231018180437-c23bc2f4a77c/go.mod h1:PlKIv9NR7LSsSfzLIFP9vv2VnPnKeiNouTnHpDWly1k=
github.com/siderolabs/talos v1.6.0-alpha.1.0.20231030094658-cbe6e7622d01 h1:5BmxawizD34LfdCqBK+XCR80BRt1N/tfFiJcHi+2zds=
github.com/siderolabs/talos v1.6.0-alpha.1.0.20231030094658-cbe6e7622d01/go.mod h1:q1QrUKyRflxPN/qHfnLYyCYAjz37BDmiyekBse3aMFA=
github.com/siderolabs/talos/pkg/machinery v1.6.0-alpha.1.0.20231030094658-cbe6e7622d01 h1:vyNwRvOGVIS3zkx1Qsr65fU9kjiUHeQwG8t6dgXIQso=
github.com/siderolabs/talos/pkg/machinery v1.6.0-alpha.1.0.20231030094658-cbe6e7622d01/go.mod h1:5yJYpFKtvV2ttFRr8ZKV3VnlNuZXXGuIwg/3Ql3zCjo=
github.com/siderolabs/tcpproxy v0.1.0 h1:IbkS9vRhjMOscc1US3M5P1RnsGKFgB6U5IzUk+4WkKA=
github.com/siderolabs/tcpproxy v0.1.0/go.mod h1:onn6CPPj/w1UNqQ0U97oRPF0CqbrgEApYCw4P9IiCW8=
github.com/sigstore/cosign/v2 v2.2.0 h1:MV/ALD1/e/JgxXXCdCNxlIRk2NB3Irb4MKPozd8SPR8=
Expand Down Expand Up @@ -1179,24 +1179,24 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
github.com/zalando/go-keyring v0.2.2 h1:f0xmpYiSrHtSNAVgwip93Cg8tuF45HJM6rHq/A5RI/4=
github.com/zalando/go-keyring v0.2.2/go.mod h1:sI3evg9Wvpw3+n4SqplGSJUMwtDeROfD4nsFz4z9PG0=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.etcd.io/etcd/api/v3 v3.5.9 h1:4wSsluwyTbGGmyjJktOf3wFQoTBIURXHnq9n/G/JQHs=
go.etcd.io/etcd/api/v3 v3.5.9/go.mod h1:uyAal843mC8uUVSLWz6eHa/d971iDGnCRpmKd2Z+X8k=
go.etcd.io/etcd/client/pkg/v3 v3.5.9 h1:oidDC4+YEuSIQbsR94rY9gur91UPL6DnxDCIYd2IGsE=
go.etcd.io/etcd/client/pkg/v3 v3.5.9/go.mod h1:y+CzeSmkMpWN2Jyu1npecjB9BBnABxGM4pN8cGuJeL4=
go.etcd.io/etcd/client/v2 v2.305.9 h1:YZ2OLi0OvR0H75AcgSUajjd5uqKDKocQUqROTG11jIo=
go.etcd.io/etcd/client/v2 v2.305.9/go.mod h1:0NBdNx9wbxtEQLwAQtrDHwx58m02vXpDcgSYI2seohQ=
go.etcd.io/etcd/client/v3 v3.5.9 h1:r5xghnU7CwbUxD/fbUtRyJGaYNfDun8sp/gTr1hew6E=
go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA=
go.etcd.io/etcd/etcdutl/v3 v3.5.9 h1:PD63eycMIKtVjDeUBvroA5dFHPsBnjixR8T9mAbB6ww=
go.etcd.io/etcd/etcdutl/v3 v3.5.9/go.mod h1:rQ6z0HAAxVgYwBTWJbs3ei8gMYiNQzF51lQ2kI+6LZU=
go.etcd.io/etcd/pkg/v3 v3.5.9 h1:6R2jg/aWd/zB9+9JxmijDKStGJAPFsX3e6BeJkMi6eQ=
go.etcd.io/etcd/pkg/v3 v3.5.9/go.mod h1:BZl0SAShQFk0IpLWR78T/+pyt8AruMHhTNNX73hkNVY=
go.etcd.io/etcd/raft/v3 v3.5.9 h1:ZZ1GIHoUlHsn0QVqiRysAm3/81Xx7+i2d7nSdWxlOiI=
go.etcd.io/etcd/raft/v3 v3.5.9/go.mod h1:WnFkqzFdZua4LVlVXQEGhmooLeyS7mqzS4Pf4BCVqXg=
go.etcd.io/etcd/server/v3 v3.5.9 h1:vomEmmxeztLtS5OEH7d0hBAg4cjVIu9wXuNzUZx2ZA0=
go.etcd.io/etcd/server/v3 v3.5.9/go.mod h1:GgI1fQClQCFIzuVjlvdbMxNbnISt90gdfYyqiAIt65g=
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.etcd.io/etcd/api/v3 v3.5.10 h1:szRajuUUbLyppkhs9K6BRtjY37l66XQQmw7oZRANE4k=
go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI=
go.etcd.io/etcd/client/pkg/v3 v3.5.10 h1:kfYIdQftBnbAq8pUWFXfpuuxFSKzlmM5cSn76JByiT0=
go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U=
go.etcd.io/etcd/client/v2 v2.305.10 h1:MrmRktzv/XF8CvtQt+P6wLUlURaNpSDJHFZhe//2QE4=
go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA=
go.etcd.io/etcd/client/v3 v3.5.10 h1:W9TXNZ+oB3MCd/8UjxHTWK5J9Nquw9fQBLJd5ne5/Ao=
go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc=
go.etcd.io/etcd/etcdutl/v3 v3.5.10 h1:o57fNgdP9Y99wZzpQ5ky5Jb6323/nisMtCOj1+kQwgc=
go.etcd.io/etcd/etcdutl/v3 v3.5.10/go.mod h1:vDoQpV0zo5HFlK8tgE8cTwZB+RQuWGHa2G3wAZvIJ88=
go.etcd.io/etcd/pkg/v3 v3.5.10 h1:WPR8K0e9kWl1gAhB5A7gEa5ZBTNkT9NdNWrR8Qpo1CM=
go.etcd.io/etcd/pkg/v3 v3.5.10/go.mod h1:TKTuCKKcF1zxmfKWDkfz5qqYaE3JncKKZPFf8c1nFUs=
go.etcd.io/etcd/raft/v3 v3.5.10 h1:cgNAYe7xrsrn/5kXMSaH8kM/Ky8mAdMqGOxyYwpP0LA=
go.etcd.io/etcd/raft/v3 v3.5.10/go.mod h1:odD6kr8XQXTy9oQnyMPBOr0TVe+gT0neQhElQ6jbGRc=
go.etcd.io/etcd/server/v3 v3.5.10 h1:4NOGyOwD5sUZ22PiWYKmfxqoeh72z6EhYjNosKGLmZg=
go.etcd.io/etcd/server/v3 v3.5.10/go.mod h1:gBplPHfs6YI0L+RpGkTQO7buDbHv5HJGG/Bst0/zIPo=
go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg=
go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng=
go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8=
Expand Down
3 changes: 3 additions & 0 deletions internal/artifacts/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const (
KindInitramfs Kind = "initramfs.xz"
KindSystemdBoot Kind = "systemd-boot.efi"
KindSystemdStub Kind = "systemd-stub.efi"
KindDTB Kind = "dtb"
KindUBoot Kind = "u-boot"
KindRPiFirmware Kind = "raspberrypi-firmware"
)

// FetchTimeout controls overall timeout for fetching artifacts for a release.
Expand Down
14 changes: 14 additions & 0 deletions internal/asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ func (b *Builder) build(ctx context.Context, prof profile.Profile, versionString
return nil, fmt.Errorf("secure boot is not supported yet")
}

if prof.Arch == string(artifacts.ArchArm64) {
if err := b.getBuildAsset(ctx, versionString, prof.Arch, artifacts.KindDTB, &prof.Input.DTB); err != nil {
return nil, fmt.Errorf("failed to get dtb: %w", err)
}

if err := b.getBuildAsset(ctx, versionString, prof.Arch, artifacts.KindUBoot, &prof.Input.UBoot); err != nil {
return nil, fmt.Errorf("failed to get u-boot: %w", err)
}

if err := b.getBuildAsset(ctx, versionString, prof.Arch, artifacts.KindRPiFirmware, &prof.Input.RPiFirmware); err != nil {
return nil, fmt.Errorf("failed to get rpi firmware: %w", err)
}
}

imgr, err := imager.New(prof)
if err != nil {
return nil, err
Expand Down
14 changes: 13 additions & 1 deletion internal/integration/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func testDownloadFrontend(ctx context.Context, t *testing.T, baseURL string) {
t.Parallel()

downloadAssetAndMatchSize(ctx, t, baseURL, emptySchematicID, talosVersion, "installer-amd64.tar", "application/x-tar", 167482880)
downloadAssetAndMatchSize(ctx, t, baseURL, emptySchematicID, talosVersion, "installer-arm64.tar", "application/x-tar", 163630080)
downloadAssetAndMatchSize(ctx, t, baseURL, emptySchematicID, talosVersion, "installer-arm64.tar", "application/x-tar", 222793728)
})

t.Run("metal image", func(t *testing.T) {
Expand All @@ -208,6 +208,12 @@ func testDownloadFrontend(ctx context.Context, t *testing.T, baseURL string) {
downloadAssetAndMatchSize(ctx, t, baseURL, emptySchematicID, talosVersion, "gcp-amd64.raw.tar.gz", "application/gzip", 78472708)
downloadAssetAndMatchSize(ctx, t, baseURL, emptySchematicID, talosVersion, "gcp-arm64.raw.tar.gz", "application/gzip", 70625420)
})

t.Run("rpi image", func(t *testing.T) {
t.Parallel()

downloadAssetAndMatchSize(ctx, t, baseURL, emptySchematicID, talosVersion, "metal-rpi_generic-arm64.raw.xz", "application/x-xz", 66574172)
})
})

t.Run("extensions schematic", func(t *testing.T) {
Expand All @@ -227,6 +233,12 @@ func testDownloadFrontend(ctx context.Context, t *testing.T, baseURL string) {
downloadAssetAndMatchSize(ctx, t, baseURL, systemExtensionsSchematicID, talosVersion, "metal-arm64.raw.xz", "application/x-xz", 91484764)
})

t.Run("rpi image", func(t *testing.T) {
t.Parallel()

downloadAssetAndMatchSize(ctx, t, baseURL, systemExtensionsSchematicID, talosVersion, "metal-rpi_generic-arm64.raw.xz", "application/x-xz", 94756312)
})

t.Run("initramfs", func(t *testing.T) {
t.Parallel()

Expand Down
12 changes: 10 additions & 2 deletions internal/integration/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,19 @@ func testInstallerImage(ctx context.Context, t *testing.T, registry name.Registr

assert.Len(t, layers, 2)

assertImageContainsFiles(t, img, map[string]struct{}{
expectedFiles := map[string]struct{}{
"bin/installer": {},
fmt.Sprintf("usr/install/%s/vmlinuz", platform.Architecture): {},
fmt.Sprintf("usr/install/%s/initramfs.xz", platform.Architecture): {},
})
}

if platform.Architecture == "arm64" {
expectedFiles["usr/install/arm64/dtb/allwinner/sun50i-h616-x96-mate.dtb"] = struct{}{}
expectedFiles["usr/install/arm64/raspberrypi-firmware/boot/bootcode.bin"] = struct{}{}
expectedFiles["usr/install/arm64/u-boot/rockpi_4/rkspi_loader.img"] = struct{}{}
}

assertImageContainsFiles(t, img, expectedFiles)

// verify the image signature
assertImageSignature(ctx, t, ref, baseURL)
Expand Down

0 comments on commit 3d99e0a

Please sign in to comment.