add dockerhub creds to jenkinsfile

This commit is contained in:
imateja 2023-12-11 13:34:39 +01:00
parent 47e7a0eccd
commit b2d8d00942

20
Jenkinsfile vendored
View file

@ -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 {
}
}
}
}
}