mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 07:45:49 +00:00
add dockerhub creds to jenkinsfile
This commit is contained in:
parent
47e7a0eccd
commit
b2d8d00942
1 changed files with 19 additions and 1 deletions
20
Jenkinsfile
vendored
20
Jenkinsfile
vendored
|
@ -1,10 +1,27 @@
|
|||
pipeline {
|
||||
|
||||
agent any
|
||||
|
||||
environment {
|
||||
// Define environment variable using credentials
|
||||
DOCKER_CREDENTIALS = credentials('dockercreds')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Docker Login') {
|
||||
steps {
|
||||
script {
|
||||
// Perform Docker login using credentials
|
||||
withEnv(["DOCKER_USERNAME=${DOCKER_CREDENTIALS_USR}", "DOCKER_PASSWORD=${DOCKER_CREDENTIALS_PSW}"]) {
|
||||
sh "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkstyle') {
|
||||
steps {
|
||||
sh './mvnw checkstyle:checkstyle'
|
||||
}
|
||||
}s
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: '**/target/checkstyle-result.xml', allowEmptyArchive: true
|
||||
|
@ -30,5 +47,6 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue