-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add support for Docker Registry authentication to Build #1411
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
Conversation
pkg/build/api/types.go
Outdated
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.
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'd go with just SecretRef or RegistrySecretRef, I agree the one above i too long.
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.
Even just Secret is fine, it doesn't have to contain "Ref" in the name, we don't do that in other places that we use ObjectReference.
I'd go w/ RegistrySecret
Is this field going to exist in all 3 strategies? if so i'm wondering if it should be factored out to a higher level.
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 see it does, so that question stands. i kind of like keeping it at the same level as the image it's associated with, but i hate the fact that we have the same field 3 times.
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.
f6ca36d to
14104c9
Compare
|
@smarterclayton PTAL (this is pending tests which depend on having private registry with credentials support, which is currently WIP) |
pkg/build/api/types.go
Outdated
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.
update first word
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.
my replace-fu failed :-( thanks
|
[test] |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_openshift3/1452/) |
|
@liggitt PTAL quoting @smarterclayton : build configs should probably be referencing serivce accounts |
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.
Make sure the kind is what you expect. Not sure what to check for the namespace
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.
If I do, then users will have to add Kind to ObjectReference... Is that
what you mean?
On Mar 23, 2015 7:34 PM, "Jordan Liggitt" [email protected] wrote:
In pkg/build/api/validation/validation.go
#1411 (comment):@@ -176,6 +180,17 @@ func validateStrategy(strategy *buildapi.BuildStrategy) errs.ValidationErrorList
return allErrs
}+func validateDockerSecretRef(ref *kapi.ObjectReference) errs.ValidationErrorList {
- allErrs := errs.ValidationErrorList{}
- if ref == nil {
return allErrs- }
- if len(ref.Name) == 0 {
allErrs = append(allErrs, errs.NewFieldInvalid("RegistrySecret", ref.Name, "the Secret name cannot be blank"))- }
- return allErrs
Make sure the kind is what you expect. Not sure what to check for the
namespace—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/1411/files#r26965430.
|
The build pods have to run as a service account (which will be set by some process, and potentially overriden by a user). The secret used to download a Git repo or url should be one of the ones named by the account. I think it may be ok to let users set a single named secret for the build and again one for the output.
|
|
@smarterclayton my last commit copies the namespace from the Build itself to Build pod. Does it cover the service accounts or can you or @liggitt elaborate on what does it mean 'service account' ? Is the current mechanism to inject the secrets to build wrong? |
72c5ede to
ebfa0b0
Compare
|
@smarterclayton @bparees I made some changes we were discussing yesterday, so I moved the RegistrySecret to Output and rename it to PushSecretName. This is no longer ObjectReference as the Secret can't be reference cross-namespace. I updated all builders to recognize two env vars, PUSH_DOCKERCFG_PATH and PULL_DOCKERCFG_PATH (one for pushing and second for pulling). At this moment the one for pushing is also used for pulling images (with big TODO to change this once we get Service Accounts) PTAL. This is now mergeable, I tested this using my Hub credentials and the output image is pushed to Hub properly. One problem I had was with the Secret name itself. For now, Secret.Name and the Data[Name] = "base64(dockercfg)" 'Name' needs to match. I use 'Secret.Name' as the filename for the dockercfg. |
|
LGTM. |
263b166 to
627537d
Compare
pkg/build/api/types.go
Outdated
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.
remove "Name"?
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.
@bparees thought that it would be better to be specific on what exactly we do require here ('name' of the secret)
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.
convinced to just PushSecret via IRC ;-)
|
@bparees comments addressed, squashed :-) |
pkg/build/api/types.go
Outdated
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.
Needs to be consistent with Paul's latest, which is "SecretName". You should not merge this until that discussion settles upstream.
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.
@bparees convinced me that we don't need Name as we also not using Ref
suffix.
On Mar 24, 2015 6:09 PM, "Clayton Coleman" [email protected] wrote:
In pkg/build/api/types.go
#1411 (comment):@@ -231,6 +231,11 @@ type BuildOutput struct {
// a Docker image repository to push to. Failure to find the To will result in a build error.
To *kapi.ObjectReferencejson:"to,omitempty"
- // pushSecret is the name of a Secret that would be used for setting
- // up the authentication for executing the Docker push to authentication
- // enabled Docker Registry (or Docker Hub).
- PushSecret string
json:"pushSecret,omitempty"Needs to be consistent with Paul's latest, which is "SecretName". You
should not merge this until that discussion settles upstream.—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/1411/files#r27050027.
|
lgtm for handling push. |
3ee23fb to
e7d667e
Compare
|
@bparees @smarterclayton comments addressed, do you want me still wait for @pmorie name vs. not name ? |
34c2c71 to
3fff638
Compare
|
@mfojtik yeah might as well have the 5 minute discussion rather than having to do another PR. |
Signed-off-by: Michal Fojtik <[email protected]>
|
@bparees @pmorie @smarterclayton updated, all comments addressed, so I think this is ready for push and follow up work (documentation && testing) |
|
lgtm, +1 on needs doc + testing :) |
|
[merge] |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_openshift3/1289/) (Image: devenv-fedora_1128) |
|
Evaluated for origin up to 13acec5 |
Merged by openshift-bot
(this is heavy WIP atm, any feedback appreciated)