Update Jenkinsfile

This commit is contained in:
surtexx 2023-11-13 16:52:11 +02:00 committed by GitHub
parent 34a5cdedfb
commit 696df647ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

66
Jenkinsfile vendored
View file

@ -1,5 +1,10 @@
pipeline{ pipeline{
agent any agent any
when {
expression {
return env.CHANGE_ID != null
}
}
stages { stages {
stage ("build") { stage ("build") {
steps { steps {
@ -28,3 +33,64 @@ pipeline{
} }
} }
} }
pipeline{
agent any
when {
expression {
return env.CHANGE_ID != null
}
}
stages {
stage ("build") {
steps {
echo "Running build automation..."
sh './mvnw checkstyle:checkstyle'
sh './mvnw verify'
sh './mvnw clean package -DskipTests=true'
}
}
stage ("Build Docker Image") {
steps {
script{
app = docker.build("surtexx/mr:${GIT_COMMIT[0..7]}", "-f Dockerfile1 .")
}
}
}
stage ("Push Docker Image") {
steps {
script{
docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') {
app.push("${GIT_COMMIT[0..7]}")
app.push("latest")
}
}
}
}
}
}
pipeline{
agent any
when{
branch: 'main'
}
stages{
stage ("Build Docker Image") {
steps {
script{
app = docker.build("surtexx/main", "-f Dockerfile1 .")
}
}
}
stage ("Push Docker Image") {
steps {
script{
docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') {
app.push("latest")
}
}
}
}
}
}