Skip to content
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

Merged
merged 2 commits into from
Sep 21, 2018

Conversation

AntaresS
Copy link
Contributor

@AntaresS AntaresS commented Sep 14, 2018

- What I did

  • update vendor with the recent patch from buildkit resolver: add config support for mirrors/plainhttp buildkit#612
  • integrated with moby side where buildkit is being invoked.
    • pass registry-mirror and insecure-registries fields from daemon.json to buildkit in order to make use.
    • supports live reloading when 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)

@AntaresS
Copy link
Contributor Author

@tonistiigi ptal when you have a chance

@AntaresS AntaresS force-pushed the patch-buildkit branch 5 times, most recently from c16325e to 9047d3b Compare September 16, 2018 19:29
@codecov
Copy link

codecov bot commented Sep 16, 2018

Codecov Report

Merging #37852 into master will decrease coverage by <.01%.
The diff coverage is 0%.

@@            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 <anda.xu@docker.com>
@AntaresS
Copy link
Contributor Author

ping @tiborvass @tonistiigi

@@ -8,6 +8,8 @@ import (
"sync"
"time"

"github.com/moby/buildkit/util/resolver"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: unneeded whitespace

Copy link
Contributor Author

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]
Copy link
Contributor

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.

Copy link
Member

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,
Copy link
Member

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://"?

Copy link
Contributor Author

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.

daemon/daemon.go Outdated
mirrors = make([]string, len(daemon.configStore.Mirrors))
m = map[string]resolver.RegistryConf{}
)
// must trim "https://" prefix
Copy link
Member

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?

Copy link
Contributor Author

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 😅

Copy link
Contributor Author

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

@dmcgowan
Copy link
Member

LGTM

@AntaresS
Copy link
Contributor Author

@tiborvass @dmcgowan updated the PR based on the comments. Ptal when you have time.

Copy link
Contributor

@tiborvass tiborvass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants