storj/Jenkinsfile
Matt Robinson a5af25c9c2
Limit Jenkins to only one build at a time (#885)
* Fix docker images, again

* Limit jenkins to only one build of a branch at a time
2018-12-17 11:54:32 -05:00

66 lines
1.4 KiB
Groovy

node('node') {
disableConcurrentBuilds()
try {
currentBuild.result = "SUCCESS"
stage('Checkout') {
checkout scm
echo "Current build result: ${currentBuild.result}"
}
stage('Build Images') {
sh 'make images'
echo "Current build result: ${currentBuild.result}"
}
stage('Build Binaries') {
sh 'make binaries'
echo "Current build result: ${currentBuild.result}"
}
stage('Push Images') {
echo 'Push to Repo'
sh 'make push-images'
echo "Current build result: ${currentBuild.result}"
}
if (env.BRANCH_NAME == "master") {
/* This should only deploy to staging if the branch is master */
stage('Deploy to staging') {
sh 'make deploy'
echo "Current build result: ${currentBuild.result}"
}
}
stage('Upload') {
sh 'make binaries-upload'
echo "Current build result: ${currentBuild.result}"
}
}
catch (err) {
echo "Caught errors! ${err}"
echo "Setting build result to FAILURE"
currentBuild.result = "FAILURE"
mail from: 'builds@storj.io',
replyTo: 'builds@storj.io',
to: 'builds@storj.io',
subject: "storj/storj branch ${env.BRANCH_NAME} build failed",
body: "Project build log: ${env.BUILD_URL}"
throw err
}
finally {
stage('Cleanup') {
sh 'make clean-images'
deleteDir()
}
}
}