Archive checkstyle

This commit is contained in:
JustFiesta 2024-05-02 15:23:11 +02:00
parent 2c6bc73d89
commit ebfebd789d

15
Jenkinsfile vendored
View file

@ -1,8 +1,10 @@
// Merge request pipeline
pipeline { pipeline {
agent any agent any
environment { environment {
NEXUS_CREDS = credentials('nexus-cred') NEXUS_CREDS = credentials('nexus-cred')
NEXUS_DOCKER_REPO = '34.241.46.54:8085' NEXUS_DOCKER_REPO_MR = '34.241.46.54:8085'
NEXUS_DOCKER_REPO_MAIN = '34.241.46.54:8084'
} }
tools { tools {
@ -15,6 +17,11 @@ pipeline {
echo 'Running gradle checkstyle' echo 'Running gradle checkstyle'
sh './gradlew checkstyleMain --no-daemon' sh './gradlew checkstyleMain --no-daemon'
} }
post {
always {
archiveArtifacts artifacts: 'build/reports/checkstyle/*.xml', fingerprint: true
}
}
} }
stage('Test') { stage('Test') {
steps { steps {
@ -32,7 +39,7 @@ pipeline {
steps { steps {
echo 'Building docker Image' echo 'Building docker Image'
sh 'docker build -t $NEXUS_DOCKER_REPO/spring-petclinic:${GIT_COMMIT} .' sh 'docker build -t $NEXUS_DOCKER_REPO_MR/spring-petclinic:${GIT_COMMIT} .'
} }
} }
stage('Docker Login') { stage('Docker Login') {
@ -40,7 +47,7 @@ pipeline {
echo 'Nexus Docker Repository Login' echo 'Nexus Docker Repository Login'
script{ script{
withCredentials([usernamePassword(credentialsId: 'nexus-cred', usernameVariable: 'USER', passwordVariable: 'PASS' )]){ withCredentials([usernamePassword(credentialsId: 'nexus-cred', usernameVariable: 'USER', passwordVariable: 'PASS' )]){
sh ' echo $PASS | docker login -u $USER --password-stdin $NEXUS_DOCKER_REPO' sh 'echo $PASS | docker login -u $USER --password-stdin $NEXUS_DOCKER_REPO_MR'
} }
} }
@ -49,7 +56,7 @@ pipeline {
stage('Docker Push') { stage('Docker Push') {
steps { steps {
echo 'Pushing Image to docker hub' echo 'Pushing Image to docker hub'
sh 'docker push $NEXUS_DOCKER_REPO/spring-petclinic:${GIT_COMMIT}' sh 'docker push $NEXUS_DOCKER_REPO_MR/spring-petclinic:${GIT_COMMIT}'
} }
} }
} }