Skip to content

Commit 13ea160

Browse files
committed
move log levels back to info with debug as default
Signed-off-by: Tarun Pothulapati <tarun@gitpod.io>
1 parent b393ccd commit 13ea160

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

plugins/deployed-labeler/main.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func newOptions() *options {
3737
fs.IntVar(&o.port, "port", 8080, "Port to listen to.")
3838
fs.BoolVar(&o.dryRun, "dry-run", false, "Dry run for testing (uses API tokens but does not mutate).")
3939
fs.StringVar(&o.hmacSecret, "hmac", "/etc/webhook/hmac", "Path to the file containing the GitHub HMAC secret.")
40-
fs.StringVar(&o.logLevel, "loglevel", "info", "Application log level")
40+
fs.StringVar(&o.logLevel, "log-level", "debug", "Application log level")
4141

4242
for _, group := range []flagutil.OptionGroup{&o.github} {
4343
group.AddFlags(fs)
@@ -94,14 +94,12 @@ func main() {
9494
func (s *server) markDeployedPR(w http.ResponseWriter, req *http.Request) {
9595
var commitSHA string
9696
var team string
97-
9897
for k, v := range req.URL.Query() {
9998
switch k {
10099
case "commit":
101100
commitSHA = v[0]
102101
case "team":
103102
team = v[0]
104-
105103
default:
106104
s.log.Warnf("Unrecognized parameter received: %s", k)
107105
}
@@ -165,7 +163,6 @@ func (s *server) markDeployedPR(w http.ResponseWriter, req *http.Request) {
165163
} `json:"deployedPRs"`
166164
Errors []error `json:"errors"`
167165
}
168-
169166
msg.DeployedPRs.Team, msg.DeployedPRs.All, msg.Errors = s.handleMarkDeployedPRs(req.Context(), commitSHA, team)
170167

171168
msg.Errors = make([]string, 0, len(errs))
@@ -218,7 +215,7 @@ func (s *server) updatePullRequests(prs []pullRequest, team string) (teamDeploye
218215

219216
lblTeam := teamLabel(team)
220217
if _, belongs := pr.Labels[lblTeam]; !belongs {
221-
s.log.Debugf("PR %v does not belong to %v, skipping it", pr.Number, team)
218+
s.log.Infof("PR %v does not belong to %v, skipping it", pr.Number, team)
222219
continue
223220
}
224221

@@ -233,7 +230,7 @@ func (s *server) updatePullRequests(prs []pullRequest, team string) (teamDeploye
233230
pr.Labels[teamDeployedLabel] = struct{}{}
234231
}
235232
} else {
236-
s.log.Debugf("PR %v already has label %v", pr.Number, teamDeployedLabel)
233+
s.log.Infof("PR %v already has label %v", pr.Number, teamDeployedLabel)
237234
}
238235

239236
allTeamsDeployed := true
@@ -253,7 +250,7 @@ func (s *server) updatePullRequests(prs []pullRequest, team string) (teamDeploye
253250
errs = append(errs, err)
254251
}
255252
} else {
256-
s.log.Debugf("PR %v already has label %v", pr.Number, labelDeployed)
253+
s.log.Infof("PR %v already has label %v", pr.Number, labelDeployed)
257254
}
258255
}
259256
return
@@ -265,7 +262,7 @@ func (s *server) findTeamPullRequests(prs []pullRequest, team string) (labeled,
265262

266263
lblTeam := teamLabel(team)
267264
if _, belongs := pr.Labels[lblTeam]; !belongs {
268-
s.log.Debugf("PR %v does not belong to %v, skipping it", pr.Number, team)
265+
s.log.Infof("PR %v does not belong to %v, skipping it", pr.Number, team)
269266
continue
270267
}
271268

@@ -286,7 +283,7 @@ func teamLabel(team string) string { return labelPrefixTeam + team }
286283
// that are present in the default branch's commit tree, as long as they were merged before the commit
287284
// passed as an argument.
288285
func (s *server) getMergedPRs(ctx context.Context, commitSHA string) ([]pullRequest, error) {
289-
s.log.Debugf("Fetching merged PRs for commit %v", commitSHA)
286+
s.log.Infof("Fetching merged PRs for commit %v", commitSHA)
290287
variables := map[string]interface{}{
291288
"org": githubv4.String(org),
292289
"repo": githubv4.String(repo),
@@ -320,13 +317,11 @@ func (s *server) getMergedPRs(ctx context.Context, commitSHA string) ([]pullRequ
320317
res := make([]pullRequest, 0, len(commits))
321318
for _, c := range commits {
322319
for _, rpr := range c.AssociatedPullRequests.Nodes {
323-
324320
pr := pullRequest{
325321
Number: int(rpr.Number),
326322
URL: string(rpr.URL),
327323
Labels: make(map[string]struct{}, len(rpr.Labels.Nodes)),
328324
}
329-
330325
for _, lbl := range rpr.Labels.Nodes {
331326
pr.Labels[string(lbl.Name)] = struct{}{}
332327
}
@@ -338,7 +333,7 @@ func (s *server) getMergedPRs(ctx context.Context, commitSHA string) ([]pullRequ
338333
"URL": pr.URL,
339334
"Labels": pr.Labels,
340335
},
341-
).Debug("Added pull request for commit %s", c)
336+
).Info("Added pull request for commit %s", c)
342337
}
343338
}
344339

0 commit comments

Comments
 (0)