add slack webhook to Jenkinsfile

This commit is contained in:
Ally Smith 2019-04-01 13:16:03 -05:00 committed by GitHub
parent 67938199a8
commit f4a3e5576e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 11 deletions

25
Jenkinsfile vendored
View File

@ -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 {
}
}
}
}
}