Commit Graph

207 Commits (1d66f6f174514289ce4fdc991279b7c2b66cd0eb)

Author SHA1 Message Date
Kohei Tokunaga 3b7422996a cache: Clean up temporary mount pool on restart
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2022-02-23 16:33:25 +09:00
Kohei Tokunaga bed5a44d52 Enalbe estargz-based lazy pulling on registry cache importer
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2022-02-17 10:44:14 +09:00
Tonis Tiigi 4d0a3f9ff3 http: handle weak etags on comparisons
When server returns a weak etag, the prefix can
cause a mismatch on direct comparison with old value.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-02-13 21:21:38 -08:00
Erik Sipsma 0566b9a345 Add support for progress groups.
This allows clients to specify that LLB states should be grouped in
progress output under a custom name. Status updates for all vertexes in
the group will show up under a single vertex in the output.

The intended use cases are for Dockerfile COPY's that use MergeOp as a
backend and for grouping some other internal vertexes during frontend
builds.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-02-08 11:27:49 -08:00
Erik Sipsma bb09f3c032 Improve progress output for merge+diff ops.
Now, when a merge or diff ref is unlazied, the progress will show up
under the vertex for the merge/diff ref. Additionally, any ancestors of
the op that also need to be unlazied as part of unlazying the merge/diff
will show status updates under its vertex in the progress.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-02-08 11:26:05 -08:00
Tõnis Tiigi 93cddb5fd5
Merge pull request #2585 from hinshun/local-sm-get
Local should use session ID in op and only fallback to session group
2022-01-29 10:14:40 -08:00
Tõnis Tiigi edfc3f0d89
Merge pull request #2570 from alexcb/fix-git-clone-tag
Add support for annotated git tags
2022-01-29 10:14:23 -08:00
Edgar Lee b3e8c63a48 Local should use session ID in op and only fallback to session group if failed before transfer started
Signed-off-by: Edgar Lee <edgarl@netflix.com>
2022-01-28 15:18:43 -08:00
Alex Couture-Beil 9e1a9d24e8
Add support for git tags
This fixes errors such as:

    error: cannot update ref 'refs/heads/v2.30.0': trying to write non-commit object 2d9685d47a7e516281aa093bf0cddc8aafa72448 to branch 'refs/heads/v2.30.0'

which occur when cloning a tag rather than branch.

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2022-01-28 11:51:19 -08:00
Tonis Tiigi ffce8218e3 keep buffer of logs to show on failure when regular logs are clipped
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-24 21:30:46 -08:00
Tonis Tiigi dc21885891 hack: enable more linters
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-19 12:20:30 -08:00
coryb 397c98bdf8 fix panic from umask-git on invalid ref
If the ref is invalid we are seeing a panic from `umask-git` because
the error type is not always a unix.WaitStatus:
```
    #1 0.227 fatal: Not a valid object name 000111222333444555666777888999aaabbbcccd^{commit}
    #1 0.229 panic: interface conversion: interface {} is syscall.WaitStatus, not unix.WaitStatus
    #1 0.229
    #1 0.229 goroutine 1 [running]:
    #1 0.229 github.com/moby/buildkit/source/git.gitMain()
    #1 0.229 	/src/source/git/gitsource_unix.go:66 +0x27d
    #1 0.229 github.com/docker/docker/pkg/reexec.Init(...)
    #1 0.229 	/src/vendor/github.com/docker/docker/pkg/reexec/reexec.go:26
    #1 0.229 main.init.0()
    #1 0.229 	/src/cmd/buildkitd/main.go:76 +0xf6
    #1 0.633 fatal: reference is not a tree: 000111222333444555666777888999aaabbbcccd
    #1 0.635 panic: interface conversion: interface {} is syscall.WaitStatus, not unix.WaitStatus
    #1 0.635
    #1 0.635 goroutine 1 [running]:
    #1 0.635 github.com/moby/buildkit/source/git.gitMain()
    #1 0.635 	/src/source/git/gitsource_unix.go:66 +0x27d
    #1 0.635 github.com/docker/docker/pkg/reexec.Init(...)
    #1 0.635 	/src/vendor/github.com/docker/docker/pkg/reexec/reexec.go:26
    #1 0.635 main.init.0()
    #1 0.635 	/src/cmd/buildkitd/main.go:76 +0xf6
```

