2019-03-25 10:35:38 +00:00
|
|
|
pipeline {
|
|
|
|
agent { label 'linux' }
|
|
|
|
|
|
|
|
parameters {
|
|
|
|
string(
|
|
|
|
name: 'BRANCH',
|
|
|
|
defaultValue: 'develop',
|
|
|
|
description: 'Name of branch to build.'
|
|
|
|
)
|
|
|
|
booleanParam(
|
|
|
|
name: 'RELEASE',
|
|
|
|
defaultValue: false,
|
|
|
|
description: 'Enable to create build for release.',
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
/* Go requires a certain directory structure */
|
|
|
|
checkoutToSubdirectory('src/github.com/status-im/status-go')
|
|
|
|
/* manage how many builds we keep */
|
|
|
|
buildDiscarder(logRotator(
|
2020-09-07 18:37:41 +00:00
|
|
|
numToKeepStr: '10',
|
2019-03-25 10:35:38 +00:00
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2019-04-12 10:50:14 +00:00
|
|
|
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go"
|
2019-03-25 10:35:38 +00:00
|
|
|
CI_DIR = "${env.STATUS_PATH}/_assets/ci"
|
|
|
|
GOPATH = "${env.WORKSPACE}"
|
2019-06-11 17:05:47 +00:00
|
|
|
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
|
2019-03-25 10:35:38 +00:00
|
|
|
/* docker image settings */
|
|
|
|
IMAGE_NAME = "statusteam/status-go"
|
|
|
|
IMAGE_TAG = "deploy-test"
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Prep') { steps { script {
|
|
|
|
lib = load("${env.STATUS_PATH}/_assets/ci/lib.groovy")
|
|
|
|
/* clarify what we're building */
|
|
|
|
println("Version: ${lib.getVersion()}")
|
|
|
|
println("Git Branch: ${lib.gitBranch()}")
|
|
|
|
println("Git Commit: ${lib.gitCommit()}")
|
|
|
|
/* save and create a dir for artifacts */
|
|
|
|
dest = "${env.WORKSPACE}/pkg"
|
|
|
|
sh "mkdir -p ${dest}"
|
|
|
|
} } }
|
|
|
|
|
|
|
|
stage('Build') { steps { dir(env.STATUS_PATH) { script {
|
|
|
|
sh 'make docker-image'
|
|
|
|
image = docker.image("${env.IMAGE_NAME}:${lib.getVersion()}")
|
|
|
|
} } } }
|
|
|
|
|
|
|
|
stage('Push') { steps { dir(env.STATUS_PATH) { script {
|
|
|
|
withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) {
|
|
|
|
image.push()
|
|
|
|
}
|
|
|
|
} } } }
|
|
|
|
|
|
|
|
stage('Deploy') {
|
|
|
|
when { expression { params.RELEASE == true } }
|
|
|
|
steps { dir(env.STATUS_PATH) { script {
|
|
|
|
withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) {
|
|
|
|
image.push(env.IMAGE_TAG)
|
|
|
|
}
|
|
|
|
} } } }
|
|
|
|
} // stages
|
|
|
|
post {
|
|
|
|
success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } }
|
|
|
|
failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } }
|
2019-07-29 17:28:31 +00:00
|
|
|
always { dir(env.STATUS_PATH) {
|
|
|
|
sh 'make clean-docker-images'
|
|
|
|
} }
|
2019-03-25 10:35:38 +00:00
|
|
|
} // post
|
|
|
|
} // pipeline
|