mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 23:05:50 +00:00
Another Jenkinsfile update.
This commit is contained in:
parent
2eeed5fbd4
commit
322469f749
1 changed files with 40 additions and 26 deletions
66
Jenkinsfile
vendored
66
Jenkinsfile
vendored
|
@ -22,8 +22,10 @@ pipeline {
|
|||
echo "Checkout source."
|
||||
git url: "${gitSourceUrl}", branch: "${gitSourceRef}"
|
||||
echo "Read POM info."
|
||||
pom = readMavenPom file: 'pom.xml'
|
||||
projectVersion = pom.version
|
||||
script {
|
||||
pom = readMavenPom file: 'pom.xml'
|
||||
projectVersion = pom.version
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build JAR') {
|
||||
|
@ -42,11 +44,13 @@ pipeline {
|
|||
}
|
||||
stage('Build Image') {
|
||||
steps {
|
||||
echo "Build container image."
|
||||
openshift.withCluster() {
|
||||
script {
|
||||
echo "Build container image."
|
||||
openshift.withCluster() {
|
||||
openshift.withProject('cicd') {
|
||||
sh "oc start-build ${appName}-s2i-build --from-file=target/app.jar -n cicd --follow"
|
||||
sh "oc start-build ${appName}-s2i-build --from-file=target/app.jar -n cicd --follow"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,42 +70,52 @@ pipeline {
|
|||
}
|
||||
stage('Deploy DEV') {
|
||||
steps {
|
||||
echo "Deploy to DEV."
|
||||
openshift.withCluster() {
|
||||
openshift.withProject("${appName}-dev") {
|
||||
echo "Rolling out to DEV."
|
||||
def dc = openshift.selector('dc', "${appName}")
|
||||
dc.rollout().latest()
|
||||
dc.rollout().status()
|
||||
script {
|
||||
echo "Deploy to DEV."
|
||||
openshift.withCluster() {
|
||||
openshift.withProject("${appName}-dev") {
|
||||
echo "Rolling out to DEV."
|
||||
def dc = openshift.selector('dc', "${appName}")
|
||||
dc.rollout().latest()
|
||||
dc.rollout().status()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Integration Tests') {
|
||||
echo "Running Integration tests..."
|
||||
sh "mvn verify -Pfailsafe"
|
||||
steps {
|
||||
echo "Running Integration tests..."
|
||||
sh "mvn verify -Pfailsafe"
|
||||
}
|
||||
}
|
||||
stage('Tag UAT') {
|
||||
agent {
|
||||
label 'jenkins-slave-skopeo'
|
||||
}
|
||||
script {
|
||||
openshift.withCluster() {
|
||||
withCredentials([usernamePassword(credentialsId: "${openshift.project()}-quay-creds-secret", usernameVariable: "QUAY_USERNAME", passwordVariable: "QUAY_PASSWORD")]) {
|
||||
sh "skopeo copy docker://quay.io/${QUAY_USERNAME}/${QUAY_REPOSITORY}:dev docker://quay.io/${QUAY_USERNAME}/${QUAY_REPOSITORY}:uat --src-creds \"$QUAY_USERNAME:$QUAY_PASSWORD\" --dest-creds \"$QUAY_USERNAME:$QUAY_PASSWORD\" --src-tls-verify=false --dest-tls-verify=false"
|
||||
steps {
|
||||
script {
|
||||
openshift.withCluster() {
|
||||
withCredentials([usernamePassword(credentialsId: "${openshift.project()}-quay-creds-secret", usernameVariable: "QUAY_USERNAME", passwordVariable: "QUAY_PASSWORD")]) {
|
||||
sh "skopeo copy docker://quay.io/${QUAY_USERNAME}/${QUAY_REPOSITORY}:dev docker://quay.io/${QUAY_USERNAME}/${QUAY_REPOSITORY}:uat --src-creds \"$QUAY_USERNAME:$QUAY_PASSWORD\" --dest-creds \"$QUAY_USERNAME:$QUAY_PASSWORD\" --src-tls-verify=false --dest-tls-verify=false"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Deploy UAT') {
|
||||
echo "Deploy to UAT."
|
||||
openshift.withCluster() {
|
||||
openshift.withProject("${appName}-uat") {
|
||||
echo "Rolling out to UAT."
|
||||
def dc = openshift.selector('dc', "${appName}")
|
||||
dc.rollout().latest()
|
||||
dc.rollout().status()
|
||||
steps {
|
||||
script {
|
||||
echo "Deploy to UAT."
|
||||
openshift.withCluster() {
|
||||
openshift.withProject("${appName}-uat") {
|
||||
echo "Rolling out to UAT."
|
||||
def dc = openshift.selector('dc', "${appName}")
|
||||
dc.rollout().latest()
|
||||
dc.rollout().status()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue