-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathjenkins_prod_deploy
23 lines (17 loc) · 961 Bytes
/
jenkins_prod_deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
node {
properties([parameters([string(defaultValue: '', description: 'Version of order_service to deploy in environment.', name: 'version', trim: true)])])
stage('deploy-compatibility') {
def pactBrokerCli = "/usr/share/jenkins/ref/pact/bin/pact-broker"
def statusCode = sh script: "${pactBrokerCli} can-i-deploy --pacticipant order_service --version ${params.version} --to PROD --broker-base-url http://broker_app", returnStatus: true
if(statusCode == 1) {
error("The version is not compatible with services running in PROD environment")
}
}
stage('Deploy') {
echo "Deploying to PROD as compatibility check passed"
}
stage('create-pact-tag') {
def pactBrokerCli = "/usr/share/jenkins/ref/pact/bin/pact-broker"
sh "${pactBrokerCli} create-version-tag --pacticipant order_service --version ${params.version} --tag PROD --broker-base-url http://broker_app"
}
}