diff --git a/pkg/environment/createPR.go b/pkg/environment/createPR.go index 022beb74..a1844622 100644 --- a/pkg/environment/createPR.go +++ b/pkg/environment/createPR.go @@ -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() diff --git a/pkg/environment/environmentApply.go b/pkg/environment/environmentApply.go index f383268b..18b6e574 100644 --- a/pkg/environment/environmentApply.go +++ b/pkg/environment/environmentApply.go @@ -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) diff --git a/pkg/slack/notifyUser.go b/pkg/slack/notifyUser.go index 31e9a095..925d51b8 100644 --- a/pkg/slack/notifyUser.go +++ b/pkg/slack/notifyUser.go @@ -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)