-
Notifications
You must be signed in to change notification settings - Fork 14
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 Buildkit Option #434
Add Buildkit Option #434
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. |
I imagine there might be other uses of the |
@@ -3039,6 +3039,11 @@ | |||
}, | |||
"description": "An optional map of named build-time argument variables to set during the Docker build. This flag allows you to pass built-time variablesthat can be accessed like environment variables inside the RUN instruction." | |||
}, | |||
"builderVersion": { | |||
"type": "string", |
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.
Should we make this an enum instead? https://www.pulumi.com/docs/guides/pulumi-packages/schema/#complextype
provider/resources.go
Outdated
"`BuilderV1` - the first generation builder in docker daemon\n" + "" + | ||
"`BuilderBuildKit - the builder based on moby/buildkit project\n " + | ||
"Defaults to `BuilderBuildKit`.", | ||
TypeSpec: schema.TypeSpec{Type: "string"}, |
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.
See above comment on perhaps representing this as an enum instead?
I have filed a feature request for pulumi/pulumi/sdk/go to build some helper methods to simplify or eliminate the marshaling code here pulumi/pulumi#11530 |
provider/image.go
Outdated
|
||
// build can be nil, a string or an object; we will also use reasonable defaults here. | ||
var build Build | ||
if b.IsNull() { | ||
// use the default build context | ||
//// use the default build context |
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.
typo?
provider/image_test.go
Outdated
@@ -162,7 +163,7 @@ func TestMarshalBuildAndApplyDefaults(t *testing.T) { | |||
"extraOptions": resource.NewArrayProperty([]resource.PropertyValue{}), | |||
}) | |||
|
|||
actual := marshalBuildAndApplyDefaults(input) | |||
actual, _ := marshalBuildAndApplyDefaults(input) |
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.
A bit more verbose but could use
actual, err := ...
assert.NoError(t, err)
This makes a lot of sense and LGTM except I echo Vivek's desire to try to make it an enum for better discoverability. I also wonder if we accumulate this in pending release notes somewhere? This would be great to highlight to users as part of release notes ("here's how it used to work, and here is how it works now"). |
I was also curious about this: type Build struct {
...
Env map[string]string `pulumi:"env"`
Args map[string]*string `pulumi:"args"` // why *string here? is there a special meaning for nil?
} |
Does the PR have any schema changes?Looking good! No breaking changes found. |
@t0yv0 - re: the string pointer - yes! pretty much exactly this for |
}, | ||
{ | ||
"name": "BuilderBuildKit", | ||
"description": "The builder based on moby/buildkit project", |
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.
Should we also mention that this is the default in the description?
This PR makes an opinionated choice about Docker Buildkit.
Background: The Docker client can run in two separate modes,
BuilderV1
which is the classic Docker builder, andBuilderBuildKit
, which is the version of the client that providers BuildKit support.These modes are set via the
Version
field on the ImageBuildOptions. When this field is unset or nil, the Docker client runs inBuilderV1
mode by default.In general, it appears as though folks are moving away from using the older Docker builder, and therefore this PR implements the buildkit mode as the default behavior for this resource.
Users may still set their
builderVersion
to theBuilderV1
mode, but must do so explicitly.Invalid builder versions will return an error on
pulumi up
.This functionality in v3.x.x was handled via the
env
field, which asked users to provideDOCKER_BUILDKIT=1
as an environment variable for the Docker CLI to pick up.Since this version of
Image
relies on the Docker client, not the CLI, this particular field is no longer necessary in this form.I believe making
builderVersion
its own schematized type field is a lot more user friendly, more tightly scoped, and allows us to explicitly document this feature.Furthermore, we will be able to deprecate the
env
field safely, and it is additionally the hope of this PR author thatbuilderVersion
is much more intuitive for users thanenv
Fixes #422.