upload a latest.json to the nightlies bucket

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2018-11-08 11:13:40 +01:00
parent 014d564e72
commit d2160e3701
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
2 changed files with 20 additions and 6 deletions

View File

@ -80,12 +80,14 @@ pipeline {
ipaUrl = ios.getBuildVariables().get('DIAWI_URL')
/* add URLs to the build description */
cmn.setBuildDesc(
Apk: apkUrl,
e2e: e2eUrl,
iOS: ipaUrl,
App: appUrl,
Mac: dmgUrl
Apk: apkUrl, e2e: e2eUrl, iOS: ipaUrl, App: appUrl, Mac: dmgUrl,
)
/* Create latest.json with newest nightly URLs */
if (btype == 'nightly') {
cmn.updateLatestNightlies(
APK: apkUrl, IOS: ipaUrl, APP: appUrl, MAC: dmgUrl
)
}
} }
}
stage('Notify') {
@ -108,7 +110,7 @@ pipeline {
[name: 'APK_URL', value: apkUrl, $class: 'StringParameterValue'],
[name: 'IOS_URL', value: ipaUrl, $class: 'StringParameterValue'],
[name: 'DMG_URL', value: dmgUrl, $class: 'StringParameterValue'],
[name: 'NIX_URL', value: appUrl, $class: 'StringParameterValue']
[name: 'NIX_URL', value: appUrl, $class: 'StringParameterValue'],
]
); break
case 'release':

View File

@ -1,3 +1,5 @@
import groovy.json.JsonBuilder
def version() {
return readFile("${env.WORKSPACE}/VERSION").trim()
}
@ -181,6 +183,16 @@ def setBuildDesc(Map links) {
currentBuild.description = desc
}
def updateLatestNightlies(Map links) {
def latestFile = pwd() + '/' + 'pkg/latest.json'
/* it might not exist */
sh 'mkdir -p pkg'
def latestJson = new JsonBuilder(links).toPrettyString()
println("latest.json:\n${latestJson}")
new File(latestFile).write(latestJson)
return uploadArtifact(latestFile)
}
def getParentRunEnv(name) {
def c = currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause)
if (c == null) { return null }