upload PR build artifacts to a separate bucket, also update desc
also splify syntax with helper methods and variables Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
4f9b2d91ea
commit
27667dd949
|
@ -17,7 +17,8 @@ pipeline {
|
|||
println "Current JOB: ${env.JOB_NAME}"
|
||||
/* load common lib */
|
||||
cmn = load('ci/common.groovy')
|
||||
|
||||
/* just for a shorter access */
|
||||
btype = cmn.getBuildType()
|
||||
/* to avoid missing build tag parallel builds */
|
||||
print "Build Number: ${cmn.tagBuild(true)}"
|
||||
} }
|
||||
|
@ -25,20 +26,20 @@ pipeline {
|
|||
stage('Build') {
|
||||
parallel {
|
||||
stage('MacOS') {
|
||||
when { expression { cmn.getBuildType() != 'release' } }
|
||||
when { expression { btype != 'release' } }
|
||||
steps { script {
|
||||
osx = cmn.buildBranch('status-react/combined/desktop-macos', cmn.getBuildType())
|
||||
osx = cmn.buildBranch('status-react/combined/desktop-macos')
|
||||
} } }
|
||||
stage('Linux') {
|
||||
when { expression { cmn.getBuildType() != 'release' } }
|
||||
when { expression { btype != 'release' } }
|
||||
steps { script {
|
||||
nix = cmn.buildBranch('status-react/combined/desktop-linux', cmn.getBuildType())
|
||||
nix = cmn.buildBranch('status-react/combined/desktop-linux')
|
||||
} } }
|
||||
stage('iOS') { steps { script {
|
||||
ios = cmn.buildBranch('status-react/combined/mobile-ios', cmn.getBuildType())
|
||||
ios = cmn.buildBranch('status-react/combined/mobile-ios')
|
||||
} } }
|
||||
stage('Android') { steps { script {
|
||||
dro = cmn.buildBranch('status-react/combined/mobile-android', cmn.getBuildType())
|
||||
dro = cmn.buildBranch('status-react/combined/mobile-android')
|
||||
} } }
|
||||
stage('Android e2e') { steps { script {
|
||||
e2e = cmn.buildBranch('status-react/combined/mobile-android', 'e2e')
|
||||
|
@ -49,29 +50,38 @@ pipeline {
|
|||
steps { script {
|
||||
sh('rm -f pkg/*')
|
||||
|
||||
if (cmn.getBuildType() != 'release') {
|
||||
if (btype != 'release') {
|
||||
cmn.copyArts('status-react/combined/desktop-macos', osx.number)
|
||||
cmn.copyArts('status-react/combined/desktop-linux', nix.number)
|
||||
}
|
||||
cmn.copyArts('status-react/combined/mobile-android', dro.number)
|
||||
cmn.copyArts('status-react/combined/mobile-android', e2e.number)
|
||||
cmn.copyArts('status-react/combined/mobile-ios', ios.number)
|
||||
archiveArtifacts('pkg/*')
|
||||
} }
|
||||
}
|
||||
stage('Upload') {
|
||||
steps { script {
|
||||
e2eUrl = cmn.uploadArtifact(findFiles(glob: 'pkg/*e2e.apk')[0].path)
|
||||
apkUrl = cmn.uploadArtifact(findFiles(glob: "pkg/*${cmn.getBuildType()}.apk")[0].path)
|
||||
e2eUrl = cmn.uploadArtifact(cmn.pkgFind('e2e.apk'))
|
||||
apkUrl = cmn.uploadArtifact(cmn.pkgFind("${btype}.apk"))
|
||||
|
||||
if (cmn.getBuildType() != 'release') {
|
||||
dmgUrl = cmn.uploadArtifact(findFiles(glob: 'pkg/*.dmg')[0].path)
|
||||
appUrl = cmn.uploadArtifact(findFiles(glob: 'pkg/*.AppImage')[0].path)
|
||||
if (btype != 'release') {
|
||||
dmgUrl = cmn.uploadArtifact(cmn.pkgFind('dmg'))
|
||||
appUrl = cmn.uploadArtifact(cmn.pkgFind('AppImage'))
|
||||
} else {
|
||||
dmgUrl = null
|
||||
appUrl = null
|
||||
}
|
||||
/* special case for iOS Diawi links */
|
||||
ipaUrl = ios.getBuildVariables().get('DIAWI_URL')
|
||||
/* add URLs to the build description */
|
||||
cmn.setBuildDesc(
|
||||
Apk: apkUrl,
|
||||
e2e: e2eUrl,
|
||||
iOS: ipaUrl,
|
||||
App: appUrl,
|
||||
Mac: dmgUrl
|
||||
)
|
||||
} }
|
||||
}
|
||||
stage('Notify') {
|
||||
|
@ -81,7 +91,7 @@ pipeline {
|
|||
def message = (
|
||||
(env.CHANGE_ID != null ?
|
||||
"Build PR #${BRANCH_NAME}(${CHANGE_BRANCH}) success! " :
|
||||
"Build ${cmn.getBuildType()} success! "
|
||||
"Build ${btype} success! "
|
||||
)+
|
||||
"<${currentBuild.absoluteUrl}|${currentBuild.displayName}> "+
|
||||
"(${currentBuild.durationString})\n"+
|
||||
|
@ -110,7 +120,7 @@ pipeline {
|
|||
}
|
||||
stage('Publish') {
|
||||
steps { script {
|
||||
switch (cmn.getBuildType()) {
|
||||
switch (btype) {
|
||||
case 'nightly':
|
||||
build(
|
||||
job: 'misc/status-im.github.io-update_env',
|
||||
|
@ -132,7 +142,7 @@ pipeline {
|
|||
} }
|
||||
}
|
||||
stage('Run e2e') {
|
||||
when { expression { cmn.getBuildType() == 'nightly' } }
|
||||
when { expression { btype == 'nightly' } }
|
||||
steps { script {
|
||||
e2eApk = e2e.getBuildVariables().get('SAUCE_URL')
|
||||
build(
|
||||
|
|
|
@ -16,7 +16,9 @@ def getBuildType() {
|
|||
return params.BUILD_TYPE
|
||||
}
|
||||
|
||||
def buildBranch(name = null, buildType) {
|
||||
def buildBranch(name = null, buildType = null) {
|
||||
/* default to current build type */
|
||||
buildType = buildType ? buildType : getBuildType()
|
||||
/* need to drop origin/ to match definitions of child jobs */
|
||||
def branchName = env.GIT_BRANCH.replace('origin/', '')
|
||||
/* always pass the BRANCH and BUILD_TYPE params with current branch */
|
||||
|
@ -95,6 +97,10 @@ def uploadArtifact(path) {
|
|||
/* defaults for upload */
|
||||
def domain = 'ams3.digitaloceanspaces.com'
|
||||
def bucket = 'status-im'
|
||||
/* There's so many PR builds we need a separate bucket */
|
||||
if (getBuildType() == 'pr') {
|
||||
bucket = 'status-im-prs'
|
||||
}
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'digital-ocean-access-keys',
|
||||
usernameVariable: 'DO_ACCESS_KEY',
|
||||
|
@ -154,6 +160,20 @@ def githubNotify(apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, changeId) {
|
|||
}
|
||||
}
|
||||
|
||||
def pkgFind(glob) {
|
||||
return findFiles(glob: "pkg/*${glob}")[0].path
|
||||
}
|
||||
|
||||
def setBuildDesc(Map links) {
|
||||
def desc = 'Links: \n'
|
||||
links.each { type, url ->
|
||||
if (url != null) {
|
||||
desc += "<a href=\"${url}\">${type}</a> \n"
|
||||
}
|
||||
}
|
||||
currentBuild.description = desc
|
||||
}
|
||||
|
||||
def getParentRunEnv(name) {
|
||||
def c = currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause)
|
||||
if (c == null) { return null }
|
||||
|
|
Loading…
Reference in New Issue