diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index c3f7ee8fbc..12a6699c1d 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -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': diff --git a/ci/common.groovy b/ci/common.groovy index bd132dfa1d..c64be1f81c 100644 --- a/ci/common.groovy +++ b/ci/common.groovy @@ -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 }