-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Extended builds #9813
Extended builds #9813
Conversation
// runtimePullSecret is the name of a Secret that would be used for setting up | ||
// the authentication for pulling the Docker runtime images from private | ||
// Docker registries. | ||
RuntimePullSecret *kapi.LocalObjectReference `json:"runtimePullSecret,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 think we decided we don't need this since you can have multiple auths in the existing pullsecret, right?
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.
errr... i might have missed that discussion, but if so i will remove it
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.
well as it is i don't think your code is actually using it, either.
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 build/controller/strategy/util.go:setupDockerSecrets()
to see how user-provided secrets get setup as mount points and an env variable gets defined that points to the mount point, and then later we reference the env variable to find the mount point and locate the secret to do the actual pull.
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.
ah, you meant this conversation #9596 (comment)
sorry i didn't get it from your comment that we don't want to use it, my bad. i see now what you mean.
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.
the discussion definitely wasn't conclusive, but i'm going to propose we go with the single field. note that as @liggitt pointed out, this means we need to be a little more sophisticated in the logic that picks the secret in the first place, since we need to find a secret that matches both image pullspecs.
these commits look mixed up, the bump commit is not just a bump. |
@bparees thanks for catching that, i think i squashed wrongly or something, will fix. |
i realize it's a work in progress but just a heads up that i'm going to want to see extended tests for this. |
@@ -105,6 +105,9 @@ func (s *S2IBuilder) Build() error { | |||
if runtimeImage != nil { | |||
runtimeImageName = s.build.Spec.Strategy.SourceStrategy.RuntimeImage.Name | |||
runtimeDockerAuth, _ = dockercfg.NewHelper().GetDockerAuth(runtimeImageName, dockercfg.PullAuthType) | |||
// FIXME: do we need to explicitly turn off the incremental flag or make it | |||
// part of the validation? or do we need to touch it at all? | |||
s.build.Spec.Strategy.SourceStrategy.Incremental = false |
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.
As far I understand it should be a part of validation logic. (S2I also checks this case but only when it's executed as a binary.)
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.
+1, should be part of the validation.
@@ -20355,17 +20373,6 @@ | |||
"forcePull": { | |||
"type": "boolean", | |||
"description": "forcePull describes if the builder should pull the images from registry prior to building." | |||
}, | |||
"runtimeImage": { | |||
"$ref": "v1.ObjectReference", |
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.
@php-coder don't forget when you have time to add this back so i don't fetch this 👯
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, I've just pushed with -f to fix it.
func (h *Helper) GetDockerAuth(imageName, runtimeImageName, authType string) (docker.AuthConfiguration, bool) { | ||
if runtimeImageName != "" { | ||
glog.V(3).Infof("Runtime image detected %s", runtimeImageName) | ||
} |
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.
@PI-Victor Why do we need to add this argument? I see that we're just printing it.
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.
@php-coder i don't think this will stay, just wanted to get some input about it.
maybe the user wants to know that we detected a runtime image?
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.
But maybe we could put it inside of if s.build.Spec.Strategy.SourceStrategy.RuntimeImage != nil {
? And I see that the similar message already here, so I'm not sure should we show to a user runtime image detected
message twice.
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.
ok, fair point.
|
if we don't find an auth associated w/ the docker repo in question, we just attempt to pull w/ no creds. So there is no immediate error, there may be an error when we go to pull the image if the repo requires creds. As for the image to run tests in, that is a good question. Logically they should be run in the runtime image since that is the image that "matters", but from a technical perspective it's very likely the runtime image doesn't have the tools (eg rake) needed to run the tests. I guess we stand by the logic that they can install whatever tools they need to run the tests, as part of the test script. So runtime image. But I'd be interested in additional opinions from @smarterclayton. |
As per discussion with ben this footprint is acceptable for now. |
config.RuntimeAuthentication = dockerAuth | ||
config.PullAuthentication = dockerAuth | ||
config.RuntimeArtifacts = copyToVolumeList(s.build.Spec.Strategy.SourceStrategy.RuntimeArtifacts) | ||
glog.V(0).Infof("Runtime Image detected: pushTag: %#v, buildTag: %#v, dockerAuth: %#v", pushTag, buildTag, dockerAuth) |
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 have questions:
- should we log it as
V(0)
? - should we log auth info? Is this information sensitive?
Right now I see in the console message like this:
Runtime Image detected: pushTag: "java-extended-build-from-repo-1", buildTag: "extended-test-extended-build-p2s69-4kb13/java-extended-build-from-repo-1:e3cd7fa9", dockerAuth: docker.AuthConfiguration{Username:"", Password:"", Email:"", ServerAddress:""}
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.
no, you're right. it's ok, that was just for debugging. i'll push an update
@bparees i assume, since we keep an eye out only for the image that gets pushed to the registry, (runtime image in this case) that imagechange triggers will trigger a new build only in the case where the runtime image gets updated and not the builder. since we treat the builder as a discardable image? |
p.s.: still waiting on a small comment regarding the postcommit hook? |
You can add imagechangetriggers on any image you want, so you can have an imagechangetrigger on both images. The real question is what the "default" imagechangetrigger (the one where you don't specify the image explicitly) should be looking at, and I think it should be looking at the builder image, not the runtime image. What is it doing currently? |
@bparees i hate to ask this but can you give me some pointers where to find the monitoring logic for imagechange triggers. i assume it's a controller of some sort, but i can't find it. |
@php-coder maybe you know? ^^ |
nvm about the imagechange controller. found it. |
@@ -503,6 +503,7 @@ func validateSourceStrategy(strategy *buildapi.SourceBuildStrategy, fldPath *fie | |||
allErrs = append(allErrs, validateFromImageReference(&strategy.From, fldPath.Child("from"))...) | |||
allErrs = append(allErrs, validateSecretRef(strategy.PullSecret, fldPath.Child("pullSecret"))...) | |||
allErrs = append(allErrs, ValidateStrategyEnv(strategy.Env, fldPath.Child("env"))...) | |||
allErrs = append(allErrs, validateRuntimeImage(strategy, fldPath.Child("runtimeImage"))...) |
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 the validation that i've added here applies to the the build object, so you cannot do oc create -f build.json
with both incremental=true and a runtime image defined.
a bc that can test this is here https://gist.githubusercontent.com/PI-Victor/16f030f52ef6127149a8f1a12d7cc0b9/raw/a62bda283f6e6d0f84d7eb6ac8eee2fc968d2b31/gistfile1.txt
both validateBuild and validateBuildConfig run the validateCommonSpec which runs the below code, so it's covered.
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 yes, thank you! that's what i'm seeing. (when i tested previously, i thought it was running on the builder image for some reason.) |
o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
||
g.By("running the build") | ||
err = oc.Run("start-build").Args(buildConfigName).Execute() |
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.
we should always record and print the output from start-build as demonstrated here:
https://github.com/openshift/origin/pull/9592/files#diff-f8c83618d04227c926ba1eed1330b6faR37
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.
(same comment for the other start-build invocations)
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.
Ok, I added. But I decided to output these logs only when start-build
fails and not always as in the example.
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 believe that output (in the example) only shows up if the test fails anyway, though i'm not certain.
@PI-Victor looks like you need to run hack/update-generated-protobuf.sh to fix the serialization test issue. That is a new step in our api update process. |
@bparees talk about syncs, i just finished compiling the objective-c protobuf bin and was generating them. |
@PI-Victor ah, well then you don't need the PR I just opened :) |
@bparees it's more than welcome, thanks! |
Now it fails because of this flake: #9938 |
re[test] |
Fails because of this:
Don't know what does it mean and how to fix it... re[test] |
@php-coder looks like a docker flake to me |
[test] |
(or maybe flake #9490) |
re[test] for the love of god. |
[testextended][extended:core(s2i extended build)] |
re[test] |
[test] |
[merge] |
Evaluated for origin test up to 5da464c |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7398/) (Image: devenv-rhel7_4730) |
Evaluated for origin merge up to 5da464c |
Evaluated for origin testextended up to 5da464c |
continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/388/) (Extended Tests: core(s2i extended build)) |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7398/) |
OLD PR: #9596 (had to close it)
Trello: https://trello.com/c/MWUAjl6k/237-13-extended-builds-separate-mvn-vs-jboss-evg
This is dependent on: openshift/source-to-image#505
To make this work, in your bc
cc: @php-coder @bparees
NOTE: sourcePath needs to be a full path insider your builder image that points to the file/dir that you want to be copied, while destinationDir is the path relative to your runtimeImage WORKDIR where your files will be copied
NOTE:
In order to run this, you need to update your s2i builder image with the current compiled binary.
either using bindmountproxy this works with
oc cluster up
instructions are in the repo.or by using openshift-devtools
this will rebuild the s2i-builder image and copy your openshift locally compiled binary inside it (you need to run openshift with --latest-images for openshift to use that rebuilt image)