2018-04-25 19:04:12 +01:00
|
|
|
node('node') {
|
2018-12-17 20:33:59 +00:00
|
|
|
properties([disableConcurrentBuilds()])
|
2018-04-25 19:04:12 +01:00
|
|
|
try {
|
2018-08-22 14:18:50 +01:00
|
|
|
currentBuild.result = "SUCCESS"
|
2018-04-25 19:04:12 +01:00
|
|
|
|
2018-07-13 16:02:33 +01:00
|
|
|
stage('Checkout') {
|
2018-08-22 14:18:50 +01:00
|
|
|
checkout scm
|
|
|
|
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
2018-07-13 16:02:33 +01:00
|
|
|
}
|
2018-04-25 19:04:12 +01:00
|
|
|
|
2019-05-03 19:14:38 +01:00
|
|
|
stage('Build Binaries') {
|
|
|
|
sh 'make binaries'
|
2018-08-22 14:18:50 +01:00
|
|
|
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
2018-07-13 16:02:33 +01:00
|
|
|
}
|
2018-04-25 19:04:12 +01:00
|
|
|
|
2019-05-03 19:14:38 +01:00
|
|
|
stage('Build Images') {
|
|
|
|
sh 'make images'
|
2018-08-31 16:21:44 +01:00
|
|
|
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
|
|
|
}
|
|
|
|
|
2018-08-14 16:00:39 +01:00
|
|
|
stage('Push Images') {
|
2018-09-18 14:46:04 +01:00
|
|
|
echo 'Push to Repo'
|
|
|
|
sh 'make push-images'
|
2018-08-22 14:18:50 +01:00
|
|
|
echo "Current build result: ${currentBuild.result}"
|
2018-08-14 16:00:39 +01:00
|
|
|
}
|
|
|
|
|
2018-08-23 22:04:51 +01:00
|
|
|
if (env.BRANCH_NAME == "master") {
|
2018-08-14 16:00:39 +01:00
|
|
|
/* This should only deploy to staging if the branch is master */
|
2018-09-18 14:46:04 +01:00
|
|
|
stage('Deploy to staging') {
|
2018-08-23 22:04:51 +01:00
|
|
|
sh 'make deploy'
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
2018-07-13 16:02:33 +01:00
|
|
|
}
|
|
|
|
}
|
2018-09-18 14:46:04 +01:00
|
|
|
stage('Upload') {
|
|
|
|
sh 'make binaries-upload'
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
|
|
|
}
|
2018-04-25 19:04:12 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
catch (err) {
|
2018-08-22 14:18:50 +01:00
|
|
|
echo "Caught errors! ${err}"
|
|
|
|
echo "Setting build result to FAILURE"
|
2018-04-25 19:04:12 +01:00
|
|
|
currentBuild.result = "FAILURE"
|
|
|
|
|
2019-08-29 16:35:02 +01:00
|
|
|
slackSend color: 'bad', message: "${env.BRANCH_NAME} build failed ${env.BUILD_URL}"
|
|
|
|
|
2018-09-18 14:46:04 +01:00
|
|
|
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
|
2018-07-13 16:02:33 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
finally {
|
|
|
|
|
|
|
|
stage('Cleanup') {
|
2018-09-13 17:55:14 +01:00
|
|
|
sh 'make clean-images'
|
2018-07-13 16:02:33 +01:00
|
|
|
deleteDir()
|
|
|
|
}
|
|
|
|
|
2018-04-25 19:04:12 +01:00
|
|
|
}
|
|
|
|
}
|