Update Jenkinsfile

This commit is contained in:
Marija Stopa 2025-01-17 14:57:27 +01:00 committed by GitHub
parent ee41c939a9
commit b8b8b71c5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

34
Jenkinsfile vendored
View file

@ -4,28 +4,28 @@ pipeline {
DOCKER_CREDENTIALS_ID = 'dockerhub-credentials'
}
stages {
stage('Checkstyle') {
steps {
sh './mvnw checkstyle:checkstyle'
archiveArtifacts artifacts: 'target/checkstyle-result.xml', fingerprint: true
}
}
stage('Test') {
steps {
sh './mvnw test'
}
}
stage('Build') {
steps {
sh './mvnw clean package -DskipTests'
}
}
// stage('Checkstyle') {
// steps {
// sh './mvnw checkstyle:checkstyle'
// archiveArtifacts artifacts: 'target/checkstyle-result.xml', fingerprint: true
// }
// }
// stage('Test') {
// steps {
// sh './mvnw test'
// }
// }
// stage('Build') {
// steps {
// sh './mvnw clean package -DskipTests'
// }
// }
stage('Create Docker Image') {
steps {
script {
withCredentials([usernamePassword(credentialsId: "${DOCKER_CREDENTIALS_ID}", usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) {
sh """
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
docker login -u \$DOCKER_USERNAME --password \$DOCKER_PASSWORD
docker build -t marijastopa/mr-jenkins:\${GIT_COMMIT:0:7} .
docker push marijastopa/mr-jenkins:\${GIT_COMMIT:0:7}
"""