-
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
Store built image digest in the build status #12407
Conversation
[test][testextended][extended:core(builds)] |
lgtm, @openshift/api-review please approve the new digest field. |
// outputDockerImageDigest is the digest of the built Docker image. The | ||
// digest uniquely identifies the image in the registry to which it was | ||
// pushed. | ||
OutputDockerImageDigest 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.
Put this in a struct that parallels spec output - probably status.output.to.imageDigest
where output is a struct, to is a pointer to a struct, and to is only set when an image was output.
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've changed the structs as requested, PTAL if it's what you wanted.
Also add at to the field description that the field may not be set the push
completes but the build encounters an unexpected failure. That is, the
field is set "best effort".
…On Fri, Jan 6, 2017 at 11:21 AM, OpenShift Bot ***@***.***> wrote:
continuous-integration/openshift-jenkins/test FAILURE (
https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/12686/) (Base
Commit: 9e682de
<9e682de>
)
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#12407 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p_h85JVOyFSe9z1kicWAdxPueD3rks5rPmoHgaJpZM4LcyRW>
.
|
Rebased, though there's still a bug in the digest extraction code that makes the tests fail that I'm working on. |
46a6c41
to
3078317
Compare
message BuildStatusOutputTo { | ||
// imageDigest is the digest of the built Docker image. The digest uniquely | ||
// identifies the image in the registry to which it was pushed. Please note | ||
// that this field may not always set even if the push completes |
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.
missing be
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.
What causes the digest not to be set?
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.
Few remarks. LGTM overall.
message BuildStatusOutputTo { | ||
// imageDigest is the digest of the built Docker image. The digest uniquely | ||
// identifies the image in the registry to which it was pushed. Please note | ||
// that this field may not always set even if the push completes |
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.
What causes the digest not to be set?
return reportPushFailure(err, authPresent, pushAuthConfig) | ||
} | ||
if digest != "" { |
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.
len(digest) > 0
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.
Just curious, is it a matter of consistency or is there a practical difference?
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 say it's just about consistency.
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.
bump :-)
@@ -73,28 +77,33 @@ func pullImage(client DockerClient, name string, authConfig docker.AuthConfigura | |||
// - Docker registry is down temporarily or permanently | |||
// - other image is being pushed to the registry | |||
// If any other scenario the push will fail, without retries. |
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.
Document the newly added return value.
for { | ||
// save the not yet parsed input so we can restore it in case it | ||
// contains part of valid JSON | ||
savedBuf, err := ioutil.ReadAll(dec.Buffered()) |
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 the err
is ignored intentionally, use _
.
} | ||
} | ||
|
||
// simpleProgressWriter is an io.Writer which consumes a stream of json |
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.
s/simpleProgressWriter/newSimpleWriter/
// with RawJSONStream=false. | ||
func newSimpleWriter(output io.Writer) io.Writer { | ||
return newPushWriter(func(line progressLine) error { | ||
if line.Stream != "" { |
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.
len(line.Stream) > 0
and the same below
decoded := []progressLine{} | ||
w := newPushWriter(func(line progressLine) error { | ||
decoded = append(decoded, line) | ||
if line.Error != "" { |
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.
len(line.Error) > 0
and the same below
br, err := exutil.StartBuildAndWait(oc, "test") | ||
|
||
g.By("checking that the resulting image has a digest") | ||
o.Expect(br.Build.Status.Output.To.ImageDigest).To(o.HavePrefix("sha256:")) |
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.
Can you also fetch the created image object by istag and match its name against the digest?
}) | ||
|
||
g.Describe("started with log level >5", func() { | ||
g.It(fmt.Sprintf("should save the image digest when finished"), func() { |
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.
All the It
blocks differ in just few values. Could you make it a top-level parametrised function and call it from each sub-Describe?
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.
Huh, I even searched the ginkgo docs to see if it supports parametrized tests, missing the obvious solution completely /facepalm.
339508e
to
2630ae2
Compare
@miminar thank you for the review. I've addressed the issues you found and pushed updated branch. |
@openshift/api-review needs api approval to land for 3.5. |
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! Few amendments to string comparisons would make it perfect.
return reportPushFailure(err, authPresent, pushAuthConfig) | ||
} | ||
if digest != "" { |
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.
bump :-)
return reportPushFailure(err, authPresent, pushAuthConfig) | ||
} | ||
if digest != "" { |
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.
len()
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.
Fixed, thanks:)
git show | grep -c '^[+].*[!=]= ""'
0
Flake #12479. [testextended][extended:core(builds)] |
API approved. |
extended test failure is a known flake but it's also in an area of code related to what's being changed here, so i'd like to see a clean run. [testextended][extended:core(failure reason)] |
seems like a consistent failure that needs to be investigated. |
Evaluated for origin test up to 0ea756b |
Evaluated for origin testextended up to 0ea756b |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13078/) (Base Commit: 1e269a3) |
Flake #9414. Trying to reproduce the failing extended tests locally. |
continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/1006/) (Base Commit: 1e269a3) (Extended Tests: core(failure reason), core(builds)) |
flake #9414 |
Evaluated for origin merge up to 0ea756b |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13096/) (Base Commit: 8146e11) (Image: devenv-rhel7_5736) |
Trello card: https://trello.com/c/SAvLJLLl/1036-5-provide-the-built-image-reference-as-part-of-the-build-status-builds
@legionus @miminar I'm extracting the digest from the stream of jsons docker client generates during pushing, is this approach fine with you guys? I've asked Docker if they consider it part of the API: moby/moby#29865.
@bparees PTAL