-
Notifications
You must be signed in to change notification settings - Fork 2.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
Expose malformed status contexts on PR HEAD commit #7454
Expose malformed status contexts on PR HEAD commit #7454
Conversation
I didn't use |
prow/tide/tide.go
Outdated
sort.Strings(malformedContexts) | ||
trunced := truncate(malformedContexts) | ||
if len(trunced) == 1 { | ||
desc = fmt.Sprintf(" Job %s has not succeeded.", trunced[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.
Hrm, what about the cla check 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.
Don't we block on it today?
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.
Nevermind, I guess it's a job.
prow/tide/tide.go
Outdated
var malformedContexts []string | ||
for _, commit := range pr.Commits.Nodes { | ||
if commit.Commit.OID == pr.HeadRefOID { | ||
for _, status := range commit.Commit.Status.Contexts { |
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.
Do you also pick up the tide 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.
Good catch, yes
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.
add this case to the unit tests?
prow/tide/tide.go
Outdated
if commit.Commit.OID == pr.HeadRefOID { | ||
for _, status := range commit.Commit.Status.Contexts { | ||
if status.State != githubql.StatusStateSuccess { | ||
malformedContexts = append(malformedContexts, string(status.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.
Why are unsuccessful contexts malformed? This makes me think they are corrupted
prow/tide/tide.go
Outdated
var malformedContexts []string | ||
for _, commit := range pr.Commits.Nodes { | ||
if commit.Commit.OID == pr.HeadRefOID { | ||
for _, status := range commit.Commit.Status.Contexts { |
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.
add this case to the unit tests?
fce8950
to
33e7dc4
Compare
@stevekuznetsov The current usage of I'd prefer to find a way to make
|
@cjwagner OK, that is understood. I think those approaches are probably useful, but orthogonal to the changes here. Given your response I continue to be confident that not using the The test flaked on:
/retest |
prow/tide/tide.go
Outdated
@@ -246,11 +247,34 @@ func requirementDiff(pr *PullRequest, q *config.TideQuery) (string, int) { | |||
desc = fmt.Sprintf(" Should not have %s labels.", strings.Join(trunced, ", ")) | |||
} | |||
} | |||
diff = len(missingLabels) + len(presentLabels) | |||
|
|||
if desc == "" { |
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 still need to check for unsuccessful contexts in order to return a correct diff
even if we already have a message to use for the status description.
prow/tide/tide.go
Outdated
} | ||
} | ||
} | ||
if len(contexts) > 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.
if desc == "" && len(contexts) > 0 {
prow/tide/tide.go
Outdated
} else { | ||
desc = fmt.Sprintf(" Jobs %s have not succeeded.", strings.Join(trunced, ", ")) | ||
} | ||
diff = len(contexts) |
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/=/+=/
When all labels are appropriately present or absent on a PR, `tide` will still not merge the PR unless all status contexts are passing. We need to expose non-passing status contexts on the `HEAD` commit of the PR so this is clear to users. Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
33e7dc4
to
1ac67f2
Compare
@cjwagner your approach to the diff count makes a lot of sense. Updated. |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cjwagner, stevekuznetsov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When all labels are appropriately present or absent on a PR,
tide
willstill not merge the PR unless all status contexts are passing. We need
to expose non-passing status contexts on the
HEAD
commit of the PR sothis is clear to users.
Signed-off-by: Steve Kuznetsov skuznets@redhat.com
Fixes #7449
/area prow
/kind bug
/cc @Kargakis @fejta
/assign @cjwagner @BenTheElder