From 7fe89126eaab754d52070b15638a2800c43674b8 Mon Sep 17 00:00:00 2001 From: Luis Pollo <1323478+luispollo@users.noreply.github.com> Date: Wed, 14 Oct 2020 15:49:05 -0700 Subject: [PATCH] refactor(slack): Reposition commit message in manual judgement notification (#1599) --- .../keel/echo/ManualJudgementNotifier.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/keel-echo/src/main/kotlin/com/netflix/spinnaker/keel/echo/ManualJudgementNotifier.kt b/keel-echo/src/main/kotlin/com/netflix/spinnaker/keel/echo/ManualJudgementNotifier.kt index c2150de1e2..b7d9120500 100644 --- a/keel-echo/src/main/kotlin/com/netflix/spinnaker/keel/echo/ManualJudgementNotifier.kt +++ b/keel-echo/src/main/kotlin/com/netflix/spinnaker/keel/echo/ManualJudgementNotifier.kt @@ -65,11 +65,14 @@ class ManualJudgementNotifier( val normalizedVersion = currentState.artifactVersion.removePrefix("${artifact.name}-") val gitMetadata = repository.getArtifactInstance(artifact.name, artifact.type, currentState.artifactVersion, null) ?.gitMetadata - var details = - "*Version:* <$artifactUrl|$normalizedVersion>\n" + - "*Application:* ${deliveryConfig.application}, *Environment:* ${currentState.environmentName}\n" + + var details = "" if (gitMetadata!= null) { + if (!gitMetadata.commitInfo?.message.isNullOrEmpty()) { + details += "*Message:* ${gitMetadata.commitInfo!!.message}\n" + } + if (gitMetadata.project != null && gitMetadata.repo?.name != null) { details += if (gitMetadata.repo!!.link.isNullOrEmpty()) { "*Repo:* ${gitMetadata.project}/${gitMetadata.repo!!.name}" @@ -93,12 +96,12 @@ class ManualJudgementNotifier( } else { "*Commit:* <${gitMetadata.commitInfo!!.link}|${gitMetadata.commit}>\n" } - - if (!gitMetadata.commitInfo?.message.isNullOrEmpty()) { - details += "*Message:* ${gitMetadata.commitInfo!!.message}\n" - } } + details += + "*Version:* <$artifactUrl|$normalizedVersion>\n" + + "*Application:* ${deliveryConfig.application}, *Environment:* ${currentState.environmentName}\n" + if (!keelNotificationConfig.enabled) { details += "
Please consult the <$MANUAL_JUDGEMENT_DOC_URL|documentation> on how to approve the deployment." }