hubs-ops/jenkins/Jenkinsfile.ret-deploy

35 строки
2.1 KiB
Plaintext

import groovy.json.JsonOutput
pipeline {
agent any
stages {
stage('deploy') {
steps {
script {
def retPool = env.RET_POOL
def slackURL = 'https://hooks.slack.com/services/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'
def text = "Deploying reticulum `${env.RET_VERSION}` to `${retPool}`"
def payload = JsonOutput.toJson([text : text, channel : "#mr-push", username : "pushbot", icon_emoji: ":robot_face:"])
sh "curl -X POST --data-urlencode \'payload=${payload}\' ${slackURL}"
}
sh "bin/ret_alb_to_pool.sh '${env.RET_DEV_POOL_HOST}' '${env.RET_DEV_SECONDARY_HOST}' '${env.RET_DEV_CORS_HOST}' '${env.RET_POOL}' dev"
sh "bin/ret_alb_to_pool.sh '${env.RET_PROD_POOL_HOST}' '${env.RET_PROD_SECONDARY_HOST}' '${env.RET_PROD_CORS_HOST}' '${env.RET_POOL}' prod"
sh "curl -H \"x-ret-admin-access-key: ${env.RET_DEV_ADMIN_ACCESS_KEY}\" -H \"Content-Type: application/json\" -XPOST -d \"{ \\\"event\\\": \\\"ret-deploy\\\", \\\"ret_pool\\\": \\\"${env.RET_POOL}\\\", \\\"ret_version\\\": \\\"${env.RET_VERSION}\\\" }\" https://${env.RET_DEV_POOL_HOST}/api/v1/ret_notices"
sh "curl -H \"x-ret-admin-access-key: ${env.RET_PROD_ADMIN_ACCESS_KEY}\" -H \"Content-Type: application/json\" -XPOST -d \"{ \\\"event\\\": \\\"ret-deploy\\\", \\\"ret_pool\\\": \\\"${env.RET_POOL}\\\", \\\"ret_version\\\": \\\"${env.RET_VERSION}\\\" }\" https://${env.RET_PROD_POOL_HOST}/api/v1/ret_notices"
script {
retPool = env.RET_POOL
retPoolIcon = retPool == 'earth' ? ':earth_americas:' : ':new_moon:'
slackURL = env.SLACK_URL
text = ("${retPoolIcon} reticulum `${env.RET_VERSION}` live on `${retPool}`\n" +
"<https://hubs.mozilla.com/0zuesf6c6mf/smoke-test?required_ret_version=${env.RET_VERSION}&required_ret_pool=${retPool}|Monitor Deploy>")
payload = JsonOutput.toJson([text : text, channel : "#mr-push", username : "pushbot", icon_emoji: ":robot_face:"])
sh "curl -X POST --data-urlencode \'payload=${payload}\' ${slackURL}"
}
}
}
}
}