Skip to content

Commit

Permalink
Log debug when there are Gerrit jobs missing patchset label
Browse files Browse the repository at this point in the history
This could happen in prowjobs triggered by Pubsub, which is user error, no need to log warning
  • Loading branch information
chaodaiG committed Sep 28, 2022
1 parent 210e6b5 commit 47370c5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions prow/crier/reporters/gerrit/reporter.go
Expand Up @@ -230,14 +230,17 @@ func (c *Client) ShouldReport(ctx context.Context, log *logrus.Entry, pj *v1.Pro
// current prowjob doesn't have this label or has an invalid value, this
// will be reflected as warning message in prow.
patchsetNumFromPJ := func(pj *v1.ProwJob) int {
log := log.WithFields(logrus.Fields{"label": kube.GerritPatchset, "job-name": pj.Name})
ps, ok := pj.ObjectMeta.Labels[kube.GerritPatchset]
if !ok {
log.Warnf("Label %s not found in prowjob %s", kube.GerritPatchset, pj.Name)
// This label exists only in jobs that are created by Gerrit. For jobs that are
// created by Pubsub it's entirely up to the users.
log.Debug("Label not found in prowjob.")
return -1
}
intPs, err := strconv.Atoi(ps)
if err != nil {
log.Warnf("Found non integer label for %s: %s in prowjob %s", kube.GerritPatchset, ps, pj.Name)
log.Debug("Found non integer label value in prowjob.")
return -1
}
return intPs
Expand Down

0 comments on commit 47370c5

Please sign in to comment.