Hi, I'm familiar with Jenkins but new to pipelines and I'm attempting to
migrate a complex setup.
The project I'm trying to migrate is based on Maven and divided into
separate applications: one dedicated to the front-end (rest), another
dedicated to translation (integration), one dedicated to content (cms),
etc...
In the current, old style, Jenkins setup we have the following steps:
1. Build: executes maven and runs some static analysis
2. DEV Deploy: puts the artifacts on multiple servers
3. Stub Deploy: updates the back-end service stubs
4. Acceptance Test: runs a series of end-to-end tests using the DEV
environment (step 2) and the stubbed back-end (step 3) collecting the
results
5. Regression Test: like step 5, but the tests cover everything and gets
executed during the night (it takes over 40 minutes to complete): also
enables following steps
6. Archive: executed only when the previous chain is successfully
completed with no warnings and a release tag has been created
7. UAT Deploy: executed only when step 6 is completed (meaning a release
tag and regression tests are mandatory)
I've created a docker-compose describing the whole structure above (grand
total of 8 containers) and I'm now trying to implement thos whole thing on
pipelines.
So far, this is what I've achieved:
pipeline {
agent {
docker {
image 'maven:3-alpine'
args '-v /root/.m2:/root/.m2'
}
}
stages {
stage('Build') {
steps {
sh 'printenv'
sh 'mvn verify'
archiveArtifacts(artifacts: '*/target/*.jar,*/target/*.war', fingerprint
: true, onlyIfSuccessful: true)
junit '*/target/surefire-reports/**/*.xml'
}
}
stage('Test') {
when {
not {
expression {
return currentBuild.rawBuild.getCause(hudson.triggers.
TimerTrigger$TimerTriggerCause)
}
}
}
steps {
echo 'start containers (docker-compose not working)'
echo 'deploy war files'
sh 'mvn integration-test -P ci'
echo 'publish report'
}
}
stage('Regression Test') {
when {
anyOf {
expression {
return
currentBuild.rawBuild.getCause(hudson.triggers.TimerTrigger$TimerTriggerCause)
}
tag ''
}
}
steps {
echo 'same as above but'
sh 'mvn integration-test -P ci,regression'
}
}
stage('Release') {
when {
branch 'master'
tag ''
}
steps {
echo 'deploy to UAT using SSH'
}
}
}
post {
success {
slackSend (color: '#2EB886', message: "Everything looks nice and
dandy...\nJob '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
failure {
slackSend (color: '#D00000', message: "Something's wrong...\nJob
'${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
unstable {
slackSend (color: '#DAA038', message: "Who broke the tests?\nJob
'${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
regression {
echo "Watch out, we broke the build!"
slackSend (color: '#FF0000', message: "Hey @channel, watch out: we broke
the build!\nJob '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
fixed {
echo "Well done lads, we are back in business!"
slackSend (color: '#00D000', message: "Well done lads, we are back in
business!\nJob '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}
As you can see I'm unable to run docker-compose as the tool is missing:
yes, I can install it, but is it the best way?
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/8078d2d5-7dda-49b5-8a8a-7007ec5974e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.