Commit Graph

565 Commits

Author SHA1 Message Date
Avi Deitcher
02fd6c48ee do not push if the tag and digest are identical
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-06-07 10:45:29 +03:00
Avi Deitcher
6cd8a874a6 do not try to build or push if no architectures are available
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-06-07 10:25:41 +03:00
Yuri Volchkov
1a013f4424 Declare build-args in build.yml
This allows multiple build flavors for a single codebase, without
sacrificing reproducible builds. The build-args are set in build.yml,
which is typically under the source control (if it is not, then no
reproducible builds are possible anyways). Meaning that mutating
build-args would result in setting "dirty" flag.

Intended use of this commit is to switch between build flavors by
specifying a different yaml file (presumably also under the version
control)  by  `-build-yml` option.

Because it is impossible to build a final image from packages in
cache, the test for this feature relies on the `RUN echo $build-arg`
output during the `pkg build` process.

Signed-off-by: Yuri Volchkov <yuri@zededa.com>
2022-04-13 17:36:55 +00:00
Avi Deitcher
b3f276f8f9 update linuxkit/init dependencies
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-03-21 14:15:28 +02:00
Avi Deitcher
200e0ee94a update dependencies of pkg/init and pkg/containerd
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-03-21 01:22:19 +02:00
David Scott
f14ad44ce4 update shas for pkg/init
Signed-off-by: David Scott <dave@recoil.org>
2022-03-13 19:57:25 +00:00
Avi Deitcher
1df038e1b0 Merge pull request #3753 from deitch/rationalize-args
replace Build many args with opts struct
2022-01-14 11:21:37 +02:00
Avi Deitcher
f6b9dc1717 replace Build many args with opts struct
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-01-13 12:50:58 +02:00
Dave Tucker
0b739c80e9 pkg: update shas
Update the SHA of all packages that have been go-mod-ififed
such that they are use for testing in CI

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2022-01-12 00:04:37 +00:00
Avi Deitcher
84e3b80863 pass target architecture explicitly
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-01-10 10:36:22 +02:00
David Scott
6a11c118f4 Merge pull request #3678 from olljanat/docker-run-print-stderr
Print docker run stderr in-case of error
2021-12-30 10:37:30 +00:00
David Scott
341c4a4f5e Update shas for linuxkit/runc
./scripts/update-component-sha.sh linuxkit/runc:21dbbda709ae138de0af6b0c7e4ae49525db5e88  linuxkit/runc:9f7aad4eb5e4360cc9ed8778a5c501cce6e21601

Signed-off-by: David Scott <dave@recoil.org>
2021-12-16 19:10:58 +01:00
Frédéric Dalleau
36853c74ef Revert "runc: don't mount /dev with ro"
This reverts commit 380f36cc1a.

Now that runc includes a fix for this, this patch can be reverted

Signed-off-by: Frédéric Dalleau <frederic.dalleau@docker.com>
2021-12-16 19:10:58 +01:00
谢瑶瑶
f5a720bcbb fix: #3742 golint requires comments on non-main package for blank import
Signed-off-by: 谢瑶瑶 <yaoyao.xyy@alibaba-inc.com>
2021-12-14 13:50:59 +08:00
Avi Deitcher
46ef83c979 Merge pull request #3702 from deitch/alpine-314
bump alpine to 3.14, remove go version hack
2021-11-16 14:56:01 +02:00
Avi Deitcher
58813e8791 bump go-containerregistry and manifest-tool to latest
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-11-09 18:48:06 +02:00
Avi Deitcher
260cc85b52 Update package tags
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-11-09 14:02:43 +02:00
Avi Deitcher
bcbabcac28 Update use of test packages to latest
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-11-09 14:02:41 +02:00
Avi Deitcher
897d7a5071 Update use of tools to latest
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-11-07 16:40:26 +02:00
Avi Deitcher
e1dd1af1b9 extract more hard-coded yaml
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-11-05 13:07:06 +02:00
Avi Deitcher
0660ace86f extract hard-coded default image builders into file
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-11-04 14:51:15 -04:00
David Scott
f5f5dce318 linuxkit: fix pkg build on Windows
Previously when we set `cmd.Stderr = os.Stderr`, the stderr from buildx
would be mixed with the image tar, corrupting it.

Work around this (Windows-specific) problem by adding an explicit
indirection via a io.Pipe()

Signed-off-by: David Scott <dave@recoil.org>
2021-10-29 12:01:35 +01:00
David Scott
e8f8a409e8 Update hashes for pkg/init
Signed-off-by: David Scott <dave@recoil.org>
2021-10-26 19:52:22 +01:00
David Scott
d4c6ab742b Update hashes for pkg/...
Signed-off-by: David Scott <dave@recoil.org>
2021-10-18 21:02:44 +01:00
David Scott
380f36cc1a runc: don't mount /dev with ro
After runc 1.0.0-rc92 mounting /dev with ro will fail to start the
container with an error trying to `mkdir /dev/...` (for example
`/dev/pts`). This can be observed following the runc example

Comparing our `config.json` with the working one generated by
`runc spec`, both have a readonly rootfs (good) but the `runc spec`
one does not set `ro` in the `/dev` mount options.

This patch fixes readonly onboot containers by removing the "ro"
option from `/dev`, to match the `runc spec` example.

