-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import https://github.com/adobe/rules_gitops/commit/0483dedecef451c68… #12
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,15 +54,15 @@ var ( | |
releaseBranch = flag.String("release_branch", "master", "filter gitops targets by release branch") | ||
bazelCmd = flag.String("bazel_cmd", "tools/bazel", "bazel binary to use") | ||
workspace = flag.String("workspace", "", "path to workspace root") | ||
repo = flag.String("git_repo", "https://bitbucket.tubemogul.info/scm/tm/repo.git", "git repo location") | ||
repo = flag.String("git_repo", "", "git repo location") | ||
gitMirror = flag.String("git_mirror", "", "git mirror location, like /mnt/mirror/bitbucket.tubemogul.info/tm/repo.git for jenkins") | ||
gitopsPath = flag.String("gitops_path", "cloud", "location to store files in repo.") | ||
gitopsTmpDir = flag.String("gitops_tmpdir", os.TempDir(), "location to check out git tree with /cloud.") | ||
target = flag.String("target", "//... except //experimental/...", "target to scan. Useful for debugging only") | ||
pushParallelism = flag.Int("push_parallelism", 5, "Number of image pushes to perform concurrently") | ||
prInto = flag.String("gitops_pr_into", "master", "use this branch as the source branch and target for deployment PR") | ||
prBody = flag.String("gitops_pr_body", "GitOps deployment <branch>", "a body message for deployment PR") | ||
prTitle = flag.String("gitops_pr_title", "GitOps deployment <branch>", "a title for deployment PR") | ||
prBody = flag.String("gitops_pr_body", "", "a body message for deployment PR") | ||
prTitle = flag.String("gitops_pr_title", "", "a title for deployment PR") | ||
branchName = flag.String("branch_name", "unknown", "Branch name to use in commit message") | ||
gitCommit = flag.String("git_commit", "unknown", "Git commit to use in commit message") | ||
deploymentBranchSuffix = flag.String("deployment_branch_suffix", "", "suffix to add to all deployment branch names") | ||
|
@@ -252,12 +252,17 @@ func main() { | |
continue | ||
} | ||
|
||
if *prTitle == "" { | ||
*prTitle = fmt.Sprintf("GitOps deployment %s", branch) | ||
title := *prTitle | ||
if title == "" { | ||
title = fmt.Sprintf("GitOps deployment %s", branch) | ||
} | ||
|
||
err := gitServer.CreatePR(branch, *prInto, *prTitle, *prBody) | ||
if err != nil { | ||
body := *prBody | ||
if body == "" { | ||
body = branch | ||
} | ||
|
||
if err := gitServer.CreatePR(branch, *prInto, title, body); err != nil { | ||
log.Fatal("unable to create PR: ", err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling here is quite severe. Using |
||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default values for
title
andbody
are not very descriptive. IfprTitle
andprBody
are not provided, they are set to "GitOps deployment {branch}" and "{branch}" respectively. This might not provide enough context for someone looking at the PR. Consider providing more descriptive default values or enforcing that these values are provided by the user.