-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support '--ssh' option in 'docker build' #4660
Conversation
I'll update this PR after merging #4731. |
@h-michael Can you please update this PR? #4731 is now merged. |
@tejal29 Sorry for late replying. I'll work this week. |
@h-michael Thank you for working on this. Do you happen to have approximate ETA? We would very much like this feature. We are happy to contribute if you need help. |
Hey @h-michael! Sorry to bother, but I just want to check and see if you still have the free time to work on this. If not, I think someone on the skaffold team could take it over and push it through :) |
@MarlonGamez do you foresee 'ssh' feature to be implemented similarly to 'secret'? I am wondering if it is possible to add 'args' sections (similar to 'jib') so that all docker build options can be passed in. |
@MarlonGamez I will make time this weekend. I'll let you know if I can't. |
@gemscoder yes, I think it would be implemented similarly, with it's own section in the config. If you'd like to pass additional args to docker build, we have a Is that what you're looking for? :) |
@marlon-gamez Thank you for your reply. Yes I know about buildargs. I actually meant to ask about other docker build options. I see you already have a lot of them addressed, i.e. secret, build-arg,no-cache and others but not all of them. For example, I would like to use '--squash' so I thought it might a good idea to have 'other-options' section for any additional options users might want to pass to docker. Not a big deal. Just asking... |
d52e6c2
to
cbfbebd
Compare
Codecov Report
@@ Coverage Diff @@
## master #4660 +/- ##
=======================================
Coverage 72.18% 72.18%
=======================================
Files 365 365
Lines 12859 12862 +3
=======================================
+ Hits 9282 9285 +3
Misses 2886 2886
Partials 691 691
Continue to review full report at Codecov.
|
c900418
to
a6876ba
Compare
if a.Secret != nil || a.SSH != "" { | ||
return fmt.Errorf("docker build options, secrets and ssh, require BuildKit - set `useBuildkit: true` in your config, or run with `DOCKER_BUILDKIT=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 code is ad hoc and not very good, but I think it's out of the scope of this PR to refactor these and the only options that BuildKit needs, for now, are "secret" and "ssh" so I'll leave that for this PR I'll leave it.
@@ -1125,6 +1125,9 @@ type DockerArtifact struct { | |||
// Secret contains information about a local secret passed to `docker build`, | |||
// along with optional destination information. | |||
Secret *DockerSecret `yaml:"secret,omitempty"` | |||
|
|||
// SSH is passed as a argument to the --ssh option. | |||
SSH string `yaml:"ssh,omitempty"` |
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.
I was wondering what to do here. "--ssh" option can have only one argument "default", "<id>[=<socket>]" or "<key>[,<key>]".
It would be nice if we could used a type representation like a union type, but the JSON schema(and Golang) doesn't support such a type, so I decided to just make it string type.
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.
SGTM — I think we could use a yaml oneOf
annotation, but this will do for now.
fd4a878
to
55b9ce8
Compare
Travis CI failed. It seems that a Travis CI issue. |
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.
Thanks for the revised PR! I suggested two tiny tweaks.
@@ -104,7 +104,7 @@ func TestDockerBuildSpec(t *testing.T) { | |||
}, | |||
}, | |||
{ | |||
description: "buildkit features not supported in GCB", | |||
description: "buildkit feature of secret not supported in GCB", |
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.
description: "buildkit feature of secret not supported in GCB", | |
description: "buildkit `secret` option not supported in GCB", |
@@ -117,6 +117,18 @@ func TestDockerBuildSpec(t *testing.T) { | |||
}, | |||
shouldErr: true, | |||
}, | |||
{ | |||
description: "buildkit feature of ssh not supported in GCB", |
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.
description: "buildkit feature of ssh not supported in GCB", | |
description: "buildkit `ssh` option not supported in GCB", |
@@ -1125,6 +1125,9 @@ type DockerArtifact struct { | |||
// Secret contains information about a local secret passed to `docker build`, | |||
// along with optional destination information. | |||
Secret *DockerSecret `yaml:"secret,omitempty"` | |||
|
|||
// SSH is passed as a argument to the --ssh option. | |||
SSH string `yaml:"ssh,omitempty"` |
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.
SGTM — I think we could use a yaml oneOf
annotation, but this will do for now.
@gemscoder the issue is that we pass args to docker generically using the
which fails (since that isn't a valid build arg). we could maybe consider making these truly generic args that get passed verbatim to |
55b9ce8
to
165e612
Compare
@briandealwis Thank you for your review.
Oh, I forgot specifications such as "oneof", "anyof and "allof".
The part where "default" is specified is a string type, but only "default" can be specified in the first place, so it seems a bit strange to me that it's a schema. |
@h-michael i think that yaml you mocked up is pretty much what @briandealwis was thinking. I agree with you that we should keep it how it is for now. Maybe we can revisit it in the future if users find that just having an open ended string field is a bad experience. |
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 👍🏼 Thanks so much for taking the time to work on this :)
Hello guys, I would like to use this feature, but it seems to not be available in the current release (1.17). Any ideas on when it will be available ? |
@ADBalici I don't know Skaffold release cycle. |
wrong mention 👍 |
hey @AdemUstaReminiz, this feature should be present in v1.17.1, which just released recently :) To access it you will need to set both |
This is a feature addition related to issue #2273.
Related: #2273
Merge after: #4659
Description
This is PR for the addition of a feature that allows us to use the
docker build --ssh
option.Docker document link
Should I make sure to check the
useBuildkit
option?