From d2160e37016d91ea8b5fe4b2b249655a589b4b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 8 Nov 2018 11:13:40 +0100 Subject: [PATCH] upload a latest.json to the nightlies bucket MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- ci/Jenkinsfile.combined | 14 ++++++++------ ci/common.groovy | 12 ++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) 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 }