library 'status-jenkins-lib@v1.7.0' 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( numToKeepStr: '5', daysToKeepStr: '30', )) } environment { 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" /* Makefile parameters */ DOCKER_IMAGE_NAME = 'statusteam/status-go' DOCKER_IMAGE_CUSTOM_TAG = "ci-build-${utils.gitCommit()}" /* Release docker image settings. */ RELEASE_IMAGE_TAG = "deploy-test" } stages { stage('Prep') { steps { dir(env.REPO) { script { println("Output: ${env.DOCKER_IMAGE_NAME}:${env.RELEASE_IMAGE_TAG}") } } } } stage('Build') { steps { dir(env.REPO) { script { sh 'make docker-image' image = docker.image("${env.DOCKER_IMAGE_NAME}:${env.DOCKER_IMAGE_CUSTOM_TAG}") } } } } stage('Push') { steps { dir(env.REPO) { script { withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) { image.push("v${utils.getVersion()}-${utils.gitCommit()}") } } } } } stage('Deploy') { when { expression { params.RELEASE == true } } steps { dir(env.REPO) { script { withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) { image.push(env.RELEASE_IMAGE_TAG) } } } } } } // stages post { success { script { github.notifyPR(true) } } failure { script { github.notifyPR(false) } } always { dir(env.REPO) { sh 'make clean-docker-images' } } } // post } // pipeline