This is from trying to solve:
```
    llb.Git("https://github.com/moby/buildkit.git", "000111222333444555666777888999aaabbbcccd")
```

Signed-off-by: coryb <cbennett@netflix.com>
2022-01-03 15:59:26 -08:00
Tõnis Tiigi fce4a32258
Merge pull request #2335 from sipsma/mergeop-impl
MergeOp
2021-11-18 11:52:15 -08:00
Erik Sipsma d73e62f878 Add initial MergeOp implementation.
This consists of just the base MergeOp with support for merging LLB
results that include deletions using hardlinks as the efficient path
and copies as fallback.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-11-18 11:10:48 -08:00
Tõnis Tiigi 345c677b85
Merge pull request #2397 from tonistiigi/git-deterministic
git: make fetch with keep-git-dir more deterministic
2021-11-17 22:39:33 -08:00
Erik Sipsma 9321ec2f82 Refactor cache record mount cache.
This is mostly just preparation for merge-op. The existing
Extract method is updated to be usable for unlazying any type of refs
rather than just lazy blobs. The way views are created is simplified and
centralized in one location.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-11-17 11:02:16 -08:00
Erik Sipsma 03ed0548ef cache: Replace Parent method with LayerChain.
The Parent method will no longer make sense with forthcoming Merge and
Diff support as refs will become capable of having multiple parents. It
was also only ever used externally to get the full chain of refs for
each layer in the ref's chain.

The newly added LayerChain method replaces Parents with a method that
just returns a slice of refs for each layer in the ref's chain. This
will work more seamlessly with Merge and Diff (in which case it returns
the "flattened" ancestors of the ref) in addition to being a bit easier
to use for the exiting cases anyways.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-11-17 11:02:16 -08:00
CrazyMax 54b8ff2fc8
go fmt: add //go:build
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-28 13:26:43 +02:00
Tonis Tiigi 28250bf74e git: make fetch with keep-git-dir more deterministic
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-10-05 23:59:33 -07:00
Tõnis Tiigi 509b73d91e
Merge pull request #2356 from crazy-max/git-umask
Standard user umask for git process
2021-09-27 18:44:13 -07:00
CrazyMax 3f1152f657
Standard user umask for git process
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-27 20:10:19 +02:00
CrazyMax 5fcc94454f
Generate and embed build sources
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-18 01:39:35 +02:00
CrazyMax 8bb242e7ac
Refactor url redacting util
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-14 17:39:07 +02:00
Erik Sipsma a9f1980ebb Refactor cache metadata interface.
There are a few goals with this refactor:
1. Remove external access to fields that no longer make sense and/or
   won't make sense soon due to other potential changes. For example,
   there can now be multiple blobs associated with a ref (for different
   compression types), so the fact that you could access the "Blob"
   field from the Info method on Ref incorrectly implied there was just
   a single blob for the ref. This is on top of the fact that there is
   no need for external access to blob digests.
2. Centralize use of cache metadata inside the cache package.
   Previously, many parts of the code outside the cache package could
   obtain the bolt storage item for any ref and read/write it directly.
   This made it hard to understand what fields are used and when. Now,
   the Metadata method has been removed from the Ref interface and
   replaced with getters+setters for metadata fields we want to expose
   outside the package, which makes it much easier to track and
   understand. Similar changes have been made to the metadata search
   interface.
3. Use a consistent getter+setter interface for metadata, replacing
   the mix of interfaces like Metadata(), Size(), Info() and other
   inconsistencies.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-08-25 19:15:09 +00:00
Kohei Tokunaga f8d30d567e Add `estargz` compression type
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-08-24 14:10:09 +09:00
Erik Sipsma 4237175ac7 pull: use resolvemode in flightcontrol key.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-08-16 17:26:36 +00:00
Koichi Shiraishi 671ae38fb7
all: unify the specs-go package import alias to ocispecs
ocispecs means "O"pen "C"ontainer "I"nitiative image-spec/"specs"-go/v1
                      opencontainers          /image-spec/specs-go/v1

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2021-08-11 08:29:09 +09:00
coryb de0019bf35 fix dropped pull progress output due to canceled context
fixes #2248

Signed-off-by: coryb <cbennett@netflix.com>
2021-07-14 09:11:44 -07:00
Tonis Tiigi a558ac4cce add per domain semaphore to limit concurrent connections
This is a safer alternative until we figure out why
http.Transport based limiting fails.

