Skip to content

Instantly share code, notes, and snippets.

@eeganlf
Created May 9, 2025 15:15
Show Gist options
  • Save eeganlf/391ab3ed4b59bfb22a4ae8e219ca923a to your computer and use it in GitHub Desktop.
Save eeganlf/391ab3ed4b59bfb22a4ae8e219ca923a to your computer and use it in GitHub Desktop.
pipeline {
agent any
tools{
maven 'maven 3.9.8'
}
stages{
stage(build){
when{
changeset "**/worker/**"
}
steps{
echo 'Compiling worker app..'
dir('worker'){
sh 'mvn compile'
}
}
}
stage(test){
when{
changeset "**/worker/**"
}
steps{
echo 'Running Unit Tests on worker app..'
dir('worker'){
sh 'mvn clean test'
}
}
}
stage(package){
when{
branch 'master'
changeset "**/worker/**"
}
steps{
echo 'Packaging worker app'
dir('worker'){
sh 'mvn package -DskipTests'
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true }
}
}
}
post{
always{
echo 'Building multibranch pipeline for worker is completed..'
}
failure{
slackSend (channel: "instavote-cd", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)") }
success{
slackSend (channel: "instavote-cd", message: "Build Succeeded - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment