diff --git a/ci/Jenkinsfile.release b/ci/Jenkinsfile.release index e577d3e0c..9998da609 100644 --- a/ci/Jenkinsfile.release +++ b/ci/Jenkinsfile.release @@ -1,3 +1,6 @@ +#!/usr/bin/env groovy +library 'status-jenkins-lib@v1.8.6' + pipeline { agent { label 'linux' } @@ -98,10 +101,10 @@ pipeline { post { success { script { - def discord = load "${WORKSPACE}/ci/discord.groovy" discord.send( - header: 'Nim-Waku deployment successful!', + header: '**Nim-Waku deployment successful!**', cred: 'discord-waku-deployments-webhook', + descPrefix: "Image: [`${IMAGE_NAME}:${IMAGE_TAG}`](https://hub.docker.com/r/${IMAGE_NAME}/tags?name=${IMAGE_TAG})" ) } } always { sh 'docker image prune -f' } diff --git a/ci/discord.groovy b/ci/discord.groovy deleted file mode 100644 index ee2f726b3..000000000 --- a/ci/discord.groovy +++ /dev/null @@ -1,40 +0,0 @@ -def void send(Map args=[:]) { - def opts = [ - header: args.header ?: 'Deployment successful!', - cred: args.cred ?: null, - ] - def repo = [ - url: GIT_URL.minus('.git'), - branch: GIT_BRANCH.minus('origin/'), - commit: GIT_COMMIT.take(8), - prev: ( - env.GIT_PREVIOUS_SUCCESSFUL_COMMIT ?: env.GIT_PREVIOUS_COMMIT ?: 'master' - ).take(8), - ] - wrap([$class: 'BuildUser']) { - BUILD_USER_ID = env.BUILD_USER_ID - } - withCredentials([ - string( - credentialsId: opts.cred, - variable: 'DISCORD_WEBHOOK', - ), - ]) { - discordSend( - link: env.BUILD_URL, - result: currentBuild.currentResult, - webhookURL: env.DISCORD_WEBHOOK, - title: "${env.JOB_NAME}#${env.BUILD_NUMBER}", - description: """ - ${opts.header} - Image: [`${IMAGE_NAME}:${IMAGE_TAG}`](https://hub.docker.com/r/${IMAGE_NAME}/tags?name=${IMAGE_TAG}) - Branch: [`${repo.branch}`](${repo.url}/commits/${repo.branch}) - Commit: [`${repo.commit}`](${repo.url}/commit/${repo.commit}) - Diff: [`${repo.prev}...${repo.commit}`](${repo.url}/compare/${repo.prev}...${repo.commit}) - By: [`${BUILD_USER_ID}`](${repo.url}/commits?author=${BUILD_USER_ID}) - """, - ) - } -} - -return this