Skip to content

Commit 03c9043

Browse files
feat: WIP
1 parent 757f8fb commit 03c9043

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

customer-service/Jenkinsfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,14 @@ pipeline {
184184
} else {
185185
sh "sshpass -p 'jenkins' ssh -o 'StrictHostKeyChecking=no' -p 2222 -q jenkins:jenkins@test '[ -f ~/customer-service-distribution/bin/meecrowave.sh ] && ~/customer-service-distribution/bin/meecrowave.sh stop && rm -rf ~/customer-service-distribution/; unzip ~/artifacts/customer-service/${env.DEPLOYMENT_VERSION}/customer-service-meecrowave-distribution.zip -d ~/; nohup ~/customer-service-distribution/bin/meecrowave.sh start --http=8081'"
186186
}
187+
int previousRevision = Integer.parseInt(env.RELEASE_VERSION.substring(env.RELEASE_VERSION.lastIndexOf(".") + 1)) - 1
188+
previousVersion = env.PACT_VERSION
189+
if (previousRevision >= 0) {
190+
previousVersion = RELEASE_VERSION.substring(0, env.RELEASE_VERSION.lastIndexOf(".")) + "." + previousRevision
191+
}
187192
sh "pact-broker create-or-update-pacticipant --broker-base-url=http://pact:9292 --name=customer-service --main-branch=main"
188-
sh "pact-broker create-or-update-version --broker-base-url=http://pact:9292 --pacticipant=customer-service --version=${env.PACT_VERSION}"
189-
sh "pact-broker record-deployment --broker-base-url=http://pact:9292 --pacticipant=customer-service --environment=${env.STAGE} --version=${env.PACT_VERSION}"
193+
sh "pact-broker create-or-update-version --broker-base-url=http://pact:9292 --pacticipant=customer-service --version=${previousVersion}"
194+
sh "pact-broker record-deployment --broker-base-url=http://pact:9292 --pacticipant=customer-service --environment=${env.STAGE} --version=${previousVersion}"
190195
}
191196
}
192197
}

delivery-service/Jenkinsfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,14 @@ pipeline {
214214
} else {
215215
sh "sshpass -p 'jenkins' ssh -o 'StrictHostKeyChecking=no' -p 2222 -q jenkins:jenkins@test '[ -f ~/delivery-service-distribution/bin/meecrowave.sh ] && ~/delivery-service-distribution/bin/meecrowave.sh stop && rm -rf ~/delivery-service-distribution/; unzip ~/artifacts/delivery-service/${env.DEPLOYMENT_VERSION}/delivery-service-meecrowave-distribution.zip -d ~/; export JAKARTA_PERSISTENCE_JDBC_URL=jdbc:postgresql://delivery-db-test:5432/postgres; nohup ~/delivery-service-distribution/bin/meecrowave.sh start --http=8083'"
216216
}
217+
int previousRevision = Integer.parseInt(env.RELEASE_VERSION.substring(env.RELEASE_VERSION.lastIndexOf(".") + 1)) - 1
218+
previousVersion = env.PACT_VERSION
219+
if (previousRevision >= 0) {
220+
previousVersion = RELEASE_VERSION.substring(0, env.RELEASE_VERSION.lastIndexOf(".")) + "." + previousRevision
221+
}
217222
sh "pact-broker create-or-update-pacticipant --broker-base-url=http://pact:9292 --name=delivery-service --main-branch=main"
218-
sh "pact-broker create-or-update-version --broker-base-url=http://pact:9292 --pacticipant=delivery-service --version=${env.PACT_VERSION}"
219-
sh "pact-broker record-deployment --broker-base-url=http://pact:9292 --pacticipant=delivery-service --environment=${env.STAGE} --version=${env.PACT_VERSION}"
223+
sh "pact-broker create-or-update-version --broker-base-url=http://pact:9292 --pacticipant=delivery-service --version=${previousVersion}"
224+
sh "pact-broker record-deployment --broker-base-url=http://pact:9292 --pacticipant=delivery-service --environment=${env.STAGE} --version=${previousVersion}"
220225
}
221226
}
222227
}

0 commit comments

Comments
 (0)