Skip to content

Commit

Permalink
style: 💄 pass failed build url to pr
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskaransarkaria committed Sep 24, 2024
1 parent ae78471 commit 8870a86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions pkg/environment/createPR.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ import (
"github.com/ministryofjustice/cloud-platform-cli/pkg/slack"
)

func createPR(versionDescription, namespace string) func(github.GithubIface, []string) (string, error) {
func createPR(description, namespace string) func(github.GithubIface, []string) (string, error) {
b := make([]byte, 2)
rand.Read(b)
fourCharUid := hex.EncodeToString(b)
branchName := namespace + "-rds-minor-version-bump-" + fourCharUid

description := "``` " + versionDescription + " ```"

return func(gh github.GithubIface, filenames []string) (string, error) {
checkCmd := exec.Command("/bin/sh", "-c", "git checkout -b "+branchName)
checkCmd.Start()
Expand Down
4 changes: 3 additions & 1 deletion pkg/environment/environmentApply.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ func (a *Apply) applyTerraform() (string, error) {
return "", fmt.Errorf("error running terraform on namespace %s: %s \n %s \n %s", a.Options.Namespace, err.Error(), updateErr.Error(), outputTerraform)
}

prUrl, createErr := createPR(versionDescription, a.Options.Namespace)(a.GithubClient, filenames)
description := "\n\n``` " + versionDescription + " ```\n\n" + a.Options.BuildUrl

prUrl, createErr := createPR(description, a.Options.Namespace)(a.GithubClient, filenames)

if createErr != nil {
return "", fmt.Errorf("error running terraform on namespace %s: %v \n %v \n %v", a.Options.Namespace, err, outputTerraform, createErr)
Expand Down
2 changes: 1 addition & 1 deletion pkg/slack/notifyUser.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func Notify(prNumber, token, webhookUrl, buildUrl string) error {
func PostToAsk(prUrl, webhookUrl string) error {
webhookMsg := slack.WebhookMessage{
Channel: "ask-cloud-platform",
Text: "PR for review please: " + prUrl,
Text: "RDS Minor version mismatch. PR for review please: " + prUrl,
}

return slack.PostWebhook(webhookUrl, &webhookMsg)
Expand Down

0 comments on commit 8870a86

Please sign in to comment.