Commit Graph

820 Commits

Author SHA1 Message Date
Avi Deitcher
a3f3f5630b Merge pull request #3842 from dgageot/remove-ioutil
Remove 99% of deprecated ioutil usage (src/cmd/linuxkit)
2022-10-09 15:53:57 +03:00
David Gageot
17b92c7f5a Prefer nil empty slices
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-09 13:02:23 +02:00
David Gageot
7687de2d20 Remove 99% of deprecated ioutil usage
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-09 10:27:49 +02:00
David Gageot
d7ec2209b1 Remove dead code
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-07 18:46:38 +02:00
Avi Deitcher
07adfa2bb8 Merge pull request #3831 from dgageot/support-docker-over-ssh
Support remote docker over ssh
2022-10-07 14:43:35 +03:00
David Gageot
eda59aa5ab Feedback
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-06 14:00:00 +02:00
David Gageot
c977b1b306 Use faster gzip library
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-06 13:08:56 +02:00
David Gageot
780c28dba7 Memoize docker client to avoid consuming a new ssh connection each time
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-03 15:22:21 +02:00
David Gageot
ea863184ce Support connecting to docker over ssh
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-03 14:25:09 +02:00
David Gageot
4df610741d Don't use deprecated api
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-03 14:10:15 +02:00
Avi Deitcher
cec33f0c84 allow setting cache dir via env var
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-09-23 13:27:14 +03:00
Avi Deitcher
e532e73108 Merge pull request #3825 from giggsoff/fix-dep
Fix github.com/docker/go-units import
2022-09-13 16:51:24 +03:00
Petr Fedchenkov
227b02a8bd Fix github.com/docker/go-units import
Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-09-13 14:52:32 +03:00
Avi Deitcher
5f3856c94c Merge pull request #3823 from giggsoff/clean_builder_cache
Builder disk usage and clean
2022-09-13 14:47:09 +03:00
Petr Fedchenkov
45a5c97931 Builder disk usage and clean
We use dedicated docker container as builder and we are able to clean
data inside only by re-creating of it. Let's add disk usage and clean
commands for builder.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-09-13 13:33:46 +03:00
Petr Fedchenkov
57148029cd Fix consistently building of multiple arch
We cannot build for another arch after building for one arch because of
setting skipBuild to true if one arch found. In other words "linuxkit
pkg build --platforms linux/riscv64,linux/amd64 ..." after "linuxkit pkg
 build --platforms linux/amd64 ..." will not build for linux/riscv64
 which is not expected.

In general when we check for available images and able to found part of
platforms we do not want to rebuild all of them. So this PR includes
platformsToBuild slice which we fill with platforms we want to build for
.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-09-13 11:58:23 +03:00
Petr Fedchenkov
a46e6af650 Allow build for darwin without CGO
It is not easy to use cross-platform build with CGO enabled so lets
allow build without cgo for darwin and use virtualization framework only
 if we built with CGO.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-09-12 11:41:37 +03:00
Avi Deitcher
ceaeac88b6 Merge pull request #3818 from deitch/optional-tag
add option to override tag name when exporting
2022-09-12 09:48:52 +03:00
Petr Fedchenkov
49f8faffe0 Skip files in contentHash()
If we cannot open file for some reason it is better to skip it instead
of exit. Also we should skip symlinks and directories.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-09-08 17:34:21 +03:00
Petr Fedchenkov
3699177d1a Add all valid arches to ImageLoad
We should expand the list of supported arches to be able to build them if we want. Without this we will stuck on sending tarball during build for riscv64.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-09-08 12:14:49 +03:00
Petr Fedchenkov
8217737525 Append dirty tag with content hash
To be able to identify successive file changes without commit, we should
 use their hash in tag alongside with dirty flag
 (<ls-tree>-dirty-<content hash>).

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-09-07 11:29:43 +03:00
Avi Deitcher
3a2ecfc6d5 add option to override tag name when exporting
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-09-06 14:18:49 +03:00
Avi Deitcher
5f37332f4a Merge pull request #3816 from deitch/cache-export-filesystem
add ability to export filesystem
2022-09-05 11:08:28 +03:00
Avi Deitcher
7e65df33be add ability to export filesystem
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-08-29 18:23:43 +03:00
Avi Deitcher
1303ae4e73 Merge pull request #3810 from giggsoff/do-not-pull-another-arch
Do not pull another arch and index cleanup
2022-08-25 15:27:12 +03:00
Petr Fedchenkov
fe46d9bf05 Do not pull another arch
We pull all arches for the image which is suboptimal in terms of storage
 consumption. Let's pull only required platforms.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-08-25 12:29:35 +03:00
