Skip to content

Commit

Permalink
Return error when unable to read configuration
Browse files Browse the repository at this point in the history
Prior when the configuration was not successfully fetched, the error was
only logged but execution continued. Not fetching the configuration is
an unrecoverable error that should result in upstream failure.

Instead return the error to caller and let them log it.
  • Loading branch information
hnnsgstfssn committed Oct 28, 2024
1 parent 2427f3e commit 92e0f8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/pkg/githubapi/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func handleShowPlanPREvent(ctx context.Context, ghPrClientDetails GhPrClientDeta
defaultBranch, _ := ghPrClientDetails.GetDefaultBranch()
config, err := GetInRepoConfig(ghPrClientDetails, defaultBranch)
if err != nil {
ghPrClientDetails.PrLogger.Infof("Couldn't get Telefonistka in-repo configuration: %v", err)
return fmt.Errorf("get in-repo configuration: %w", err)
}
promotions, _ := GeneratePromotionPlan(ghPrClientDetails, config, *eventPayload.PullRequest.Head.Ref)
commentPlanInPR(ghPrClientDetails, promotions)
Expand All @@ -205,7 +205,7 @@ func handleChangedPREvent(ctx context.Context, mainGithubClientPair GhClientPair
defaultBranch, _ := ghPrClientDetails.GetDefaultBranch()
config, err := GetInRepoConfig(ghPrClientDetails, defaultBranch)
if err != nil {
ghPrClientDetails.PrLogger.Infof("Couldn't get Telefonistka in-repo configuration: %v", err)
return fmt.Errorf("get in-repo configuration: %w", err)
}
if config.Argocd.CommentDiffonPR {
componentPathList, err := generateListOfChangedComponentPaths(ghPrClientDetails, config)
Expand Down

0 comments on commit 92e0f8f

Please sign in to comment.