-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
39 lines (38 loc) · 1.86 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'mvn clean verify -Dpact.verifier.publishResults=true -Dpactbroker.host=${PACT_BROKER_HOST} -Dpactbroker.port=${PACT_BROKER_PORT} -Dpact.provider.version=${GIT_COMMIT}'
sh 'pact-broker publish --consumer-app-version ${GIT_COMMIT} --broker-base-url "${PACT_BROKER_HOST}:${PACT_BROKER_PORT}" ./target/pacts --tag build'
}
}
stage('Deploy to Test') {
environment {
ENV_TAG = 'Test'
}
steps {
input 'Do you Want to Deploy To Test?'
sh 'pact-broker can-i-deploy --pacticipant ${PACTICIPANT} --version ${GIT_COMMIT} --to ${ENV_TAG} --broker-base-url "${PACT_BROKER_HOST}:${PACT_BROKER_PORT}"'
echo 'Deploying to Test environment'
echo 'Deployed to Test Environment'
sh 'pact-broker create-version-tag --pacticipant ${PACTICIPANT} --version ${GIT_COMMIT} --tag ${ENV_TAG} --broker-base-url "${PACT_BROKER_HOST}:${PACT_BROKER_PORT}"'
}
}
stage('Deploy to Production') {
environment {
ENV_TAG = 'Prod'
}
steps {
input 'Do you Want to Deploy To Production?'
sh 'pact-broker can-i-deploy --pacticipant ${PACTICIPANT} --version ${GIT_COMMIT} --to ${ENV_TAG} --broker-base-url "${PACT_BROKER_HOST}:${PACT_BROKER_PORT}"'
echo 'Deploying to Production environment'
echo 'Deployed to Production Environment'
sh 'pact-broker create-version-tag --pacticipant ${PACTICIPANT} --version ${GIT_COMMIT} --tag ${ENV_TAG} --broker-base-url "${PACT_BROKER_HOST}:${PACT_BROKER_PORT}"'
}
}
}
environment {
PACTICIPANT = 'testers-service'
}
}