From f4a3e5576e363337081e8f3bd5da11af8f630950 Mon Sep 17 00:00:00 2001 From: Ally Smith Date: Mon, 1 Apr 2019 13:16:03 -0500 Subject: [PATCH] add slack webhook to Jenkinsfile --- Jenkinsfile | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8e420440ae..34916fbce7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,6 @@ def dtrVpnAddress = "vpn.corp-us-east-1.aws.dckr.io" def ucpBundle = [file(credentialsId: "ucp-bundle", variable: 'UCP')] +def slackString = [string(credentialsId: 'slack-docs-webhook', variable: 'slack')] def reg = [credentialsId: 'csebuildbot', url: 'https://index.docker.io/v1/'] pipeline { @@ -50,7 +51,6 @@ pipeline { } withDockerRegistry(reg) { sh """ - cd ucp-bundle-success_bot export DOCKER_TLS_VERIFY=1 export COMPOSE_TLS_VERSION=TLSv1_2 export DOCKER_CERT_PATH=${WORKSPACE}/ucp-bundle-success_bot @@ -70,15 +70,18 @@ pipeline { withCredentials(ucpBundle) { sh 'unzip -o $UCP' } - withDockerRegistry(reg) { - sh """ - cd ucp-bundle-success_bot - export DOCKER_TLS_VERIFY=1 - export COMPOSE_TLS_VERSION=TLSv1_2 - export DOCKER_CERT_PATH=${WORKSPACE}/ucp-bundle-success_bot - export DOCKER_HOST=tcp://ucp.corp-us-east-1.aws.dckr.io:443 - docker service update --detach=false --force --image docs/docker.github.io:prod-${env.BUILD_NUMBER} docs-docker-com_docs --with-registry-auth - """ + withCredentials(slackString) { + withDockerRegistry(reg) { + sh """ + cd ucp-bundle-success_bot + export DOCKER_TLS_VERIFY=1 + export COMPOSE_TLS_VERSION=TLSv1_2 + export DOCKER_CERT_PATH=${WORKSPACE}/ucp-bundle-success_bot + export DOCKER_HOST=tcp://ucp.corp-us-east-1.aws.dckr.io:443 + docker service update --detach=false --force --image docs/docker.github.io:prod-${env.BUILD_NUMBER} docs-docker-com_docs --with-registry-auth + curl -X POST -H 'Content-type: application/json' --data '{"text":"Successfully published docs. https://docs.docker.com/"}' $slack + """ + } } } } @@ -86,4 +89,4 @@ pipeline { } } } -} \ No newline at end of file +}