mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 05:45:50 +00:00
Update Jenkinsfile
This commit is contained in:
parent
7ad54503b9
commit
76187eb998
1 changed files with 14 additions and 6 deletions
20
Jenkinsfile
vendored
20
Jenkinsfile
vendored
|
@ -47,9 +47,13 @@ pipeline {
|
||||||
script {
|
script {
|
||||||
def shortCommit = sh(script: "git rev-parse --short HEAD", returnStdout: true).trim()
|
def shortCommit = sh(script: "git rev-parse --short HEAD", returnStdout: true).trim()
|
||||||
|
|
||||||
docker.withRegistry("http://host.docker.internal:${env.NEXUS_PORT_MR}", 'nexus-credentials') {
|
sh "docker build -f Dockerfile.multi -t host.docker.internal:8084/mr:${shortCommit} ."
|
||||||
def customImage = docker.build("host.docker.internal:${env.NEXUS_PORT_MR}/${env.NEXUS_REPO_MR}:${shortCommit}", "-f Dockerfile.multi .")
|
|
||||||
customImage.push()
|
withCredentials([usernamePassword(credentialsId: 'nexus-credentials',
|
||||||
|
usernameVariable: 'NEXUS_USERNAME',
|
||||||
|
passwordVariable: 'NEXUS_PASSWORD')]) {
|
||||||
|
sh "echo \${NEXUS_PASSWORD} | docker login host.docker.internal:8084 -u \${NEXUS_USERNAME} --password-stdin"
|
||||||
|
sh "docker push host.docker.internal:8084/mr:${shortCommit}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,9 +82,13 @@ pipeline {
|
||||||
script {
|
script {
|
||||||
def shortCommit = sh(script: "git rev-parse --short HEAD", returnStdout: true).trim()
|
def shortCommit = sh(script: "git rev-parse --short HEAD", returnStdout: true).trim()
|
||||||
|
|
||||||
docker.withRegistry("http://host.docker.internal:${env.NEXUS_PORT_MAIN}", 'nexus-credentials') {
|
sh "docker build -f Dockerfile.multi -t host.docker.internal:8083/main:${shortCommit} ."
|
||||||
def customImage = docker.build("host.docker.internal:${env.NEXUS_PORT_MAIN}/${env.NEXUS_REPO_MAIN}:${shortCommit}", "-f Dockerfile.multi .")
|
|
||||||
customImage.push()
|
withCredentials([usernamePassword(credentialsId: 'nexus-credentials',
|
||||||
|
usernameVariable: 'NEXUS_USERNAME',
|
||||||
|
passwordVariable: 'NEXUS_PASSWORD')]) {
|
||||||
|
sh "echo \${NEXUS_PASSWORD} | docker login host.docker.internal:8083 -u \${NEXUS_USERNAME} --password-stdin"
|
||||||
|
sh "docker push host.docker.internal:8083/main:${shortCommit}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue