63 lines
1.4 KiB
Plaintext
Raw Normal View History

2021-12-10 09:48:02 -08:00
#!groovy
2021-12-10 09:58:35 -08:00
def MAVEN_IMAGE = 'maven:3.8.2-openjdk-11-slim'
2021-12-10 09:48:02 -08:00
pipeline {
2021-12-10 09:58:35 -08:00
// agent any
2021-12-10 09:48:02 -08:00
2021-12-10 09:58:35 -08:00
agent {
docker {
image "${MAVEN_IMAGE}"
}
}
2021-12-10 09:48:02 -08:00
environment {
2021-12-10 09:58:41 -08:00
BRANCH_NAME = env.GIT_BRANCH.replace('master/', '')
2021-12-10 09:48:02 -08:00
}
stages {
stage('Build') {
steps {
2021-12-10 10:08:45 -08:00
// dir('messaging-app') {
2021-12-10 09:59:33 -08:00
sh 'mvn clean verify'
2021-12-10 10:08:45 -08:00
// }
2021-12-10 09:48:02 -08:00
}
}
2021-12-10 10:08:45 -08:00
stage('Static Code Analysis') {
steps {
withSonarQubeEnv('cicd') {
sh 'mvn sonar:sonar'
}
}
// maven:end
}
2021-12-10 09:48:02 -08:00
stage('Publish Pacts') {
steps {
2021-12-10 09:59:33 -08:00
sh 'mvn pact:publish -Dpact.consumer.version=${GIT_COMMIT} -Dpact.tag=${BRANCH_NAME}'
2021-12-10 09:48:02 -08:00
}
}
stage('Check Pact Verifications') {
steps {
2021-12-10 14:51:07 -08:00
sh 'cp files/cacert.pem /tmp'
withEnv(['SSL_CERT_FILE=/tmp/cacert.pem']) {
2021-12-10 14:52:37 -08:00
sh 'curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.88.3/pact-1.88.3-linux-x86_64.tar.gz'
2021-12-10 14:36:53 -08:00
sh 'tar xzf pact-1.88.3-linux-x86_64.tar.gz'
2021-12-10 14:42:35 -08:00
dir('pact/bin') {
sh "./pact-broker can-i-deploy --retry-while-unknown=12 --retry-interval=10\
-a messaging-app -b https://pact.bayhan.ca -e ${GIT_COMMIT}"
}
2021-12-10 14:36:53 -08:00
}
2021-12-10 09:48:02 -08:00
}
}
stage('Deploy') {
when {
branch 'junit5'
}
steps {
echo 'Deploying to prod now...'
}
}
}
2021-12-10 09:58:35 -08:00
}