Commit graph

178 commits

Author SHA1 Message Date
Sebastiaan van Stijn
910d5c44fc
api: add BuildCache.Parents for API >= v1.42
This field was added to replace the deprecated "Parent" field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e0db8207f3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-04 09:33:35 +02:00
Sebastiaan van Stijn
0e3d20cb20
api: deprecate BuildCache.Parent in API >= v1.42
This field has been deprecated in BuildKit, so this follows the deprecation
in the Engine API.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ebf339628a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-04 09:33:33 +02:00
Erik Sipsma
88916949ef
build: force unlazy of refs by calling extract
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-06-24 11:54:41 +02:00
CrazyMax
795ecf02ce
builder: fix empty reference
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-05-28 21:23:30 +02:00
Sebastiaan van Stijn
0a3336fd7d
Merge pull request #43366 from corhere/finish-identitymapping-refactor
Finish refactor of UID/GID usage to a new struct
2022-03-25 14:51:05 +01:00
CrazyMax
fda0226a89
builder: add buildinfo for buildkit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-03-23 16:07:03 +01:00
CrazyMax
b899db6423
builder: enable shm-size and ulimit for buildkit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-03-23 16:07:03 +01:00
CrazyMax
aadb3bf766
builder: changes needed since buildkit 0.10.0
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-03-23 16:07:03 +01:00
CrazyMax
a2aaf4cc83
vendor buildkit v0.10.0
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-03-22 18:51:27 +01:00
Cory Snider
098a44c07f Finish refactor of UID/GID usage to a new struct
Finish the refactor which was partially completed with commit
34536c498d, passing around IdentityMapping structs instead of pairs of
[]IDMap slices.

Existing code which uses []IDMap relies on zero-valued fields to be
valid, empty mappings. So in order to successfully finish the
refactoring without introducing bugs, their replacement therefore also
needs to have a useful zero value which represents an empty mapping.
Change IdentityMapping to be a pass-by-value type so that there are no
nil pointers to worry about.

The functionality provided by the deprecated NewIDMappingsFromMaps
function is required by unit tests to to construct arbitrary
IdentityMapping values. And the daemon will always need to access the
mappings to pass them to the Linux kernel. Accommodate these use cases
by exporting the struct fields instead. BuildKit currently depends on
the UIDs and GIDs methods so we cannot get rid of them yet.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2022-03-14 16:28:57 -04:00
Sebastiaan van Stijn
a0230f3d9a
remove unneeded "digest" alias for "go-digest"
I think this was there for historic reasons (may have been goimports expected
this, and we used to have a linter that wanted it), but it's not needed, so
let's remove it (to make my IDE less complaining about unneeded aliases).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-04 14:49:42 +01:00
Sebastiaan van Stijn
32e5fe5099
Merge pull request #43182 from thaJeztah/layer_remove_unused_error
layer: remove unused error return from .Size() and .DiffSize()
2022-02-17 20:51:45 +01:00
Sebastiaan van Stijn
e1ea911aba
layer: remove unused error return from .Size() and .DiffSize()
None of the implementations used return an error, so removing the error
return can simplify using these.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-24 18:45:47 +01:00
Sebastiaan van Stijn
bb66ebd621
distribution: xfer.LayerDownloadManager.Download(): remove "os" argument
This argument was added for LCOW support, but it was only used to verify if
the passed platform (OS) matched the host. Given that all uses of this function
(except for one) passed runtime.GOOS, we may as well move the check to that
location.

We should do more cleaning up after this, and perform such validations early,
instead of passing platform around in too many places where it's only used for
similar validations. This is a first step in that direction.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-21 15:07:55 +01:00
Sebastiaan van Stijn
0b0a995d9d
distribution: remove RootFSDownloadManager interface
This interface only had a single implementation (xfer.LayerDownloadManager),
and all places where it was used already imported the xfer package.
Removing the interface, also makes it a closer match to the "upload" part,
as `xfer.LayerUploadManager()` did not use an interface.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-21 13:53:36 +01:00
CrazyMax
b4e056d556 buildkit: normalize build target and local platform
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-19 17:11:06 +02:00
Eng Zer Jun
c55a4ac779
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated in Go 1.16. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-08-27 14:56:57 +08:00
Sebastiaan van Stijn
686be57d0a
Update to Go 1.17.0, and gofmt with Go 1.17
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-24 23:33:27 +02:00
Akihiro Suda
9e8cf1016e
Merge pull request #42473 from thaJeztah/unfork_buildkit
revendor BuildKit (master branch)
2021-06-17 10:56:25 +09:00
Sebastiaan van Stijn
3eb1257698
revendor BuildKit (master branch)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-16 01:17:48 +02:00
Sebastiaan van Stijn
bb17074119
reformat "nolint" comments
Unlike regular comments, nolint comments should not have a leading space.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-10 13:03:42 +02:00
Sebastiaan van Stijn
dd1374f7b2
if-return: redundant if ...; err != nil check (revive)
builder/builder-next/adapters/snapshot/snapshot.go:386:3: if-return: redundant if ...; err != nil check, just return error instead. (revive)
            if err := b.Put(keyIsCommitted, []byte{}); err != nil {
                return err
            }

    plugin/fetch_linux.go:112:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
        if err := images.Dispatch(ctx, images.Handlers(handlers...), nil, desc); err != nil {
            return err
        }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-10 13:03:40 +02:00
Sebastiaan van Stijn
e047d984dc
Remove LCOW code (step 1)
The LCOW implementation in dockerd has been deprecated in favor of re-implementation
in containerd (in progress). Microsoft started removing the LCOW V1 code from the
build dependencies we use in Microsoft/opengcs (soon to be part of Microsoft/hcshhim),
which means that we need to start removing this code.

