Skip to content

Commit

Permalink
refactor(slack): Reposition commit message in manual judgement notifi…
Browse files Browse the repository at this point in the history
…cation (#1599)
  • Loading branch information
luispollo committed Oct 14, 2020
1 parent 399096f commit 7fe8912
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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 += "<br/>Please consult the <$MANUAL_JUDGEMENT_DOC_URL|documentation> on how to approve the deployment."
}
Expand Down

0 comments on commit 7fe8912

Please sign in to comment.