Skip to content

builder: implement PullParent option with buildkit#37613

Merged
thaJeztah merged 1 commit intomoby:masterfrom
tiborvass:buildkit-pull
Aug 17, 2018
Merged

builder: implement PullParent option with buildkit#37613
thaJeztah merged 1 commit intomoby:masterfrom
tiborvass:buildkit-pull

Conversation

@tiborvass
Copy link
Copy Markdown
Contributor

Signed-off-by: Tibor Vass [email protected]

This allows to run docker build --pull ... when buildkit is enabled.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 14, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@b6242da). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master   #37613   +/-   ##
=========================================
  Coverage          ?   35.85%           
=========================================
  Files             ?      606           
  Lines             ?    44704           
  Branches          ?        0           
=========================================
  Hits              ?    16029           
  Misses            ?    26466           
  Partials          ?     2209

Copy link
Copy Markdown
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐯

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

SGTM

ping @tonistiigi PTAL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Noticed that puller.resolveLocal() still uses this constant; looking at where that's called that seems to be only used to determine if an image is in the cache, which likely isn't done until after this function (ResolveImageConfig()) has been called? Just wondering if that part of the code will also be configurable, or will be the only behavior (in which case we can remove the preferLocal constant)

if preferLocal {
dt, err := p.is.resolveLocal(p.src.Reference.String())
if err == nil {
p.config = dt
}
}

@thaJeztah thaJeztah added the area/builder Build label Aug 14, 2018
@tiborvass tiborvass force-pushed the buildkit-pull branch 2 times, most recently from 85b7c63 to cfa31c9 Compare August 17, 2018 08:25
@tiborvass
Copy link
Copy Markdown
Contributor Author

@vdemeester @thaJeztah I updated this. I fixed an issue whereby "local" would error out if local was not found, when in fact it just means "prefer" local, but still fallback to remote if cannot find. Ideally I'd like "pull" to also fallback to local (like when you're on the plane and don't have network).

Essentially there is no difference between "default" and "local", other than I use "default" so that in the future we may improve on the UX if we want to. Either way, right now, the behavior of --pull is the same between legacy and buildkit builders.

Copy link
Copy Markdown
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

Still LGTM 😉

@tiborvass
Copy link
Copy Markdown
Contributor Author

Just removed preferLocal constant.

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

triggered CI to do another run

dgst, dt, err := is.resolveRemote(ctx, ref, opt.Platform)
// TODO: pull should fallback to local in case of failure to allow offline behavior
// the fallback doesn't work currently
return dgst, dt, err
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit; could be

return is.resolveRemote(ctx, ref, opt.Platform)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@thaJeztah true, this was because the original (desired) code is the one commented out below in which case the assignments do make sense.

}

if opt.Options.PullParent {
frontendAttrs["image-resolve-mode"] = "pull"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thinking if it would be good to use the values that are / will be defined in source.ResolveMode

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@thaJeztah actually, could do it in a follow up once buildkit has a String() method on it. I don't want to rely on llb package at this level of abstraction.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yup; definitely not a blocker (same for my other comment) 👍

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.

5 participants