This first step removes the lcow graphdriver, the LCOW initialization code, and
some LCOW-related utilities.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-03 21:16:21 +02:00
Brian Goff
4b981436fe Fixup libnetwork lint errors
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 23:48:32 +00:00
Brian Goff
a0a473125b Fix libnetwork imports
After moving libnetwork to this repo, we need to update all the import
paths for libnetwork to point to docker/docker/libnetwork instead of
docker/libnetwork.
This change implements that.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 21:51:23 +00:00
Tonis Tiigi
85167fc634 builder-next: relax second cache key requirements for schema1
Schema1 images can not have a config based cache key
before the layers are pulled. Avoid validation and reuse
manifest digest as a second key.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-05-12 22:44:07 -07:00
Tibor Vass
3c9b4a63b5
Merge pull request #42056 from thaJeztah/bump_buildkit
vendor: github.com/moby/buildkit v0.8.2
2021-02-24 22:26:53 -08:00
Tibor Vass
9bf93e90fa builder: fix incorrect cache match for inline cache with empty layers
See https://github.com/moby/buildkit/pull/1993

Signed-off-by: Tibor Vass <tibor@docker.com>
2021-02-25 01:49:22 +00:00
Tibor Vass
271b43c43f
Merge pull request #42020 from tonistiigi/lease-blobs-fixes
builder: fix blobs releasing via leases after pull
2021-02-23 08:36:38 -08:00
Tonis Tiigi
b53ea19c49 builder: fix pull synchronization regression
Config resolution was synchronized based on a wrong key as ref
variable is initialized only after in the same function. Using
the right key isn't fully correct either as the synchronized method
changes properties of the puller instance and can't be just skipped.
Added better error handling for the same case as well.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-02-16 22:48:37 -08:00
Tonis Tiigi
5c01d06f72 builder: fix blobs releasing via leases after pull
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-02-12 20:27:16 -08:00
Tibor Vass
8d3179546e
Merge pull request #41966 from thaJeztah/CVE-2021-21285_master
[master] prevent an invalid image from crashing docker daemon (CVE-2021-21285)
2021-02-02 09:16:18 -08:00
Brian Goff
c747d9f8ee
pull: Validate layer digest format
Otherwise a malformed or empty digest may cause a panic.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit a7d4af84bd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-02 13:37:24 +01:00
Brian Goff
94c07441c2
buildkit: Apply apparmor profile
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 611eb6ffb3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-02 13:32:24 +01:00
Tonis Tiigi
7c7e168902 builder: ensure libnetwork state file do not leak
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-01-07 11:16:20 -08:00
Sebastiaan van Stijn
73571e4689
vendor: github.com/moby/buildkit v0.8.0-rc2
full diff: 6861f17f15...v0.8.0-rc2

- dockerfile: rename experimental channel to labs
- dockerfile build: fix not exit when meet error in load config metadata
- copy containerd.UnknownExitStatus to local const to reduce dependency graph in client
- executor: switch to docker seccomp profile
- add retry handlers to push/pull
- SSH-based auth for llb.Git operations
- Allow gateway exec-ing into a failed solve with an exec op
- Fix parsing ssh-based git sources
- Fix sshkeyscan to work with ipv6
- fix assumption that ssh port must be 2 digits
- vendor: github.com/Microsoft/go-winio v0.4.15
- vendor: github.com/tonistiigi/fsutil v0.0.0-20201103201449-0834f99b7b85
- vendor: containerd v1.4.1-0.20201117152358-0edc412565dc
- vendor: golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-11-19 10:31:35 +01:00
Tibor Vass
dbffbe8f9b builder-next: fix platform-specific behavior
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-11-17 02:33:01 +00:00
Tibor Vass
39f9c1b5d1 builder-next: fix --cache-from panic
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-11-14 03:57:36 +00:00
Tibor Vass
8f464ae2ab builder-next: refactor to use flighcontrol and remove resolveOnce
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-11-14 03:57:36 +00:00
Tibor Vass
1b1eb094cc builder-next: simple refactor
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-11-14 03:57:36 +00:00
Tibor Vass
3756668adb builder-next: Refactor using buildkit's resolver pool
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-11-14 03:57:36 +00:00
Tibor Vass
de56a90929 vendor buildkit 6861f17f15364de0fe1fd1e6e8da07598a485123
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-11-14 03:57:36 +00:00
Wang Yumu
2b22a2e792 fix buildkit pull nil panic
Signed-off-by: Wang Yumu <37442693@qq.com>
2020-07-29 07:48:50 +08:00
Tonis Tiigi
8774804ca7 vendor: update buildkit to 4d1f260e8
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-20 11:34:22 -07:00
Tonis Tiigi
9b28939345 vendor: update buildkit to df35e9818
Update to new buildkit and fix upgrade bugs

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-06-15 09:44:41 -07:00
Tonis Tiigi
a430bc5d5f builder-next: fix layer access bug
After switch to leases all ref IDs use generated IDs meaning that
EnsureLayer hack needs to save the chainID for pulled layers.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-05-12 20:24:07 -07:00
Tonis Tiigi
0cdf6ba9c8 vendor: update buildkit to ae7ff174
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-14 08:26:07 -07:00
Sebastiaan van Stijn
08e3da51f7
Merge pull request #40790 from cpuguy83/fix_builder_variant_check
Only check variant if set on image.
2020-04-09 20:57:13 +02:00
Brian Goff
fe2aca0e39 Only check variant if set on image.
This fixes an edge case where some images may not have a variant set
just because it didn't used to get set.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-04-07 15:09:12 -07:00
Tonis Tiigi
5ad981640f builder: fix concurrent map write
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-03 15:33:15 -07:00