Skip to content

Commit

Permalink
Linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Oded-B committed Jul 1, 2024
1 parent 8cb4c1a commit ea57c0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 11 additions & 7 deletions internal/pkg/githubapi/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,18 +586,22 @@ func handleMergedPrEvent(ghPrClientDetails GhPrClientDetails, prApproverGithubCl

if config.AllowSyncArgoCDAppfromBranchPathRegex != "" {
componentPathList, err := generateListOfChangedComponentPaths(ghPrClientDetails, config)
for _, componentPath := range componentPathList {
if isSyncFromBranchAllowedForThisPath(config.AllowSyncArgoCDAppfromBranchPathRegex, componentPath) {
ghPrClientDetails.PrLogger.Errorf("Ensuring ArgoCD app %s is set to HEAD\n", componentPath)
err := argocd.SetArgoCDAppRevision(ghPrClientDetails.Ctx, componentPath, "HEAD", ghPrClientDetails.RepoURL, config.UseSHALabelForArgoDicovery)
if err != nil {
ghPrClientDetails.PrLogger.Errorf("Failed to set ArgoCD app %s, to HEAD: err=%s\n", err)
if err != nil {
ghPrClientDetails.PrLogger.Errorf("Failed to get list of changed components for setting ArgoCD app targetRef to HEAD: err=%s\n", err)
} else {
for _, componentPath := range componentPathList {
if isSyncFromBranchAllowedForThisPath(config.AllowSyncArgoCDAppfromBranchPathRegex, componentPath) {
ghPrClientDetails.PrLogger.Errorf("Ensuring ArgoCD app %s is set to HEAD\n", componentPath)
err := argocd.SetArgoCDAppRevision(ghPrClientDetails.Ctx, componentPath, "HEAD", ghPrClientDetails.RepoURL, config.UseSHALabelForArgoDicovery)
if err != nil {
ghPrClientDetails.PrLogger.Errorf("Failed to set ArgoCD app @ %s, to HEAD: err=%s\n", componentPath, err)
}
}
}
}
}

return nil
return err
}

// Creating a unique branch name based on the PR number, PR ref and the promotion target paths
Expand Down
1 change: 0 additions & 1 deletion internal/pkg/githubapi/promotion.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ type relevantComponent struct {
}

func generateListOfChangedComponentPaths(ghPrClientDetails GhPrClientDetails, config *cfg.Config) (changedComponentPaths []string, err error) {

// If the PR has a list of promoted paths in the PR Telefonistika metadata(=is a promotion PR), we use that
if len(ghPrClientDetails.PrMetadata.PromotedPaths) > 0 {
changedComponentPaths = ghPrClientDetails.PrMetadata.PromotedPaths
Expand Down

0 comments on commit ea57c0e

Please sign in to comment.