2018-02-06 10:18:31 +00:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
2018-03-06 13:42:16 +00:00
|
|
|
node('linux') {
|
2018-02-06 10:18:31 +00:00
|
|
|
checkout scm
|
|
|
|
|
|
|
|
def dockerreponame = "statusim/openbounty-app"
|
|
|
|
|
|
|
|
try {
|
|
|
|
stage('Build & push') {
|
|
|
|
|
|
|
|
GIT_COMMIT_HASH = sh (script: "git rev-parse --short HEAD | tr -d '\n'", returnStdout: true)
|
|
|
|
|
|
|
|
docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-statusvan') {
|
|
|
|
def openbountyApp = docker.build("${dockerreponame}:${env.BUILD_NUMBER}")
|
|
|
|
openbountyApp.push("${env.BRANCH_NAME}")
|
|
|
|
if (env.BRANCH_NAME == 'develop') {
|
2018-02-06 10:29:17 +00:00
|
|
|
openbountyApp.push("develop")
|
2018-02-06 10:18:31 +00:00
|
|
|
} else if (env.BRANCH_NAME == 'master') {
|
2018-02-06 10:29:17 +00:00
|
|
|
openbountyApp.push("master")
|
2018-02-06 10:18:31 +00:00
|
|
|
} else {
|
|
|
|
println "Not named branch have no custom tag"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-02-15 17:31:55 +00:00
|
|
|
stage('Deploy') {
|
|
|
|
if ( currentBuild.rawBuild.getCauses()[0].toString().contains('UserIdCause') ){
|
|
|
|
build job: 'status-openbounty/openbounty-cluster', parameters: [[$class: 'StringParameterValue', name: 'DEPLOY_ENVIRONMENT', value: "dev"], [$class: 'StringParameterValue', name: 'BRANCH', value: env.BRANCH_NAME]]
|
|
|
|
} else {
|
|
|
|
echo "No deployment on automatic trigger, go to Jenkins and push build button to deliver it."
|
|
|
|
}
|
|
|
|
}
|
2018-04-18 09:07:30 +00:00
|
|
|
stage('Tetisng') {
|
|
|
|
if ( currentBuild.rawBuild.getCauses()[0].toString().contains('UserIdCause') ){
|
|
|
|
build job: 'nd-to-end-tests/job/sob-end-to-end-tests'
|
|
|
|
} else {
|
|
|
|
echo "No testing on automatic trigger, go to Jenkins and push build button to deliver it and test it."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-15 17:31:55 +00:00
|
|
|
|
2018-02-06 10:18:31 +00:00
|
|
|
} catch (e) {
|
|
|
|
// slackSend color: 'bad', message: REPO + ":" + BRANCH_NAME + ' failed to build. ' + env.BUILD_URL
|
|
|
|
throw e
|
|
|
|
}
|
2018-03-06 13:34:43 +00:00
|
|
|
}
|