Some connections like cache export/import do not have a
domain key atm and these connections use global pool.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-07-13 14:08:03 -07:00
Morlay 18b49fd7dc refactor to use util/bklog instead of using logurs directly
Signed-off-by: Morlay <morlay.null@gmail.com>
2021-07-13 11:42:31 +08:00
Tonis Tiigi fb32dad95b git: fix default branch detection
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-07-06 16:34:43 -07:00
Levi Harrison 2a8e0b11cd Fix tests
Unfortunately, further test cases will have to be removed because gitindentifier will now leave the branch blank instead of filling it in

Signed-off-by: Levi Harrison <levisamuelharrison@gmail.com>
2021-07-06 15:38:12 -07:00
Levi Harrison ccc9f20895 Moved getDefaultBranch function to gitsource
It is my suspecion that the tests were failing on previous commits because of the lack of authentication and other stuff like that available in gitidentifier as compared to gitsource

Signed-off-by: Levi Harrison <levisamuelharrison@gmail.com>
2021-07-06 15:38:00 -07:00
Levi Harrison 8604d7cef2 Automatically detect default git branch
Instead of just assuming that the default branch is master, use ls-remote to find out. Also removed tests that didn't specifiy a branch but required authentication, because those will fail now that the repo is actually checked.

Signed-off-by: Levi Harrison <levisamuelharrison@gmail.com>
2021-07-06 15:37:31 -07:00
Akihiro Suda be8ab28a0a
Merge pull request #2081 from tonistiigi/local-differ-none
Allow none differ on local source to avoid false Dockerfile matches
2021-07-01 09:42:24 +09:00
Cory Bennett b1d441b175 [#2112] progress.FromContext returns a writer factory
this allows progress.Controller to manage the writer lifecycle

Signed-off-by: Cory Bennett <cbennett@netflix.com>
2021-06-28 18:58:29 +00:00
Cory Bennett 1da8b671c4 [#2112] progress.Controller should own the progress.Writer to prevent leaks
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2021-06-28 18:56:45 +00:00
Tonis Tiigi a7b155e30c llb: don't allow content diff for now
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-11 21:15:10 -07:00
Tonis Tiigi baa4fcdb0f add differ support for local source
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-11 21:15:07 -07:00
Tõnis Tiigi 03af083def
Merge pull request #2144 from thaJeztah/bump_golang
update to go 1.16
2021-06-08 10:30:33 -07:00
Sebastiaan van Stijn 22dd74ae93
update to go 1.16
This updates all occurrences of Go 1.13 to Go 1.16; also updated
the code that's used to redact credentials in URLs to use the Go
implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-02 00:31:57 +02:00
Tonis Tiigi 3bdb6b5159 git: support subdir component
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-05-19 22:13:04 -07:00
Alex Couture-Beil 5d2fd7eb45 Redact credentials from URLs before returning errors
this is to prevent errors such as

    failed to fetch remote https://user:password@github.com/user/private-repo-failure.git: exit status 128

from leaking the password; now it will be displayed like:

    failed to fetch remote https://user:xxxxx@non-existant-host/user/private-repo.git: exit status 128

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2021-04-28 10:39:15 -07:00
Pierre Fenoll a471427331 Fix potential crash on nil value
Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
2021-04-15 15:01:02 +02:00
Tonis Tiigi 5bf64293f8 git: set token only for main remote access
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-02-19 00:25:35 -08:00
Alex Couture-Beil 3a5bdf0710 Move prefix check to isGitTransport
- rename IsSSHTransport to IsImplicitSSHTransport
- add testing for NewGitIdentifier

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2021-01-04 11:09:56 -08:00
Alex Couture-Beil 3fa063dcf3 move ssh regexp test to common location
- include testing
- improve hostname checking

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2020-12-10 17:10:38 -08:00
Alex Couture-Beil 23af9dcb86 require a username for git over ssh
Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2020-12-10 17:10:38 -08:00
Alex Couture-Beil b64f992917 Allow any ssh-user while cloning from git
- this allows one to use a non-standard ssh username like repo@host
rather than assuming it must be git@host

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2020-12-10 17:10:38 -08:00
Tonis Tiigi a6baa678ea fix building from git url without a protocol
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-12-09 18:40:34 -08:00