2021-05-06 15:14:58 +00:00
|
|
|
library 'status-jenkins-lib@v1.2.17'
|
|
|
|
|
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(
|
2021-03-04 17:08:34 +00:00
|
|
|
numToKeepStr: '5',
|
2019-03-25 10:35:38 +00:00
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2021-05-06 15:14:58 +00:00
|
|
|
TARGET = "docker"
|
2019-03-25 10:35:38 +00:00
|
|
|
GOPATH = "${env.WORKSPACE}"
|
2021-05-06 15:14:58 +00:00
|
|
|
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go"
|
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 {
|
2021-05-06 15:14:58 +00:00
|
|
|
stage('Prep') { steps { dir(env.STATUS_PATH) { script {
|
|
|
|
println("Version: ${utils.getVersion()}")
|
|
|
|
println("Git Branch: ${utils.branchName()}")
|
|
|
|
println("Git Commit: ${utils.gitCommit()}")
|
|
|
|
} } } }
|
2019-03-25 10:35:38 +00:00
|
|
|
|
|
|
|
stage('Build') { steps { dir(env.STATUS_PATH) { script {
|
|
|
|
sh 'make docker-image'
|
2021-05-06 15:14:58 +00:00
|
|
|
image = docker.image("${env.IMAGE_NAME}:v${utils.getVersion()}")
|
2019-03-25 10:35:38 +00:00
|
|
|
} } } }
|
|
|
|
|
|
|
|
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 {
|
2021-05-06 15:14:58 +00:00
|
|
|
success { script { github.notifyPR(true) } }
|
|
|
|
failure { script { github.notifyPR(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
|