Initial jenkisfile changes

This commit is contained in:
Svetlana Mancic 2025-06-02 11:36:47 +02:00
parent 9081b0a6ff
commit b9af08c703

58
Jenkinsfile vendored
View file

@ -1,9 +1,63 @@
pipeline {
agent { label 'pipeline-agent' }
stages {
stage ('Build') {
stage ('Checkstyle') {
when {
changeRequest()
}
steps {
sh 'mvn checkstyle:check'
sh './mvnw checkstyle:checkstyle'
}
post {
always {
archiveArtifacts artifacts: 'target/checkstyle-result.xml', fingerprint: true
}
}
}
stage ('Test') {
when {
changeRequest()
}
steps {
sh './mvnw test -B'
}
}
stage ('Build') {
when {
changeRequest()
}
steps {
sh './mvnw clean package -DskipTests'
}
}
stage ('Docker Push to MR') {
when {
changeRequest()
}
environment {
IMAGE = credentials('docker_image_name')
REGISTRY = credentials('nexus_url_main')
}
steps {
script {
def GIT_COMMIT_SHORT = env.GIT_COMMIT.take(7)
echo "Git commit short is ${GIT_COMMIT_SHORT}"
}
}
}
stage ('Docker Push to Main') {
when {
branch 'main'
}
environment {
IMAGE = credentials('docker_image_name')
REGISTRY = credentials('nexus_url_main')
}
steps {
script {
def GIT_COMMIT_SHORT = env.GIT_COMMIT.take(7)
echo "Git commit short is ${GIT_COMMIT_SHORT}"
}
}
}
}