ci: fix release process broken by missing suffix

This fixes a type of CI failure:
https://ci.status.im/job/status-go/job/manual/1010
Which results in:
```
java.lang.NoSuchMethodError: No such DSL method 'suffix' found among steps ...
```
Also use release functions provided by `status-jenkins-lib`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-09-28 09:52:00 +02:00 committed by Jakub
parent 33e0611d64
commit bbafc704b1
7 changed files with 80 additions and 114 deletions

View File

@ -271,30 +271,6 @@ lint-fix:
-w {} \; -w {} \;
$(MAKE) vendor $(MAKE) vendor
check-existing-release:
@git ls-remote --exit-code origin "$(RELEASE_TAG)" >/dev/null || exit 0; \
echo "$(YELLOW)Release tag already exists: $(RELEASE_TAG)$(RESET)"; \
echo "Remove the tag/release if you want to re-create it."; \
exit 1;
release: check-existing-release
@read -p "Are you sure you want to create a new GitHub $(RELEASE_TYPE) against $(RELEASE_BRANCH) branch? (y/n): " REPLY; \
if [ $$REPLY = "y" ]; then \
latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1`); \
comparison="$$latest_tag..HEAD"; \
if [ -z "$$latest_tag" ]; then comparison=""; fi; \
changelog=$$(git log $$comparison --oneline --no-merges --format="* %h %s"); \
github-release \
$(shell if [ $(PRE_RELEASE) != "0" ] ; then echo "-prerelease" ; fi) \
"status-im/status-go" \
"$(RELEASE_TAG)" \
"$(RELEASE_BRANCH)" \
"$(changelog)" \
"$(RELEASE_DIR)/*" ; \
else \
echo "Aborting." && exit 1; \
fi
mock: ##@other Regenerate mocks mock: ##@other Regenerate mocks
mockgen -package=fake -destination=transactions/fake/mock.go -source=transactions/fake/txservice.go mockgen -package=fake -destination=transactions/fake/mock.go -source=transactions/fake/txservice.go
mockgen -package=status -destination=services/status/account_mock.go -source=services/status/service.go mockgen -package=status -destination=services/status/account_mock.go -source=services/status/service.go

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.2.16' library 'status-jenkins-lib@v1.3.3'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }
@ -28,9 +28,9 @@ pipeline {
} }
environment { environment {
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go" REPO = "${env.WORKSPACE}/src/github.com/status-im/status-go"
GOPATH = "${env.WORKSPACE}" GOPATH = "${env.WORKSPACE}"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin" PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
/* This will override the var in Makefile */ /* This will override the var in Makefile */
RELEASE_DIR = "${env.WORKSPACE}/pkg" RELEASE_DIR = "${env.WORKSPACE}/pkg"
} }
@ -71,32 +71,18 @@ pipeline {
stage('Release') { stage('Release') {
when { expression { params.RELEASE == true } } when { expression { params.RELEASE == true } }
steps { script { steps { script {
def suffix = "-"+utils.suffix() dir (env.REPO) { version = utils.getVersion() }
/* rename build files to not include versions */ github.publishReleaseFiles(
dir(env.RELEASE_DIR) { repo: 'status-go',
findFiles(glob: 'status-go-*').each { pkg -> version: version,
sh "mv ${pkg.path} ${pkg.path.replace(suffix, "")}" desc: ':warning: Fill me in!',
} )
}
/* perform the release */
dir(env.STATUS_PATH) {
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'status-im-auto',
usernameVariable: 'GITHUB_USER',
passwordVariable: 'GITHUB_TOKEN'
]]) {
env.RELEASE_BRANCH = utils.branchName()
env.RELEASE_DIR = env.RELEASE_DIR
sh 'yes | make release'
}
}
} } } }
} // stage(Release) } // stage(Release)
} // stages } // stages
post { post {
always { dir(env.STATUS_PATH) { always { dir(env.REPO) {
sh 'make clean-release' sh 'make clean-release'
} } } }
} }

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.2.17' library 'status-jenkins-lib@v1.3.3'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }
@ -32,11 +32,10 @@ pipeline {
/* fix for gomobile complaining about missing packages */ /* fix for gomobile complaining about missing packages */
CGO_ENABLED = "1" CGO_ENABLED = "1"
/* Other stuff */ /* Other stuff */
TARGET = 'android' TARGET = 'android'
GOPATH = "${env.WORKSPACE}" REPO = "${env.WORKSPACE}/src/github.com/status-im/status-go"
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go" GOPATH = "${env.WORKSPACE}"
ARTIFACT = "${env.WORKSPACE}/status-go-android-${utils.timestamp()}-${utils.gitCommit()}.aar" PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
/* Android SDK */ /* Android SDK */
ANDROID_HOME = '/usr/lib/android-sdk' ANDROID_HOME = '/usr/lib/android-sdk'
ANDROID_SDK_ROOT = '/usr/lib/android-sdk' ANDROID_SDK_ROOT = '/usr/lib/android-sdk'
@ -46,23 +45,26 @@ pipeline {
} }
stages { stages {
stage('Prep') { steps { dir(env.STATUS_PATH) { script { stage('Prep') { steps { dir(env.REPO) { script {
println("Version: ${utils.getVersion()}") env.ARTIFACT = "${env.WORKSPACE}/" + utils.pkgFilename(
println("Git Branch: ${utils.branchName()}") name: "status-go",
println("Git Commit: ${utils.gitCommit()}") type: "android",
ext: "aar"
)
println("Output: ${env.ARTIFACT}")
} } } } } } } }
stage('Setup') { steps { dir(env.STATUS_PATH) { stage('Setup') { steps { dir(env.REPO) {
sh 'make setup-build install-modvendor' sh 'make setup-build install-modvendor'
} } } } } }
stage('Vendoring check') { steps { dir(env.STATUS_PATH) { stage('Vendoring check') { steps { dir(env.REPO) {
/* fail build if vendoring hasn't been done */ /* fail build if vendoring hasn't been done */
sh 'make vendor' sh 'make vendor'
sh 'git diff --exit-code --no-color --stat vendor/' sh 'git diff --exit-code --no-color --stat vendor/'
} } } } } }
stage('Compile') { steps { dir(env.STATUS_PATH) { stage('Compile') { steps { dir(env.REPO) {
sh 'make statusgo-android' sh 'make statusgo-android'
sh "cp build/bin/statusgo.aar ${env.ARTIFACT}" sh "cp build/bin/statusgo.aar ${env.ARTIFACT}"
} } } } } }
@ -78,6 +80,6 @@ pipeline {
post { post {
success { script { github.notifyPR(true) } } success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } } failure { script { github.notifyPR(false) } }
always { dir(env.STATUS_PATH) { sh 'make clean' } } always { dir(env.REPO) { sh 'make clean' } }
} // post } // post
} // pipeline } // pipeline

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.2.17' library 'status-jenkins-lib@v1.3.3'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }
@ -29,28 +29,26 @@ pipeline {
} }
environment { environment {
TARGET = "docker" TARGET = "docker"
GOPATH = "${env.WORKSPACE}" REPO = "${env.WORKSPACE}/src/github.com/status-im/status-go"
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go" GOPATH = "${env.WORKSPACE}"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin" PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
/* docker image settings */ /* docker image settings */
IMAGE_NAME = "statusteam/status-go" IMAGE_NAME = "statusteam/status-go"
IMAGE_TAG = "deploy-test" IMAGE_TAG = "deploy-test"
} }
stages { stages {
stage('Prep') { steps { dir(env.STATUS_PATH) { script { stage('Prep') { steps { dir(env.REPO) { script {
println("Version: ${utils.getVersion()}") println("Output: ${env.IMAGE_NAME}:${env.IMAGE_TAG}")
println("Git Branch: ${utils.branchName()}")
println("Git Commit: ${utils.gitCommit()}")
} } } } } } } }
stage('Build') { steps { dir(env.STATUS_PATH) { script { stage('Build') { steps { dir(env.REPO) { script {
sh 'make docker-image' sh 'make docker-image'
image = docker.image("${env.IMAGE_NAME}:v${utils.getVersion()}") image = docker.image("${env.IMAGE_NAME}:v${utils.getVersion()}")
} } } } } } } }
stage('Push') { steps { dir(env.STATUS_PATH) { script { stage('Push') { steps { dir(env.REPO) { script {
withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) { withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) {
image.push() image.push()
} }
@ -58,7 +56,7 @@ pipeline {
stage('Deploy') { stage('Deploy') {
when { expression { params.RELEASE == true } } when { expression { params.RELEASE == true } }
steps { dir(env.STATUS_PATH) { script { steps { dir(env.REPO) { script {
withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) { withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) {
image.push(env.IMAGE_TAG) image.push(env.IMAGE_TAG)
} }
@ -67,7 +65,7 @@ pipeline {
post { post {
success { script { github.notifyPR(true) } } success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } } failure { script { github.notifyPR(false) } }
always { dir(env.STATUS_PATH) { always { dir(env.REPO) {
sh 'make clean-docker-images' sh 'make clean-docker-images'
} } } }
} // post } // post

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.2.17' library 'status-jenkins-lib@v1.3.3'
pipeline { pipeline {
agent { label 'macos' } agent { label 'macos' }
@ -32,25 +32,27 @@ pipeline {
/* fix for gomobile complaining about missing packages */ /* fix for gomobile complaining about missing packages */
CGO_ENABLED = "1" CGO_ENABLED = "1"
/* Other stuff */ /* Other stuff */
TARGET = 'ios' TARGET = 'ios'
GOPATH = "${env.WORKSPACE}" GOPATH = "${env.WORKSPACE}"
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go" REPO = "${env.WORKSPACE}/src/github.com/status-im/status-go"
ARTIFACT = "${env.WORKSPACE}/status-go-ios-${utils.timestamp()}-${utils.gitCommit()}.zip" PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
} }
stages { stages {
stage('Prep') { steps { dir(env.STATUS_PATH) { script { stage('Prep') { steps { dir(env.REPO) { script {
println("Version: ${utils.getVersion()}") env.ARTIFACT = "${env.WORKSPACE}/" + utils.pkgFilename(
println("Git Branch: ${utils.branchName()}") name: "status-go",
println("Git Commit: ${utils.gitCommit()}") type: "ios",
ext: "zip"
)
println("Output: ${env.ARTIFACT}")
} } } } } } } }
stage('Setup') { steps { dir(env.STATUS_PATH) { stage('Setup') { steps { dir(env.REPO) {
sh 'unset TMPDIR && make setup-build' sh 'unset TMPDIR && make setup-build'
} } } } } }
stage('Compile') { steps { dir(env.STATUS_PATH) { stage('Compile') { steps { dir(env.REPO) {
sh 'make statusgo-ios' sh 'make statusgo-ios'
sh 'go get golang.org/x/tools/go/packages' sh 'go get golang.org/x/tools/go/packages'
dir('build/bin') { dir('build/bin') {
@ -70,6 +72,6 @@ pipeline {
post { post {
success { script { github.notifyPR(true) } } success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } } failure { script { github.notifyPR(false) } }
always { dir(env.STATUS_PATH) { sh 'make clean' } } always { dir(env.REPO) { sh 'make clean' } }
} // post } // post
} // pipeline } // pipeline

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.2.17' library 'status-jenkins-lib@v1.3.3'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }
@ -29,30 +29,32 @@ pipeline {
} }
environment { environment {
TARGET = 'linux' TARGET = 'linux'
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go" REPO = "${env.WORKSPACE}/src/github.com/status-im/status-go"
GOPATH = "${env.WORKSPACE}" GOPATH = "${env.WORKSPACE}"
ARTIFACT = "${env.WORKSPACE}/status-go-desktop-${utils.timestamp()}-${utils.gitCommit()}.zip" PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
} }
stages { stages {
stage('Prep') { steps { dir(env.STATUS_PATH) { script { stage('Prep') { steps { dir(env.REPO) { script {
println("Version: ${utils.getVersion()}") env.ARTIFACT = "${env.WORKSPACE}/" + utils.pkgFilename(
println("Git Branch: ${utils.branchName()}") name: "status-go",
println("Git Commit: ${utils.gitCommit()}") type: "desktop",
ext: "zip"
)
println("Output: ${env.ARTIFACT}")
} } } } } } } }
stage('Setup') { steps { dir(env.STATUS_PATH) { stage('Setup') { steps { dir(env.REPO) {
sh 'make setup-build' sh 'make setup-build'
} } } } } }
/* Sanity-check C bindings */ /* Sanity-check C bindings */
stage('Sanity check bindings') { steps { dir(env.STATUS_PATH) { stage('Sanity check bindings') { steps { dir(env.REPO) {
sh 'make statusgo-library' sh 'make statusgo-library'
} } } } } }
stage('Compress') { steps { dir(env.STATUS_PATH) { stage('Compress') { steps { dir(env.REPO) {
sh "zip -q -r ${env.ARTIFACT} . -x *.git" sh "zip -q -r ${env.ARTIFACT} . -x *.git"
} } } } } }
@ -67,6 +69,6 @@ pipeline {
post { post {
success { script { github.notifyPR(true) } } success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } } failure { script { github.notifyPR(false) } }
always { dir(env.STATUS_PATH) { sh 'make clean' } } always { dir(env.REPO) { sh 'make clean' } }
} // post } // post
} // pipeline } // pipeline

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.2.17' library 'status-jenkins-lib@v1.3.3'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }
@ -24,38 +24,38 @@ pipeline {
} }
environment { environment {
TARGET = 'linux' TARGET = 'linux'
STATUS_PATH = 'src/github.com/status-im/status-go' GOPATH = "${env.WORKSPACE}"
GOPATH = "${env.WORKSPACE}" PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin" REPO = 'src/github.com/status-im/status-go'
} }
stages { stages {
stage('Prep') { steps { dir(env.STATUS_PATH) { script { stage('Prep') { steps { dir(env.REPO) { script {
println("Version: ${utils.getVersion()}") println("Version: ${utils.getVersion()}")
println("Git Branch: ${utils.branchName()}") println("Git Branch: ${utils.branchName()}")
println("Git Commit: ${utils.gitCommit()}") println("Git Commit: ${utils.gitCommit()}")
} } } } } } } }
stage('Setup') { steps { dir(env.STATUS_PATH) { stage('Setup') { steps { dir(env.REPO) {
sh 'make setup-build install-modvendor' sh 'make setup-build install-modvendor'
} } } } } }
stage('Vendoring check') { steps { dir(env.STATUS_PATH) { stage('Vendoring check') { steps { dir(env.REPO) {
/* fail build if vendoring hasn't been done */ /* fail build if vendoring hasn't been done */
sh 'make vendor' sh 'make vendor'
sh 'git diff --exit-code --no-color --stat vendor/' sh 'git diff --exit-code --no-color --stat vendor/'
} } } } } }
stage('Lint') { steps { dir(env.STATUS_PATH) { stage('Lint') { steps { dir(env.REPO) {
sh 'make lint' sh 'make lint'
} } } } } }
stage('Canary') { steps { dir(env.STATUS_PATH) { stage('Canary') { steps { dir(env.REPO) {
sh 'make canary-test' sh 'make canary-test'
} } } } } }
stage('Unit Tests') { steps { script { dir(env.STATUS_PATH) { stage('Unit Tests') { steps { script { dir(env.REPO) {
docker.image('postgres:9.6-alpine').withRun( docker.image('postgres:9.6-alpine').withRun(
'-e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432' '-e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432'
) { c -> ) { c ->