Petr Fedchenkov
82681c0333 uefi and tpm flags for aws push
Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-08-23 10:58:24 +03:00
Petr Fedchenkov
364f66a5b8 Update aws vendoring and mod tidy
Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-08-23 10:23:45 +03:00
Avi Deitcher
bc5084df99 verbosity for pkg build and error catching
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-08-14 11:06:02 -07:00
Avi Deitcher
acdfb911ac bump manifest-tool to support OCI index media-type and consume it
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-07-29 00:18:13 +03:00
Avi Deitcher
b28621b95a add ability to just update manifest
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-07-28 10:46:45 +03:00
Avi Deitcher
239d4d9502 Merge pull request #3764 from deitch/virtualization-framework
add support for virtualization framework
2022-07-28 10:46:13 +03:00
Petr Fedchenkov
2fd7ff7ff0 Restart of the builder container
We check only for existence of builder container and do not start it in
case of not running state. We should start it for example after reboot
of node to be able to build something.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-07-27 19:01:47 +03:00
Avi Deitcher
de1d8cdeda add support for virtualization framework
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-07-22 16:55:47 +03:00
Petr Fedchenkov
3540a1bc34 Update buildkit to have platform fix
We noticed that we use host arch when we want to use previously build
image in oci-layout. Let's use fix on buildkit side and improve test.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-07-22 12:25:39 +03:00
Petr Fedchenkov
5763c4f4bc Ability to parse args from Dockerfile
We should check if we have args in "FROM" and replace them:

ARG IMAGE=linuxkit/img
FROM ${IMAGE} as src

will be parsed as

FROM linuxkit/img as src

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-07-20 17:07:43 +03:00
Avi Deitcher
403e8f9353 Merge pull request #3797 from deitch/use-images-from-cache
add support for building from cached images
2022-07-20 09:19:47 -04:00
Petr Fedchenkov
39f1649995 Allow store to docker multiarch builds
We do not allow to load into docker images that are targets another
platform differ from current arch. Assume this is because of no support
of manifest. But we can keep all images in place by adding arch suffix
and using tag without arch suffix to point onto current system arch. It
will help to use images from docker for another arch.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-07-15 16:51:18 +03:00
Avi Deitcher
a90ff542cd add support for building from cached images
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-07-14 12:53:34 +03:00
Davide Brini
860934d5d9 New output format: iso-efi-initrd
This option was previously not available and required postprocessing of a `tar-kernel-initrd` output.

Comparison with `iso-efi`:

`iso-efi` only loads the kernel at boot, and the root filesystem is mounted from the actual boot media (eg, a CD-ROM - physical or emulated). This can often cause trouble (it has for us) for multiple reasons:
- the linuxkit kernel might not have the correct drivers built-in for the hardware (see #3154)
- especially with virtual or emulated CD-ROMs, performance can be abysmal: we saw the case where the server IPMI allowed using a ISO stored in AWS S3 over HTTP...you can imagine what happens when you start doing random I/O on the root fs in that case.
- The ISO image has the root device name baked in (ie, `/dev/sr0`) which fails if for some reason the CD-ROM we're running from doesn't end up using that device, so manual tweaking is required (see #2375)

`iso-efi-initrd`, on the other hand, packs the root filesystem as an initramfs (ie similar to what the raw output does, except that in this case we're preparing an ISO image), so both the kernel and the initramfs are loaded in memory by the boot loader and, once running, we don't need to worry about root devices or kernel drivers (and the speed is good, as everything runs in RAM).

Also, the generated ISO can be copied verbatim (eg with `dd`) onto a USB media and it still works.

Finally, the image size is much smaller compared to `iso-efi`.

IMHO, `iso-efi-initrd` could be used almost anywhere `iso-efi` would be used, or might even supersede it. I can't think of a scenario where one might explicitly want to use `iso-efi`.

Points to consider:

- Not tested under aarch64 as I don't have access to that arch. If the automated CI tests also test that, then it should be fine.
- I'm not sure what to put inside `images.yaml` for the `iso-efi-initrd` image. As it is it works of course (my personal image on docker hub), but I guess it'll have to be some more "official" image. However, that cannot be until this PR is merged, so it's kind of a chicken and egg situation. Please advise.
- I can look into adding the corresponding `iso-bios-initrd` builder if there is interest.

![cute seal](https://sites.psu.edu/siowfa16/files/2016/09/baby-seal-29vsgyf-288x300.jpg)

Signed-off-by: Davide Brini <waldner@katamail.com>
2022-07-11 20:26:14 +02:00
Davide Brini
9edeba42d7 Fix: #3799 golint requires comments on non-main package for blank import
Signed-off-by: Davide Brini <waldner@katamail.com>
2022-07-10 11:55:51 +02:00
Avi Deitcher
9c95286a35 add docs to the cache spec
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-07-01 15:30:22 +03:00
Avi Deitcher
7778f34c0c Merge pull request #3791 from deitch/direct-buildkit
build directly with buildkit
2022-07-01 12:29:20 +03:00
Avi Deitcher
0929aabe50 build directly with buildkit
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-06-28 10:36:30 +03:00
Avi Deitcher
fb111d3bbf add buildkit module and update packages and vendor
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-06-28 10:35:45 +03:00
Petr Fedchenkov
a51f40f68b Support for vTPM on GCP
Add options to support vTPM-enabled VMs on GCP

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
2022-06-21 16:53:41 +03:00
Avi Deitcher
9218f2577d when no archs for pkg to build, should continue rather than return, or it misses other packages
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2022-06-07 19:45:35 +03:00
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