mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-19 14:05:50 +00:00
Changed main Jenkinsfile to push to dockerhub
updated jenkinsfile replaced a couple instances of wrong account in jenkinsfile Added master branch logic and dockerhub cred updated docker login Changing master to this branch for testing reverting branch check, testing done. Added dockerhub push steps to full-demo Updated reference to tomcat image name fixed failing steps in jenkinsfile flatten jenkinsfile directory (#19) * flatten jenkinsfile directory * move full-demo jenkinsfile up one level revert root Jenkinsfile to be consistent with master Testing branch feature on full-demo Re-added a missing closing bracket Reverted to checking for master
This commit is contained in:
parent
21d78146ad
commit
7bb35e7d97
2 changed files with 29 additions and 3 deletions
|
@ -29,14 +29,24 @@ pipeline {
|
||||||
stage('Build container') {
|
stage('Build container') {
|
||||||
agent any
|
agent any
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -t petclinic-tomcat .'
|
script {
|
||||||
|
sh "docker build -t liatrio/petclinic-tomcat:${env.BRANCH_NAME} ."
|
||||||
|
if ( env.BRANCH_NAME == 'master' ) {
|
||||||
|
pom = readMavenPom file: 'pom.xml'
|
||||||
|
containerVersion = pom.version
|
||||||
|
/*Need to check if version exists in the future*/
|
||||||
|
/*failIfVersionExists("liatrio","petclinic-tomcat",containerVersion)*/
|
||||||
|
sh "docker build -t liatrio/petclinic-tomcat:${containerVersion} ."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Run local container') {
|
stage('Run local container') {
|
||||||
agent any
|
agent any
|
||||||
steps {
|
steps {
|
||||||
sh 'docker rm -f petclinic-tomcat-temp || true'
|
sh 'docker rm -f petclinic-tomcat-temp || true'
|
||||||
sh 'docker run -d --network=${LDOP_NETWORK_NAME} --name petclinic-tomcat-temp petclinic-tomcat'
|
sh 'env | grep LDOP'
|
||||||
|
sh "docker run -d --network=${LDOP_NETWORK_NAME} --name petclinic-tomcat-temp liatrio/petclinic-tomcat:${env.BRANCH_NAME}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Smoke-Test & OWASP Security Scan') {
|
stage('Smoke-Test & OWASP Security Scan') {
|
||||||
|
@ -57,6 +67,22 @@ pipeline {
|
||||||
sh 'docker rm -f petclinic-tomcat-temp || true'
|
sh 'docker rm -f petclinic-tomcat-temp || true'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Push to dockerhub') {
|
||||||
|
agent any
|
||||||
|
steps {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'dockerPassword', usernameVariable: 'dockerUsername')]){
|
||||||
|
script {
|
||||||
|
sh "docker login -u ${env.dockerUsername} -p ${env.dockerPassword}"
|
||||||
|
if ( env.BRANCH_NAME == 'master' ) {
|
||||||
|
sh "docker push liatrio/petclinic-tomcat:${containerVersion}"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sh "docker push liatrio/petclinic-tomcat:${env.BRANCH_NAME}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Deploy to dev') {
|
stage('Deploy to dev') {
|
||||||
agent any
|
agent any
|
||||||
steps {
|
steps {
|
Loading…
Reference in a new issue