Signed-off-by: David Scott <dave@recoil.org>
2021-10-18 21:00:04 +01:00
Rolf Neugebauer
0dd8086d39 Update YAMLs to latest runc/containerd/test-containerd
Signed-off-by: Rolf Neugebauer <rn@rneugeba.io>
2021-10-16 16:57:15 +01:00
David Scott
46ea02f65b moby: device "all" will add to the cgroup whitelist
After the runc security advisory[1] the default cgroup device
whitelist was changed.

In previous versions every container had "rwm" (read, write, mknod)
for every device ("a" for all). Typically this was overridden by
container engines like Docker. In LinuxKit we left the permissive
default.

In recent `runc` versions the default allow-all rule was removed,
so a container can only access a device if it is specifically
granted access, which LinuxKit handles via a device: entry.

However it is inconvenient for pkg/format, pkg/mount, pkg/swap
to list all possible block devices up-front. Therefore we add the
ability to grant access to an entire class of device with a single
rule:

```
- path: all
  type: b
```

Obviously a paranoid user can still override this with a specific
major/minor number in a device: rule.

[1] https://github.com/opencontainers/runc/security/advisories/GHSA-g54h-m393-cpwq

Signed-off-by: David Scott <dave@recoil.org>
2021-10-14 16:14:21 +01:00
David Scott
24db42dd68 moby: add a Devices array to the image yml
According to https://github.com/linuxkit/linuxkit/pull/3684#issuecomment-860128095

runc removed the console as a default device, so now it must be specified
explicitly in the OCI config.

See 60e21ec26e

The similar code in moby/moby is here: https://github.com/moby/moby/blob/master/oci/devices_linux.go

This patch allows packages to declare a `devices` array, which can contain `/dev/console` etc.

Signed-off-by: David Scott <dave@recoil.org>
2021-10-14 16:14:05 +01:00
David Scott
c779e894da Fix linuxkit run qemu on macOS on Apple Silicon
Signed-off-by: David Scott <dave@recoil.org>
2021-10-13 14:38:20 +01:00
Avi Deitcher
ebbb1281f3 one-more
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-06-23 13:40:55 +03:00
Avi Deitcher
a05b0ac923 check for arch when pulling to cache, push by descriptor
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-06-21 23:33:34 +03:00
Avi Deitcher
873f61e695 bump manifest-tool to latest
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-06-15 20:28:44 +03:00
Avi Deitcher
df36b7aa7d Push arch-specific tags, always build index from registry
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-06-10 13:33:16 +03:00
Olli Janatuinen
49cbe047ce Print docker run stderr in-case of error
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2021-05-26 22:55:52 +03:00
Dave Tucker
6312d58032 Merge pull request #3659 from edvinerikson/fix-install
fix: make command
2021-05-26 14:27:52 +01:00
Dave Tucker
452910c625 Makefile: Don't encode bindir in the tar archive
Prior to this commit we go build -o bin/foo, archive it, and
expand the archive, leaving the resulting artifact in bin.

This doesn't allow us to easily change the bin directory, or
move parts of the makefile around to make things more modular.

This commit changes the behaviour to:
go build -o foo, archive it, expand to `bin`

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2021-05-26 11:18:41 +01:00
Avi Deitcher
4795c993ee Add support for cache export
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-05-26 13:13:37 +03:00
Roman Shaposhnik
378cfc0b3d Allowing linuxkit to recongnize linux/riscv64 arch
Signed-off-by: Roman Shaposhnik <rvs@zededa.com>
2021-05-19 12:34:07 -07:00
Avi Deitcher
f7ee51d931 add v1tarreader for images and use it for docker load
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-05-18 18:14:23 +03:00
Avi Deitcher
ebf570d045 refactor buildContext into a simple stdin reader
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-05-18 18:14:23 +03:00
Avi Deitcher
dd09b7d77a simplify nobuild/force/build logic
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-05-18 18:14:22 +03:00
Edvin Eriksson
f4c4ab1c8c fix: install linuxkit in top-level bin folder
Signed-off-by: Edvin Eriksson <edvin.erikson@leovegas.com>
2021-05-07 14:22:15 +02:00
Avi Deitcher
31ed260e4a Build or push multiple packages at once
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-05-05 16:52:27 -04:00
Dave Tucker
0320678133 build: Add --skip-platforms flag
This adds a --skip-platforms flag that can be used with
lkt pkg build to ignore any arch specified in build.yml

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2021-05-02 17:31:27 +01:00
Dave Tucker
54185c8a3f pkglib: Rename v1 to registry
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2021-05-02 17:30:59 +01:00
Dave Tucker
981fb7ff32 pkglib: Add missing comment to FullTag
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2021-05-02 17:30:53 +01:00
Dave Tucker
907dc5394b pkglib: Don't error on platform mismatch
This prevents override of the platform by the user.
lkt pkg build --platform=linux/amd64 pkg/bpftrace should
attempt to build that package for that arch even though
it is not in the build.yml

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2021-05-02 12:28:43 +01:00
Avi Deitcher
58136486c6 Merge pull request #3646 from deitch/canonicalize-names
always use canonical names in the linuxkit cache
2021-04-30 16:55:48 +03:00
Avi Deitcher
9bb26e4c3a always use canonical names in the linuxkit cache
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-04-30 15:12:39 +03:00
Dave Tucker
93ada489f9 make: Fix for local builds outside of GOPATH
Go can be weird about tools having to run in a directory with
go.mod. This commit moves the linuxkit makefile to the same
directory as the code.

It also changes the semantics of the local-build target.
You can now use STATIC=0 for dynamic builds or PIE=1 to
use --buildmode=pie. The binaries we were producing in
local-static weren't actually static so I fixed that too

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2021-04-30 09:31:00 +01:00