daml/build-scripts/no-multi-branch-helpers.groovy
Gary Verhaegen a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00

60 lines
1.8 KiB
Groovy

// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
#!/usr/bin/env groovy
/**
* get the tag name
* This is not the best way to do it, Jenkins should provide this info, but it isn't
*/
String getTag() {
def revtag = sh(script: 'git describe --tags', returnStdout: true).trim()
return revtag
}
/**
* get the repo name
* This is not the best way to do it, Jenkins should provide this info, but it isn't
*/
String getRepoUrl() {
def repourl = sh(script: 'git config --get remote.origin.url', returnStdout: true).trim()
return repourl
}
/**
* Sends notification to the team that the release started.
*/
def notifyReleaseStart(channel) {
slackSend (color: 'good',
message: "Release job for ${getTag()} (${env.BUILD_URL}) started.",
channel: channel)
}
/**
* Sends notification to component releases.
* Includes a link to the changelog
*/
def notifyReleaseSuccessfull(teamChannel, anchor="") {
def component = getTag().split("/")[1]
def relver = getTag().split("/")[2]
def changelog = getRepoUrl() + "/blob/${getTag()}/${component}/CHANGELOG.md${anchor}"
slackSend (color: 'good',
message: "New release of $component ($relver): $changelog",
channel: '#alert-releases')
// also notify the team, not everyone follows alert-releases
slackSend (color: 'good',
message: "New release of $component ($relver): $changelog",
channel: teamChannel)
}
/**
* Sends notification to the team that the release failed.
*/
def notifyReleaseFailure(channel) {
slackSend (color: 'danger',
message: "FAILED: Release job for ${getTag()} (${env.BUILD_URL})",
channel: channel)
}
return this