From 35124524e748fe593629f867b7142e89477729cd Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Tue, 13 Feb 2018 12:04:49 -0800 Subject: [PATCH] Switch to new trySlackSend function Switch all slackSend calls to trySlackSend. Fixes errors like these when the Slack Notification Plugin is not configured: java.lang.NoSuchMethodError: No such DSL method 'slackSend' found Signed-off-by: Geoff Levand --- os/board/sign-image.groovy | 6 +----- os/docs-sync.groovy | 2 +- os/glsa.groovy | 2 +- os/kola/aws.groovy | 2 +- os/kola/do.groovy | 2 +- os/kola/gce.groovy | 2 +- os/kola/oci.groovy | 2 +- os/kola/packet.groovy | 2 +- os/kola/qemu.groovy | 2 +- os/kola/qemu_uefi.groovy | 2 +- os/manifest.groovy | 8 +------- os/nightly-build.groovy | 4 ++-- os/tectonic-nightly.groovy | 2 +- 13 files changed, 14 insertions(+), 24 deletions(-) diff --git a/os/board/sign-image.groovy b/os/board/sign-image.groovy index c46e220..4deff4a 100644 --- a/os/board/sign-image.groovy +++ b/os/board/sign-image.groovy @@ -106,11 +106,7 @@ stage('Wait') { def msg = """The ${params.BOARD} ${version ?: "UNKNOWN"} build is waiting for the boot loader files to be signed for Secure Boot and uploaded to continue.\n When all boot loader files are uploaded, go to ${BUILD_URL}input and proceed with the build.""" - try { - slackSend color: '#C0C0C0', message: msg - } catch (NoSuchMethodError err) { - echo msg - } + trySlackSend color: '#C0C0C0', message: msg input 'Waiting for the signed UEFI binaries to be ready...' } diff --git a/os/docs-sync.groovy b/os/docs-sync.groovy index a2f576f..90d518b 100644 --- a/os/docs-sync.groovy +++ b/os/docs-sync.groovy @@ -176,7 +176,7 @@ git -C coreos-pages push -f ${forkUrl} ${branch} sourceBranch: branch, title: "os: sync ${version}", message: "From: ${env.BUILD_URL}" - slackSend color: '#2020C0', + trySlackSend color: '#2020C0', message: "${version} (${channel}) docs: ${url}" } } diff --git a/os/glsa.groovy b/os/glsa.groovy index 39cad67..e901585 100644 --- a/os/glsa.groovy +++ b/os/glsa.groovy @@ -106,7 +106,7 @@ exit 0 # Do not return a non-zero $? from above. def color = readFile 'status.txt' def message = readFile 'notify.txt' if (message) - slackSend color: color ?: '#C0C0C0', message: """${message} + trySlackSend color: color ?: '#C0C0C0', message: """${message} Run `update_ebuilds --commit --portage=rsync metadata/glsa` in the SDK to \ update GLSA definitions.""" } diff --git a/os/kola/aws.groovy b/os/kola/aws.groovy index 99a8a00..6b0f221 100644 --- a/os/kola/aws.groovy +++ b/os/kola/aws.groovy @@ -101,5 +101,5 @@ timeout --signal=SIGQUIT 120m bin/kola run \ currentBuild.result = rc == 0 ? 'SUCCESS' : 'FAILURE' if (currentBuild.result == 'FAILURE') - slackSend color: 'danger', + trySlackSend color: 'danger', message: "```Kola: AWS-amd64-$AWS_AMI_TYPE Failure: <${BUILD_URL}console|Console> - <${BUILD_URL}artifact/_kola_temp.tar.xz|_kola_temp>\n$message```" diff --git a/os/kola/do.groovy b/os/kola/do.groovy index 00d8066..47d9dcd 100644 --- a/os/kola/do.groovy +++ b/os/kola/do.groovy @@ -147,5 +147,5 @@ timeout --signal=SIGQUIT 60m bin/kola run \ currentBuild.result = rc == 0 ? 'SUCCESS' : 'FAILURE' if (currentBuild.result == 'FAILURE') - slackSend color: 'danger', + trySlackSend color: 'danger', message: "```Kola: DO-amd64 Failure: <${BUILD_URL}console|Console> - <${BUILD_URL}artifact/_kola_temp.tar.xz|_kola_temp>\n$message```" diff --git a/os/kola/gce.groovy b/os/kola/gce.groovy index e123552..8ac8450 100644 --- a/os/kola/gce.groovy +++ b/os/kola/gce.groovy @@ -104,5 +104,5 @@ timeout --signal=SIGQUIT 60m bin/kola run \ currentBuild.result = rc == 0 ? 'SUCCESS' : 'FAILURE' if (currentBuild.result == 'FAILURE') - slackSend color: 'danger', + trySlackSend color: 'danger', message: "```Kola: GCE-amd64 Failure: <${BUILD_URL}console|Console> - <${BUILD_URL}artifact/_kola_temp.tar.xz|_kola_temp>\n$message```" diff --git a/os/kola/oci.groovy b/os/kola/oci.groovy index 28480f9..7a14aab 100644 --- a/os/kola/oci.groovy +++ b/os/kola/oci.groovy @@ -215,5 +215,5 @@ EOF currentBuild.result = rc == 0 ? 'SUCCESS' : 'FAILURE' if (currentBuild.result == 'FAILURE') - slackSend color: 'danger', + trySlackSend color: 'danger', message: "```Kola: OCI-amd64 Failure: <${BUILD_URL}console|Console> - <${BUILD_URL}artifact/_kola_temp.tar.xz|_kola_temp>\n$message```" diff --git a/os/kola/packet.groovy b/os/kola/packet.groovy index 9dac85d..3743b48 100644 --- a/os/kola/packet.groovy +++ b/os/kola/packet.groovy @@ -159,5 +159,5 @@ timeout --signal=SIGQUIT "${timeout}" bin/kola run \ currentBuild.result = rc == 0 ? 'SUCCESS' : 'FAILURE' if (currentBuild.result == 'FAILURE') - slackSend color: 'danger', + trySlackSend color: 'danger', message: "```Kola: Packet-$BOARD Failure: <${BUILD_URL}console|Console> - <${BUILD_URL}artifact/_kola_temp.tar.xz|_kola_temp>\n$message```" diff --git a/os/kola/qemu.groovy b/os/kola/qemu.groovy index 338b939..2fad72d 100644 --- a/os/kola/qemu.groovy +++ b/os/kola/qemu.groovy @@ -151,5 +151,5 @@ fi currentBuild.result = rc == 0 ? 'SUCCESS' : 'FAILURE' if (currentBuild.result == 'FAILURE') - slackSend color: 'danger', + trySlackSend color: 'danger', message: "```Kola: QEMU-amd64 Failure: <${BUILD_URL}console|Console> - <${BUILD_URL}artifact/_kola_temp.tar.xz|_kola_temp>\n$message```" diff --git a/os/kola/qemu_uefi.groovy b/os/kola/qemu_uefi.groovy index cd0036c..6927d10 100644 --- a/os/kola/qemu_uefi.groovy +++ b/os/kola/qemu_uefi.groovy @@ -146,5 +146,5 @@ sudo rm -rf tmp currentBuild.result = rc == 0 ? 'SUCCESS' : 'FAILURE' if (currentBuild.result == 'FAILURE') - slackSend color: 'danger', + trySlackSend color: 'danger', message: "```Kola: QEMU_UEFI-$BOARD Failure: <${BUILD_URL}console|Console> - <${BUILD_URL}artifact/_kola_temp.tar.xz|_kola_temp>\n$message```" diff --git a/os/manifest.groovy b/os/manifest.groovy index 8db80de..98774ff 100644 --- a/os/manifest.groovy +++ b/os/manifest.groovy @@ -287,13 +287,7 @@ do done ''' /* Editor quote safety: ' */ } - - String summary = readFile('message.txt').trim() - try { - slackSend color: '#2020C0', message: summary - } catch (NoSuchMethodError err) { - echo summary - } + trySlackSend color: '#2020C0', message: readFile('message.txt').trim() } } } diff --git a/os/nightly-build.groovy b/os/nightly-build.groovy index d6976e9..7c2318e 100644 --- a/os/nightly-build.groovy +++ b/os/nightly-build.groovy @@ -8,10 +8,10 @@ stage('Downstream') { def run = build job: 'manifest', propagate: false if (run.result == 'SUCCESS') - slackSend color: 'good', + trySlackSend color: 'good', message: ":partyparrot: The nightly OS build succeeded!\n${BUILD_URL}cldsv" else - slackSend color: 'danger', + trySlackSend color: 'danger', message: ":trashfire: The nightly OS build failed!\n${BUILD_URL}cldsv" currentBuild.result = run.result diff --git a/os/tectonic-nightly.groovy b/os/tectonic-nightly.groovy index 1cbc566..6a19d9a 100644 --- a/os/tectonic-nightly.groovy +++ b/os/tectonic-nightly.groovy @@ -146,7 +146,7 @@ node('amd64 && docker') { } if (rc != 0) - slackSend color: 'danger', + trySlackSend color: 'danger', message: "tectonic-nightly failed!\n$BUILD_URL", channel: '@slowrie'