-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for "registry-mirrors" and "insecure-registries" to buildkit #37852
Conversation
e6b79b6
to
9eb0664
Compare
@tonistiigi ptal when you have a chance |
c16325e
to
9047d3b
Compare
Codecov Report
@@ Coverage Diff @@
## master #37852 +/- ##
==========================================
- Coverage 36.12% 36.12% -0.01%
==========================================
Files 610 610
Lines 45083 45114 +31
==========================================
+ Hits 16288 16296 +8
- Misses 26555 26580 +25
+ Partials 2240 2238 -2 |
Signed-off-by: Anda Xu <[email protected]>
9047d3b
to
3c14b8b
Compare
ac4e143
to
59482e0
Compare
ping @tiborvass @tonistiigi |
builder/builder-next/builder.go
Outdated
@@ -8,6 +8,8 @@ import ( | |||
"sync" | |||
"time" | |||
|
|||
"github.com/moby/buildkit/util/resolver" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: unneeded whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
daemon/daemon.go
Outdated
) | ||
// must trim "https://" prefix | ||
for i, v := range daemon.configStore.Mirrors { | ||
mirrors[i] = strings.Split(v, "//")[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is going to panic if there is no //
, which according to https://github.com/moby/moby/blob/master/registry/service_v2.go#L15 could happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaner to use strings.Index
, maybe like
if idx := strings.Index(v, "://"); idx > 0 {
v = v[idx+3:]
}
daemon/daemon.go
Outdated
// set "insecure-registries" | ||
for _, v := range daemon.configStore.InsecureRegistries { | ||
m[v] = resolver.RegistryConf{ | ||
PlainHTTP: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to get set if the mirror prefix is "http://"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmcgowan Ah I think I the "http://" prefix must be trimmed here as well. Otherwise, buildkit will add an extra prefix.
59482e0
to
0695415
Compare
0695415
to
0f24381
Compare
daemon/daemon.go
Outdated
mirrors = make([]string, len(daemon.configStore.Mirrors)) | ||
m = map[string]resolver.RegistryConf{} | ||
) | ||
// must trim "https://" prefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is http://
not valid in configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Actually I just learned it is also valid 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a trimming for that as well
Signed-off-by: Anda Xu <[email protected]>
0f24381
to
171d51c
Compare
LGTM |
@tiborvass @dmcgowan updated the PR based on the comments. Ptal when you have time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- What I did
registry-mirror
andinsecure-registries
fields fromdaemon.json
to buildkit in order to make use.daemon.json
file changes.- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)