storj/Jenkinsfile

68 lines
1.5 KiB
Plaintext
Raw Normal View History

2018-04-25 19:04:12 +01:00
node('node') {
properties([disableConcurrentBuilds()])
2018-04-25 19:04:12 +01:00
try {
currentBuild.result = "SUCCESS"
2018-04-25 19:04:12 +01:00
stage('Checkout') {
checkout scm
echo "Current build result: ${currentBuild.result}"
}
2018-04-25 19:04:12 +01:00
stage('Build Binaries') {
sh 'make binaries'
echo "Current build result: ${currentBuild.result}"
}
2018-04-25 19:04:12 +01:00
stage('Build Images') {
sh 'make images'
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}"
}
2018-04-25 19:04:12 +01:00
}
catch (err) {
echo "Caught errors! ${err}"
echo "Setting build result to FAILURE"
2018-04-25 19:04:12 +01:00
currentBuild.result = "FAILURE"
slackSend color: 'bad', message: "${env.BRANCH_NAME} build failed ${env.BUILD_URL}"
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}"
2018-04-25 19:04:12 +01:00
throw err
}
finally {
stage('Cleanup') {
sh 'make clean-images'
deleteDir()
}
2018-04-25 19:04:12 +01:00
}
}