Add Jenkins-manual and fix artifacts versioning (#352)
This commit is contained in:
parent
283ae3e7df
commit
6d9f5d2e2a
|
@ -0,0 +1,96 @@
|
||||||
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
|
@NonCPS
|
||||||
|
def getVersion(branch, sha, buildNumber) {
|
||||||
|
version = branch.replaceAll(/\//, '-')
|
||||||
|
|
||||||
|
if (sha?.trim()) {
|
||||||
|
version = version + '-' + sha
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildNumber?.trim()) {
|
||||||
|
version = version + '-' + buildNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
|
node('linux') {
|
||||||
|
paramBranch = env.branch ? ('*/' + env.branch) : '*/develop'
|
||||||
|
|
||||||
|
checkout(
|
||||||
|
changelog: false,
|
||||||
|
poll: false,
|
||||||
|
scm: [$class: 'GitSCM', branches: [[name: paramBranch]],
|
||||||
|
doGenerateSubmoduleConfigurations: false,
|
||||||
|
extensions: [],
|
||||||
|
submoduleCfg: [],
|
||||||
|
userRemoteConfigs: [[url: 'https://github.com/status-im/status-go']]]
|
||||||
|
)
|
||||||
|
|
||||||
|
def remoteOriginRegex = ~/^remotes\/origin\//
|
||||||
|
|
||||||
|
gitSHA = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
|
||||||
|
gitShortSHA = gitSHA.take(7)
|
||||||
|
gitBranch = sh(returnStdout: true, script: 'git name-rev --name-only HEAD').trim() - remoteOriginRegex
|
||||||
|
|
||||||
|
stage('Debug') {
|
||||||
|
sh 'env'
|
||||||
|
println(gitBranch)
|
||||||
|
println(gitSHA)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(adam): enable when unit tests start passing
|
||||||
|
// stage('Test') {
|
||||||
|
// sh 'make ci'
|
||||||
|
// }
|
||||||
|
|
||||||
|
stage('Build') {
|
||||||
|
sh 'go get github.com/karalabe/xgo'
|
||||||
|
|
||||||
|
parallel (
|
||||||
|
'statusgo-android': {
|
||||||
|
if (env.platform == 'android') {
|
||||||
|
sh 'make statusgo-android'
|
||||||
|
} else {
|
||||||
|
print 'Skipping Android'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'statusgo-ios-simulator': {
|
||||||
|
if (env.platform == 'ios-simulator') {
|
||||||
|
sh '''
|
||||||
|
make statusgo-ios-simulator
|
||||||
|
cd build/bin/statusgo-ios-9.3-framework/
|
||||||
|
zip -r status-go-ios.zip Statusgo.framework
|
||||||
|
'''
|
||||||
|
} else {
|
||||||
|
print 'Skipping ios-simulator'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy') {
|
||||||
|
// For branch builds, replace the old artifact. For develop keep all of them.
|
||||||
|
def version = gitBranch == 'develop' ? getVersion(gitBranch, gitShortSHA, '') : getVersion(gitBranch, gitShortSHA, env.BUILD_ID)
|
||||||
|
def server = Artifactory.server 'artifactory'
|
||||||
|
def uploadSpec = """{
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"pattern": "build/bin/statusgo-android-16.aar",
|
||||||
|
"target": "libs-release-local/status-im/status-go/${version}/status-go-${version}.aar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pattern": "build/bin/statusgo-ios-9.3-framework/status-go-ios.zip",
|
||||||
|
"target": "libs-release-local/status-im/status-go-ios-simulator/${version}/status-go-ios-simulator-${version}.zip"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}"""
|
||||||
|
|
||||||
|
def buildInfo = Artifactory.newBuildInfo()
|
||||||
|
buildInfo.env.capture = false
|
||||||
|
buildInfo.name = 'status-go (' + gitBranch + '-' + gitShortSHA + ')'
|
||||||
|
server.upload(uploadSpec, buildInfo)
|
||||||
|
server.publishBuildInfo(buildInfo)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,18 @@
|
||||||
#!/usr/bin/env groovy
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
@NonCPS
|
@NonCPS
|
||||||
def getVersion(branch, sha) {
|
def getVersion(branch, sha, buildNumber) {
|
||||||
|
version = branch.replaceAll(/\//, '-')
|
||||||
|
|
||||||
if (sha?.trim()) {
|
if (sha?.trim()) {
|
||||||
return branch.replaceAll(/\//, '-') + '-' + sha
|
version = version + '-' + sha
|
||||||
}
|
}
|
||||||
|
|
||||||
return branch.replaceAll(/\//, '-')
|
if (buildNumber?.trim()) {
|
||||||
|
version = version + '-' + buildNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
return version
|
||||||
}
|
}
|
||||||
|
|
||||||
node('linux') {
|
node('linux') {
|
||||||
|
@ -30,6 +36,8 @@ node('linux') {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
|
sh 'go get github.com/karalabe/xgo'
|
||||||
|
|
||||||
parallel (
|
parallel (
|
||||||
'statusgo-android': {
|
'statusgo-android': {
|
||||||
sh 'make statusgo-android'
|
sh 'make statusgo-android'
|
||||||
|
@ -46,7 +54,7 @@ node('linux') {
|
||||||
|
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
// For branch builds, replace the old artifact. For develop keep all of them.
|
// For branch builds, replace the old artifact. For develop keep all of them.
|
||||||
def version = gitBranch == 'develop' ? getVersion(gitBranch, gitShortSHA) : getVersion(gitBranch, '')
|
def version = gitBranch == 'develop' ? getVersion(gitBranch, gitShortSHA, '') : getVersion(gitBranch, gitShortSHA, env.BUILD_ID)
|
||||||
def server = Artifactory.server 'artifactory'
|
def server = Artifactory.server 'artifactory'
|
||||||
def uploadSpec = """{
|
def uploadSpec = """{
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -63,7 +71,7 @@ node('linux') {
|
||||||
|
|
||||||
def buildInfo = Artifactory.newBuildInfo()
|
def buildInfo = Artifactory.newBuildInfo()
|
||||||
buildInfo.env.capture = false
|
buildInfo.env.capture = false
|
||||||
buildInfo.name = 'status-go'
|
buildInfo.name = 'status-go (' + gitBranch + '-' + gitShortSHA + ')'
|
||||||
server.upload(uploadSpec, buildInfo)
|
server.upload(uploadSpec, buildInfo)
|
||||||
server.publishBuildInfo(buildInfo)
|
server.publishBuildInfo(buildInfo)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue