Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
753 commits
Select commit Hold shift + click to select a range
4d21200
fix kernel tools build.yml files to reflect correct dockerfiles
deitch Apr 16, 2024
47d02ec
Merge pull request #4024 from deitch/fix-kernel-tools-build
deitch Apr 17, 2024
1fe8cba
include image reference as source in every tar file header
deitch Apr 18, 2024
a610332
Merge pull request #4025 from deitch/tag-sources-in-tar
deitch Apr 18, 2024
632b406
add support for input-tar
deitch Apr 18, 2024
dd1ae90
Merge pull request #4026 from deitch/increment-tar-output
deitch Apr 19, 2024
dc12b9b
prevent using same file for input tar and output tar
deitch Apr 21, 2024
cea4c0d
Merge pull request #4027 from deitch/not-same-file
deitch Apr 21, 2024
4ce1364
chore: fix function name in comment
largemouth Apr 22, 2024
bc5d08d
Merge pull request #4028 from largemouth/master
deitch Apr 24, 2024
c836e54
use canonical ref when looking in cache
deitch Apr 24, 2024
04792e0
bump actions to v4 to avoid deprecation
deitch Apr 25, 2024
e6b0ae0
Merge pull request #4030 from deitch/canonicalize-pull
deitch Apr 25, 2024
8afecd5
Merge pull request #4031 from deitch/update-actions
deitch Apr 25, 2024
803747f
Make cgroups v2 the default:
jacobweinstock Apr 27, 2024
2fe19f7
Update dependencies
jacobweinstock Apr 27, 2024
38e62bb
Merge pull request #4033 from jacobweinstock/cgroupsv2-as-default
deitch Apr 28, 2024
2578ae2
explicitly use GITHUB_TOKEN for actions script
deitch Apr 28, 2024
d3257af
Merge pull request #4034 from deitch/token-for-actions
deitch Apr 28, 2024
c32c74b
github script v7
deitch Apr 28, 2024
e171750
Merge pull request #4035 from deitch/action-script-v7
deitch Apr 28, 2024
5299f94
use proper path for github-script properties
deitch Apr 28, 2024
b49e32a
Merge pull request #4036 from deitch/fix-action-script-v7
deitch Apr 28, 2024
379617c
move moby components that do not have runtime dependencies to own dir…
deitch May 7, 2024
6d37353
Merge pull request #4039 from deitch/split-moby
deitch May 7, 2024
f5dcefc
add cache export format OCI
deitch May 16, 2024
9e06024
Merge pull request #4040 from deitch/export-formats
deitch May 16, 2024
4c3d189
bump actions/setup-go to v5 and go-version to 1.22.3
deitch Jun 11, 2024
f48e442
Merge pull request #4044 from deitch/go-1.22
deitch Jun 11, 2024
7c46ac8
bump buildkit to latest v0.13.2 with deps
deitch Jun 11, 2024
977afa7
remove no longer necessary rand.Seed
deitch Jun 11, 2024
4f89f4f
Merge pull request #4043 from deitch/buildkit-bump
deitch Jun 11, 2024
5e42d05
Improve support for third-party registry images
jalaziz Jun 19, 2024
21e9f0f
add tests
jalaziz Jun 22, 2024
be7dfdd
Merge pull request #4046 from jalaziz/4045
deitch Jun 24, 2024
cda7577
ensured dumpFollow of logread includes 'follow' behaviour
danrzs Jul 3, 2024
3f80ca6
Merge pull request #4049 from danrzs/master
deitch Jul 3, 2024
8f6ea3c
switch Packet references to Equinix Metal
deitch Jul 5, 2024
ad4c97c
switch linuxkit from deprecated packngo to equinixmetal go-sdk
deitch Jul 5, 2024
c90f2ee
Merge pull request #4052 from deitch/packet-to-metal
deitch Jul 7, 2024
04dc904
cmd: allow more than one config yaml for build
christoph-zededa Jul 10, 2024
8d76ae2
Merge pull request #4054 from christoph-zededa/fix_build_command_args
deitch Jul 10, 2024
8bb9174
properly save linuxkit version
deitch Jul 11, 2024
bfac135
Merge pull request #4055 from deitch/include-semver-in-version
deitch Jul 11, 2024
7acc826
separate release builds of macOS CGO from others
deitch Jul 11, 2024
933445f
Merge pull request #4056 from deitch/handle-cross-compilation-macos
deitch Jul 11, 2024
e6ac960
make targets separated by OS
deitch Jul 11, 2024
e6ffc8a
Merge pull request #4057 from deitch/build-targets-all-not-macos
deitch Jul 11, 2024
6bbda93
update package versions and go version for pkg/init
deitch Jul 16, 2024
7b114bf
Merge pull request #4058 from deitch/init-security-alerts
deitch Jul 16, 2024
1fe9d0e
bump pkg/init containerd, runc and image-spec to fix CVEs
deitch Jul 16, 2024
5d940f4
Merge pull request #4059 from deitch/more-init-alerts
deitch Jul 16, 2024
4ad5595
bump docker deps in linuxkit binary
deitch Jul 16, 2024
53f848a
pkg/rngd bump x/sys version
deitch Jul 16, 2024
7ac157e
pkg/host-timesync-daemon bump x/sys version
deitch Jul 16, 2024
315a1db
pkg/extend bump x/sys version
deitch Jul 16, 2024
f13aee1
update rngd/extend/init usage in yml
deitch Jul 16, 2024
cd65ec3
Merge pull request #4060 from deitch/linuxkit-deps
deitch Jul 16, 2024
690a4ee
Merge pull request #4061 from deitch/multi-pkg-deps
deitch Jul 16, 2024
5d9f3e0
include example for debugging containerd
deitch Jul 17, 2024
c3c6dc7
Merge pull request #4062 from deitch/debug-containerd
deitch Jul 17, 2024
55e13c9
containerd to 1.7.20
deitch Jul 18, 2024
d68494b
Merge pull request #4063 from deitch/bump-containerd-1.7.20
deitch Jul 18, 2024
d665a97
containerd config.toml v2
deitch Jul 18, 2024
fa08581
Merge pull request #4064 from deitch/containerd-config-2
deitch Jul 19, 2024
b953d17
add support for volumes
deitch Jul 16, 2024
a5085fc
pkg/init support for volumes
deitch Jul 18, 2024
38a0cb6
test cases for volumes
deitch Jul 21, 2024
34304b1
Merge pull request #4065 from deitch/volumes
deitch Jul 21, 2024
51727db
support for pkg build ssh
deitch Jul 28, 2024
270fd1c
Merge pull request #4066 from deitch/ssh-support
deitch Jul 28, 2024
2af30c5
support cmdline-driven debugging mode for runc
deitch Aug 22, 2024
370bf51
Merge pull request #4067 from deitch/runc-debug-options
deitch Aug 22, 2024
b36cad0
when building read-only volumes, still use overlayfs
deitch Aug 22, 2024
745da8f
Merge pull request #4069 from deitch/fix-ro-volumes
deitch Aug 22, 2024
15c808c
more verbose runc messages
deitch Aug 22, 2024
5f09346
Merge pull request #4070 from deitch/verbose-runc
deitch Aug 22, 2024
cb8f36a
moby: check architecture for docker image
christoph-zededa Aug 27, 2024
5848a28
use only stdout/stderr or file for runc output
deitch Aug 28, 2024
6979859
Merge pull request #4073 from deitch/init-debug-no-control
deitch Aug 28, 2024
ba25e59
remove linuxefi grub EFI handover to normal linux loading
deitch Aug 29, 2024
1d6d5fa
Merge pull request #4074 from deitch/efi-kernel
deitch Aug 29, 2024
fa3207c
Merge pull request #4072 from christoph-zededa/docker_cache_consider_…
deitch Aug 29, 2024
2159aac
bump docker deps to v27.2.0
deitch Sep 8, 2024
d7a6bc8
Merge pull request #4077 from deitch/docker-bump
deitch Sep 8, 2024
da3be29
vendor: switch to moby/sys/capability
kolyshkin Oct 1, 2024
8556f02
Merge pull request #4082 from kolyshkin/moby-cap
deitch Oct 1, 2024
67e9e22
restructure logging
deitch Oct 1, 2024
5e3f7dd
Merge pull request #4083 from deitch/restructure-logging
deitch Oct 1, 2024
81f0c3e
internal restructure to use explicit platform instead of implicit arc…
deitch Oct 1, 2024
e4d4106
Merge pull request #4084 from deitch/cache-platform-instead-of-arch
deitch Oct 1, 2024
76f4802
additional volume support in building
deitch Sep 30, 2024
ad95c6f
Merge pull request #4085 from deitch/volume-image
deitch Oct 1, 2024
4f765b5
support --tag in build.yml for packages
deitch Dec 23, 2024
dc8c6d5
Merge pull request #4089 from deitch/tag-in-build-yml
deitch Dec 23, 2024
59c3f62
Update linuxkit/alpine
deitch Jan 3, 2025
709a945
tools/alpine: Update to latest
deitch Jan 3, 2025
b7cc91e
include riscv64 in push-manifest script
deitch Jan 3, 2025
bd30821
tools: Update to the latest linuxkit/alpine
deitch Jan 3, 2025
fb54321
Update use of tools to latest
deitch Jan 3, 2025
41ddfa0
tests: Update packages to the latest linuxkit/alpine
deitch Jan 3, 2025
db23fd9
Update use of test packages to latest
deitch Jan 3, 2025
67d6dad
pkgs: Update packages to the latest linuxkit/alpine
deitch Jan 3, 2025
4165491
Update package tags
deitch Jan 3, 2025
4e384a8
fix tss compilation with patches
deitch Jan 6, 2025
0db6e01
bump alpine in some test cases
deitch Jan 7, 2025
d1b42ca
update example for tss
deitch Jan 7, 2025
cfdeb54
Merge pull request #4090 from deitch/alpine-321-with-riscv64
deitch Jan 7, 2025
94d4902
Update linuxkit/alpine
deitch Jan 8, 2025
1c11777
tools/alpine: Update to latest
deitch Jan 8, 2025
35ab648
update alpine install docs with riscv64 and no grub-dev
deitch Jan 8, 2025
89ed0f5
remove grub-dev in favour of grub package
deitch Jan 8, 2025
48f5de7
tools: Update to the latest linuxkit/alpine
deitch Jan 8, 2025
da5fefe
Update use of tools to latest
deitch Jan 8, 2025
6f46c20
tests: Update packages to the latest linuxkit/alpine
deitch Jan 8, 2025
6cbd483
Update use of test packages to latest
deitch Jan 8, 2025
810e3c1
pkgs: Update packages to the latest linuxkit/alpine
deitch Jan 8, 2025
0579188
Update package tags
deitch Jan 8, 2025
df4d0c0
update built-in images in linuxkit cmd
deitch Jan 9, 2025
b929f3b
Merge pull request #4091 from deitch/remove-grub-dev
deitch Jan 9, 2025
7270857
Update linuxkit/alpine
deitch Jan 10, 2025
c7c3ab8
tools/alpine: Update to latest
deitch Jan 10, 2025
a7baaaa
tools: Update to the latest linuxkit/alpine
deitch Jan 10, 2025
68caa0b
Update use of tools to latest
deitch Jan 10, 2025
e625d0c
tests: Update packages to the latest linuxkit/alpine
deitch Jan 10, 2025
0edde24
Update use of test packages to latest
deitch Jan 10, 2025
3e2df7e
pkgs: Update packages to the latest linuxkit/alpine
deitch Jan 10, 2025
0b67767
Update package tags
deitch Jan 10, 2025
95fcdc3
node_exporter to v1.8.2
deitch Jan 11, 2025
5e3e7cc
Merge pull request #4093 from deitch/unify-alpine-packages
deitch Jan 12, 2025
c4d88d6
Update linuxkit/alpine
deitch Jan 15, 2025
bdda3d0
tools/alpine: Update to latest
deitch Jan 15, 2025
084e2a0
tools: Update to the latest linuxkit/alpine
deitch Jan 15, 2025
d83a55f
Update use of tools to latest
deitch Jan 15, 2025
9b5742f
tests: Update packages to the latest linuxkit/alpine
deitch Jan 15, 2025
f111765
Update use of test packages to latest
deitch Jan 15, 2025
ed42bcd
pkgs: Update packages to the latest linuxkit/alpine
deitch Jan 15, 2025
5c2e62d
Update package tags
deitch Jan 15, 2025
4aa891d
Update use of tools to latest
deitch Jan 15, 2025
da2988c
Update use of test packages to latest
deitch Jan 15, 2025
53cb098
add riscv64 to mkimage-qcow2-efi
deitch Jan 15, 2025
caf39bb
Update use of tools to latest
deitch Jan 15, 2025
fd778c4
Update use of test packages to latest
deitch Jan 15, 2025
9398785
Merge pull request #4094 from deitch/alpine-llvm-update
deitch Jan 15, 2025
fd6839d
Fix raw efi build image size calculation (#4097)
ChrisIgel Jan 27, 2025
66ca009
Try resizing all found devices (#4099)
ChrisIgel Jan 27, 2025
7ac34a6
pkg/extend fix panic for empty partition tables (#4101)
ChrisIgel Jan 30, 2025
76b5197
Add alpine bcc tools (#4105)
deitch Feb 17, 2025
efb1396
always tee test linuxkit run to tty, so if it gets stuck, we see why …
deitch Feb 19, 2025
18e7eea
riscv64 kernel (#4106)
deitch Feb 21, 2025
2053d17
Enable riscv64 default (#4108)
deitch Feb 23, 2025
5dbd808
bump golangci-lint-action (#4109)
deitch Feb 23, 2025
1d96f04
Buildkit builder 0.20.0 (#4110)
deitch Feb 23, 2025
198db90
containerd 20 (#4100)
deitch Feb 24, 2025
14c29db
Containerd v2.0.3 (#4112)
deitch Mar 6, 2025
ec70c12
add efi_gop module to grub (#4113)
ChrisIgel Mar 11, 2025
7a129b6
bump golangci-lint to v2.0.2 and update all lint issues (#4116)
deitch Apr 9, 2025
89a95f9
when updating an index, remove sboms or other manifests that referenc…
deitch May 2, 2025
b42e1a8
feat: add riscv64 as supported arch (#4124)
stskeeps Jun 23, 2025
18a7619
pkg build: handle race condition where builder is started at same tim…
deitch Jun 25, 2025
5a13eda
Bump buildkit (#4128)
deitch Jun 25, 2025
d45d3e8
more builder race condition; do restart if could not remove, and only…
deitch Jun 25, 2025
3f54a80
git: synchronize `update-index` with a mutex (#4130)
christoph-zededa Jun 25, 2025
4df360d
Centralize safe cache writes (#4132)
deitch Jun 26, 2025
254aefc
check for dirty tree without update-index, which is not parallel-safe…
deitch Jun 26, 2025
50120bc
ensure that new index does not break on missing lock file (#4134)
deitch Jun 27, 2025
818bccf
docs: Add instructions for OCI export from Docker (#4135)
danrzs Jun 30, 2025
940c1b7
simplify cache locking (#4136)
deitch Jun 30, 2025
2b46873
add support for pkg build authentication (#4137)
deitch Jul 2, 2025
c0c5668
swap 'pkg push' for 'pkg build --push', keeping 'pkg push' as depreca…
deitch Jul 4, 2025
fa24672
add missing CRLF in log message (#4144)
deitch Jul 13, 2025
33ee279
for pkg build builder, copy config over rather than bind-mounting it …
deitch Jul 13, 2025
bc44cb8
fix registry auth (#4146)
deitch Jul 15, 2025
eae7887
check lock when reading cache provider index (#4147)
deitch Jul 21, 2025
ef68e7b
provide mirror support (#4148)
deitch Jul 27, 2025
1d3a823
option to pull down required images from to the cache, so that build…
deitch Jul 27, 2025
3d9bb9a
add support for specifying additional certificates (#4153)
deitch Jul 31, 2025
1caf2fe
add support for custom build args (#4155)
deitch Aug 11, 2025
999110c
add support for dynamically calculated build arg sets (#4156)
deitch Aug 13, 2025
cacc2bb
simplify sharding in package tests for CI; increase to 12 shards (#4158)
deitch Aug 13, 2025
5cd4873
update debian for binfmt (#4159)
deitch Aug 14, 2025
506d11f
bump alpine; add erofs-utils package (#4161)
deitch Aug 27, 2025
c3228fb
erofs output (#4162)
deitch Aug 28, 2025
8d19b25
add support for pkg build dry-run (#4163)
deitch Aug 28, 2025
41cafa3
bump runc to v1.3.0 and containerd to v2.1.4 (#4165)
deitch Aug 28, 2025
179f74a
pkglib/git: remove trailing spaces of GOPKGVERSION (#4164)
christoph-zededa Aug 29, 2025
9da6903
cache/provider: use lock correctly
christoph-zededa Sep 2, 2025
358803f
validate yaml for extraneous fields in pkg build
deitch Sep 5, 2025
a755fd9
validate linuxkit yaml for unknown fields
deitch Sep 5, 2025
2ed6850
when comparing builder config files, ensure only compare post-processed
deitch Sep 12, 2025
bb0cf49
pkglib/build: make dockerRunner public
christoph-zededa Sep 12, 2025
43200ea
pkglib: untangle WithBuildDocker and DryRun
christoph-zededa Sep 12, 2025
4c81a14
do full releases, not draft
deitch Sep 16, 2025
a8cf7da
fix build when pulling from non-default registry
deitch Sep 25, 2025
47d5c89
Fix cache import failing when reading from stdin
europaul Sep 30, 2025
d94f2e9
Fix Go formatting issues to pass make local-check
europaul Sep 30, 2025
be7c483
Create new kernel series 6.12.x
ChrisIgel Oct 12, 2025
1200d24
Add kernel apparmor support
ChrisIgel Oct 12, 2025
2e3df6e
Configure EIF boot/stub
ChrisIgel Oct 12, 2025
07231ef
Add new kernel tests
ChrisIgel Oct 12, 2025
c5d422c
Fix kernel show-tags output
ChrisIgel Oct 12, 2025
ffd4a12
Enable CONFIG_INET_DIAG_DESTROY
ChrisIgel Oct 20, 2025
17e9b44
Update kernel versions/hashes
ChrisIgel Oct 24, 2025
5f0b5f2
Update remaining hashes in tests manually
ChrisIgel Oct 24, 2025
dadefbc
Fix kernel config test for 6.12.x
ChrisIgel Oct 24, 2025
5673ee1
Update kernel config test hashes
ChrisIgel Oct 24, 2025
397d7c2
Add systemd-boot to alpine
ChrisIgel Oct 27, 2025
35ab913
tools: Update to the latest linuxkit/alpine
ChrisIgel Oct 27, 2025
315cead
Update use of tools to latest
ChrisIgel Oct 27, 2025
7dfbca3
tests: Update packages to the latest linuxkit/alpine
ChrisIgel Oct 27, 2025
c56bc37
Update use of test packages to latest
ChrisIgel Oct 27, 2025
38c84d8
pkgs: Update packages to the latest linuxkit/alpine
ChrisIgel Oct 27, 2025
72de5c6
Update package tags
ChrisIgel Oct 27, 2025
6786caa
tests: Update tests cases to the latest linuxkit/alpine
deitch Oct 28, 2025
1723cf9
Update package tags
deitch Oct 28, 2025
8fa6ab7
revert rpi3 build change
deitch Oct 28, 2025
91a857d
sanity check on images.yaml
deitch Oct 28, 2025
f73fa3b
update tools based on grub
deitch Oct 28, 2025
f5c8db7
update images.yaml
deitch Oct 28, 2025
e9114d6
fix missing containerd-dev
deitch Oct 28, 2025
238449c
more package hash updates
deitch Oct 28, 2025
804d523
Switch to systemd-boot for raw-efi builds
ChrisIgel Oct 31, 2025
56e37a8
Add raw-efi test + documentation
ChrisIgel Nov 3, 2025
2dd1217
bump containerd v2.2.0
deitch Nov 18, 2025
478807b
bump runc v3.3.0
deitch Nov 18, 2025
cde1277
remove unnecessary apk package info from sysctl package
deitch Dec 2, 2025
a2753b8
remove unnecessary apkdb from final package for memlogd and runc
deitch Dec 3, 2025
c4e3043
update qemu to solve slow builds using qemu binfmt
deitch Dec 4, 2025
2ffdb93
enable kernel vmware vmci support
ChrisIgel Nov 13, 2025
f935f6b
bump kernel to 6.12.59
ChrisIgel Nov 25, 2025
5fd23cf
update kernel yamls
ChrisIgel Nov 13, 2025
fe86d9c
update 6.6.71 kernel hashes after manual image registry fix
ChrisIgel Dec 10, 2025
a066b29
fix remaining two files for 6.6.71 kernel hash update
ChrisIgel Dec 11, 2025
62c4fdb
fix remaining two files for 6.12.59 kernel update
ChrisIgel Dec 11, 2025
50025b8
separate kernel series hashing (#4194)
ChrisIgel Dec 11, 2025
7c7ac4e
runc enable GO111MODULE (#4195)
deitch Dec 11, 2025
367e1f8
update images.yaml for raw-efi (#4198)
deitch Jan 14, 2026
4129cc7
push release tags even when digest tag already is there (#4201)
deitch Jan 15, 2026
e015138
bump buildkit version and deps (#4202)
deitch Jan 18, 2026
ccb0787
pkg build: refactor builder parameters into BuilderConfig struct
rucoder Feb 26, 2026
a85160e
pkg build: make buildkit builder container name configurable
rucoder Feb 26, 2026
72a76e5
pkg build: use named volume to persist buildkit cache across restarts
rucoder Feb 26, 2026
c766f57
Merge pull request #4204 from rucoder/rucoder/per-user-builder-name
justincormack Mar 12, 2026
666bbfd
pkg build: add env var support for mirror, org, builder image and config
rucoder Mar 12, 2026
bdef7e8
Merge pull request #4205 from rucoder/rucoder/env-vars-for-ci
justincormack Mar 12, 2026
3751bb6
pkg build: fix builder config and certs not copied into new containers
europaul Mar 12, 2026
4cfb70d
Merge pull request #4207 from europaul/fix/load-files-into-container
justincormack Mar 18, 2026
420d550
pkg build: fix nil pointer dereference when releasing image only in r…
europaul Mar 25, 2026
3bf33c3
Merge pull request #4212 from europaul/fix/nil-deref-release-tag
justincormack Mar 27, 2026
2308529
actions: publish should occur after successful run (#4218)
mickael-docker Jun 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
prevent using same file for input tar and output tar
Signed-off-by: Avi Deitcher <avi@deitcher.net>
  • Loading branch information
deitch committed Apr 21, 2024
commit dc12b9be6955169bfe5c53b4d2af56b4c50e6583
9 changes: 7 additions & 2 deletions src/cmd/linuxkit/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,10 @@ The generated image can be in one of multiple formats which can be run on variou
return nil
}

var tf *os.File
var w io.Writer
var (
tf *os.File
w io.Writer
)
if outfile != nil {
w = outfile
} else {
Expand All @@ -216,6 +218,9 @@ The generated image can be in one of multiple formats which can be run on variou
defer os.Remove(tf.Name())
w = tf
}
if inputTar != "" && inputTar == outputFile {
return fmt.Errorf("input-tar and output file cannot be the same")
}

// this is a weird interface, but currently only streamable types can have additional files
// need to split up the base tarball outputs from the secondary stages
Expand Down
35 changes: 12 additions & 23 deletions src/cmd/linuxkit/moby/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,34 +139,23 @@ func Build(m Moby, w io.Writer, opts BuildOpts) error {
}
var (
oldConfig *Moby
tmpfile *os.File
in *os.File
err error
)
if metadataLocation != "" && opts.InputTar != "" {
// copy the file over, in case it ends up being the same output
tmpfile, err = os.CreateTemp("", "linuxkit-input.tar")
if err != nil {
return fmt.Errorf("failed to create temporary file: %w", err)
}
defer tmpfile.Close()
in, err := os.Open(opts.InputTar)
in, err = os.Open(opts.InputTar)
if err != nil {
return fmt.Errorf("failed to open input tar: %w", err)
}
if _, err := io.Copy(tmpfile, in); err != nil {
return fmt.Errorf("failed to copy input tar: %w", err)
}
if err := in.Close(); err != nil {
return fmt.Errorf("failed to close input file: %w", err)
}
if _, err := tmpfile.Seek(0, 0); err != nil {
defer in.Close()
if _, err := in.Seek(0, 0); err != nil {
return fmt.Errorf("failed to seek to beginning of tmpfile: %w", err)
}
// for efficiency, get the trimmed metadata path in advance
tmpTar := tar.NewReader(tmpfile)
// read the tar until we find the metadata file
inputTarReader := tar.NewReader(in)
for {
hdr, err := tmpTar.Next()
hdr, err := inputTarReader.Next()
if err == io.EOF {
break
}
Expand All @@ -175,7 +164,7 @@ func Build(m Moby, w io.Writer, opts BuildOpts) error {
}
if strings.TrimPrefix(hdr.Name, "/") == metadataLocation {
buf := new(bytes.Buffer)
if _, err := buf.ReadFrom(tmpTar); err != nil {
if _, err := buf.ReadFrom(inputTarReader); err != nil {
return fmt.Errorf("failed to read metadata file from input tar: %w", err)
}
config, err := NewConfig(buf.Bytes(), nil)
Expand Down Expand Up @@ -217,7 +206,7 @@ func Build(m Moby, w io.Writer, opts BuildOpts) error {
// first check if the existing one had it
//if config != nil && len(oldConfig.initRefs) > index+1 && oldConfig.initRefs[index].String() == image {
if oldConfig != nil && oldConfig.Kernel.ref != nil && oldConfig.Kernel.ref.String() == m.Kernel.ref.String() {
if err := extractPackageFilesFromTar(tmpfile, iw, m.Kernel.ref.String(), "kernel"); err != nil {
if err := extractPackageFilesFromTar(in, iw, m.Kernel.ref.String(), "kernel"); err != nil {
return err
}
} else {
Expand All @@ -242,7 +231,7 @@ func Build(m Moby, w io.Writer, opts BuildOpts) error {
apkTar := newAPKTarWriter(iw, "init")
for i, ii := range m.initRefs {
if oldConfig != nil && len(oldConfig.initRefs) > i && oldConfig.initRefs[i].String() == ii.String() {
if err := extractPackageFilesFromTar(tmpfile, apkTar, ii.String(), fmt.Sprintf("init[%d]", i)); err != nil {
if err := extractPackageFilesFromTar(in, apkTar, ii.String(), fmt.Sprintf("init[%d]", i)); err != nil {
return err
}
} else {
Expand All @@ -262,7 +251,7 @@ func Build(m Moby, w io.Writer, opts BuildOpts) error {
}
for i, image := range m.Onboot {
if oldConfig != nil && len(oldConfig.Onboot) > i && oldConfig.Onboot[i].Equal(image) {
if err := extractPackageFilesFromTar(tmpfile, iw, image.Image, fmt.Sprintf("onboot[%d]", i)); err != nil {
if err := extractPackageFilesFromTar(in, iw, image.Image, fmt.Sprintf("onboot[%d]", i)); err != nil {
return err
}
} else {
Expand All @@ -278,7 +267,7 @@ func Build(m Moby, w io.Writer, opts BuildOpts) error {
}
for i, image := range m.Onshutdown {
if oldConfig != nil && len(oldConfig.Onshutdown) > i && oldConfig.Onshutdown[i].Equal(image) {
if err := extractPackageFilesFromTar(tmpfile, iw, image.Image, fmt.Sprintf("onshutdown[%d]", i)); err != nil {
if err := extractPackageFilesFromTar(in, iw, image.Image, fmt.Sprintf("onshutdown[%d]", i)); err != nil {
return err
}
} else {
Expand All @@ -294,7 +283,7 @@ func Build(m Moby, w io.Writer, opts BuildOpts) error {
}
for i, image := range m.Services {
if oldConfig != nil && len(oldConfig.Services) > i && oldConfig.Services[i].Equal(image) {
if err := extractPackageFilesFromTar(tmpfile, iw, image.Image, fmt.Sprintf("services[%d]", i)); err != nil {
if err := extractPackageFilesFromTar(in, iw, image.Image, fmt.Sprintf("services[%d]", i)); err != nil {
return err
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"

NAME=check
NAME=check_input_tar

clean_up() {
rm -f ${NAME}-*.tar
Expand Down
38 changes: 38 additions & 0 deletions test/cases/000_build/060_input_tar/010_same_filename/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
# SUMMARY: Check that tar output format build is reproducible after leveraging input tar
# LABELS:

set -e

# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"

NAME=check_input_tar_conflict_filename

clean_up() {
rm -f ${NAME}-*.tar
}

trap clean_up EXIT

logfile=$(mktemp)

# do not include the sbom, because the SBoM unique IDs per file/package are *not* deterministic,
# (currently based upon syft), and thus will make the file non-reproducible

# the first one should build normally without a problem
linuxkit build --no-sbom --format tar --o "${NAME}-1.tar" ./test.yml

# second one should fail because the input tar has the same filename as the output tar
set +e
linuxkit build -v --no-sbom --format tar --input-tar "${NAME}-1.tar" --o "${NAME}-1.tar" ./test.yml 2>&1
ret="$?"
set -e

if [ "$ret" -eq 0 ]; then
echo "Expected the build to fail, but it succeeded"
exit 1
fi

exit 0
37 changes: 37 additions & 0 deletions test/cases/000_build/060_input_tar/010_same_filename/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
kernel:
image: linuxkit/kernel:6.6.13
cmdline: "console=tty0 console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:45a1ad5919f0b6acf0f0cf730e9434abfae11fe6
- linuxkit/runc:6062483d748609d505f2bcde4e52ee64a3329f5f
- linuxkit/containerd:e7a92d9f3282039eac5fb1b07cac2b8664cbf0ad
onboot:
- name: sysctl
image: linuxkit/sysctl:5a374e4bf3e5a7deeacff6571d0f30f7ea8f56db
- name: dhcpcd
image: linuxkit/dhcpcd:e9e3580f2de00e73e7b316a007186d22fea056ee
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
onshutdown:
- name: shutdown
image: busybox:latest
command: ["/bin/echo", "so long and thanks for all the fish"]
services:
- name: getty
image: linuxkit/getty:5d86a2ce2d890c14ab66b13638dcadf74f29218b
env:
- INSECURE=true
- name: rngd
image: linuxkit/rngd:cdb919e4aee49fed0bf6075f0a104037cba83c39
- name: nginx
image: nginx:1.19.5-alpine
capabilities:
- CAP_NET_BIND_SERVICE
- CAP_CHOWN
- CAP_SETUID
- CAP_SETGID
- CAP_DAC_OVERRIDE
binds:
- /etc/resolv.conf:/etc/resolv.conf
files:
- path: etc/linuxkit-config
metadata: yaml