2022-12-02 18:03:35 +00:00
|
|
|
library 'status-jenkins-lib@v1.6.4'
|
2021-05-06 15:14:58 +00:00
|
|
|
|
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-09-28 07:52:00 +00:00
|
|
|
TARGET = "docker"
|
|
|
|
REPO = "${env.WORKSPACE}/src/github.com/status-im/status-go"
|
|
|
|
GOPATH = "${env.WORKSPACE}"
|
|
|
|
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-09-28 07:52:00 +00:00
|
|
|
stage('Prep') { steps { dir(env.REPO) { script {
|
|
|
|
println("Output: ${env.IMAGE_NAME}:${env.IMAGE_TAG}")
|
2021-05-06 15:14:58 +00:00
|
|
|
} } } }
|
2019-03-25 10:35:38 +00:00
|
|
|
|
2021-09-28 07:52:00 +00:00
|
|
|
stage('Build') { steps { dir(env.REPO) { script {
|
2019-03-25 10:35:38 +00:00
|
|
|
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
|
|
|
} } } }
|
|
|
|
|
2021-09-28 07:52:00 +00:00
|
|
|
stage('Push') { steps { dir(env.REPO) { script {
|
2019-03-25 10:35:38 +00:00
|
|
|
withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) {
|
|
|
|
image.push()
|
|
|
|
}
|
|
|
|
} } } }
|
|
|
|
|
|
|
|
stage('Deploy') {
|
|
|
|
when { expression { params.RELEASE == true } }
|
2021-09-28 07:52:00 +00:00
|
|
|
steps { dir(env.REPO) { script {
|
2019-03-25 10:35:38 +00:00
|
|
|
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) } }
|
2021-09-28 07:52:00 +00:00
|
|
|
always { dir(env.REPO) {
|
2019-07-29 17:28:31 +00:00
|
|
|
sh 'make clean-docker-images'
|
|
|
|
} }
|
2019-03-25 10:35:38 +00:00
|
|
|
} // post
|
|
|
|
} // pipeline
|