Skip to content

Commit

Permalink
Adjust details logging on a few checks
Browse files Browse the repository at this point in the history
Log positive results in Pull-Requests and update log messages in
Signed-Releases and Signed-Tags.
  • Loading branch information
moorereason committed Dec 20, 2020
1 parent 348bedb commit ac55575
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions checks/pull_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func PullRequests(c checker.Checker) checker.CheckResult {
commitMessage := commit.GetCommit().GetMessage()
if strings.Contains(commitMessage, "\nReviewed-on: ") {
totalWithPrs++
c.Logf("found gerrit reviewed commit: %s", commit.GetSHA())
continue
}

Expand All @@ -62,6 +63,7 @@ func PullRequests(c checker.Checker) checker.CheckResult {
}
if len(prs) > 0 {
totalWithPrs++
c.Logf("found commit with PR: %s", commit.GetSHA())
} else {
c.Logf("!! found commit without PR: %s, committer: %s", commit.GetSHA(), commit.GetCommitter().GetLogin())
}
Expand Down
2 changes: 1 addition & 1 deletion checks/signed_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ func SignedReleases(c checker.Checker) checker.CheckResult {
return checker.InconclusiveResult
}

c.Logf("found signed artifacts for %d of %d releases", totalSigned, totalReleases)
c.Logf("found signed artifacts for %d out of %d releases", totalSigned, totalReleases)
return checker.ProportionalResult(totalSigned, totalReleases, 0.8)
}
12 changes: 6 additions & 6 deletions checks/signed_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ func SignedTags(c checker.Checker) checker.CheckResult {
return checker.RetryResult(err)
}

totalReleases := 0
totalTags := 0
totalSigned := 0
for _, t := range query.Repository.Refs.Nodes {
sha := string(t.Target.Oid)
totalReleases++
totalTags++
gt, _, err := c.Client.Git.GetTag(c.Ctx, c.Owner, c.Repo, sha)
if err != nil {
return checker.RetryResult(err)
Expand All @@ -67,11 +67,11 @@ func SignedTags(c checker.Checker) checker.CheckResult {
}
}

if totalReleases == 0 {
c.Logf("no releases found")
if totalTags == 0 {
c.Logf("no tags found")
return checker.InconclusiveResult
}

c.Logf("found %d of %d verified tags", totalSigned, totalReleases)
return checker.ProportionalResult(totalSigned, totalReleases, 0.8)
c.Logf("found %d out of %d verified tags", totalSigned, totalTags)
return checker.ProportionalResult(totalSigned, totalTags, 0.8)
}

0 comments on commit ac55575

Please sign in to comment.