Skip to content

Commit

Permalink
chore: add logging (#94)
Browse files Browse the repository at this point in the history
* add logging

Signed-off-by: Zach Aller <[email protected]>

* add TODO note

Signed-off-by: Zach Aller <[email protected]>

---------

Signed-off-by: Zach Aller <[email protected]>
  • Loading branch information
zachaller authored Oct 30, 2024
1 parent 5c5b217 commit 5e1e31e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions internal/controller/promotionstrategy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ func (r *PromotionStrategyReconciler) SetupWithManager(mgr ctrl.Manager) error {

return ctrl.NewControllerManagedBy(mgr).
For(&promoterv1alpha1.PromotionStrategy{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
Owns(&promoterv1alpha1.ChangeTransferPolicy{}).
// TODO: reduce reconciliation frequency by not reconciling when updates happen to CTPs, makes race easier to reason about
//Owns(&promoterv1alpha1.ChangeTransferPolicy{}).
Complete(r)
}

Expand Down Expand Up @@ -468,7 +469,7 @@ func (r *PromotionStrategyReconciler) mergePullRequests(ctx context.Context, ps
return err
}
r.Recorder.Event(ps, "Normal", "PullRequestMerged", fmt.Sprintf("Pull Request %s merged", pullRequest.Name))
logger.V(4).Info("Merged pull request")
logger.Info("Merged pull request")
} else if pullRequest.Status.State == promoterv1alpha1.PullRequestOpen {
logger.Info("Pull request not ready to merge yet")
}
Expand Down
3 changes: 2 additions & 1 deletion internal/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func (g *GitOperations) GetShaTime(ctx context.Context, sha string) (v1.Time, er

func (g *GitOperations) PromoteEnvironmentWithMerge(ctx context.Context, environmentBranch, environmentNextBranch string) error {
logger := log.FromContext(ctx)
logger.Info("Promoting environment with merge", "environmentBranch", environmentBranch, "environmentNextBranch", environmentNextBranch)

if g.pathLookup.Get(g.gap.GetGitHttpsRepoUrl(*g.gitRepo)+g.pathContext) == "" {
return fmt.Errorf("no repo path found")
Expand Down Expand Up @@ -230,7 +231,7 @@ func (g *GitOperations) PromoteEnvironmentWithMerge(ctx context.Context, environ
logger.Error(err, "could not git pull", "gitError", stderr)
return err
}
logger.V(4).Info("Pushed branch", "branch", environmentBranch)
logger.Info("Pushed branch", "branch", environmentBranch)

return nil
}
Expand Down

0 comments on commit 5e1e31e

Please sign in to comment.