upload release.json for release builds

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-02-22 21:35:22 +01:00
parent 7e9565c7e3
commit f67ee8db56
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
3 changed files with 16 additions and 33 deletions

View File

@ -76,6 +76,7 @@ pipeline {
/* mobile */
Apk: cmn.pkgUrl(apk), Apke2e: cmn.pkgUrl(apke2e),
iOS: cmn.pkgUrl(ios), /*iOSe2e: cmn.pkgUrl(iose2e),*/
Diawi: getEnv(ios, 'DIAWI_URL'),
/* desktop */
App: cmn.pkgUrl(nix), Mac: cmn.pkgUrl(osx), Win: cmn.pkgUrl(win),
/* upload the sha256 checksums file too */
@ -83,17 +84,14 @@ pipeline {
]
/* add URLs to the build description */
cmn.setBuildDesc(urls)
/* Create latest.json with newest nightly URLs */
if (btype == 'nightly') {
cmn.updateLatestNightlies(urls)
/* Create JSON file with newest build URLs */
switch (btype) {
/* legacy naming, should have named it nightly.json */
case 'nightly': cmn.updateBucketJSON(urls, 'latest.json'); break
case 'release': cmn.updateBucketJSON(urls, 'release.json'); break
}
} }
}
stage('Notify') { when { expression { env.CHANGE_ID != null } }
steps { script {
cmn.gitHubNotifyFull(urls)
} }
}
stage('Publish') {
when { expression { btype == 'nightly' } }
steps { script {

View File

@ -78,12 +78,12 @@ pipeline {
when { expression { cmn.getBuildType() != 'release' } }
steps {
script {
env.PKG_URL = cmn.uploadArtifact(api)
/* e2e builds get tested in SauceLabs */
if (cmn.getBuildType() == 'e2e') {
env.SAUCE_URL = mobile.ios.uploadToSauceLabs()
env.PKG_URL = cmn.uploadArtifact(api)
} else {
env.PKG_URL = mobile.ios.uploadToDiawi()
env.DIAWI_URL = mobile.ios.uploadToDiawi()
}
}
}

View File

@ -258,22 +258,6 @@ def gitHubNotify(message) {
}
}
def gitHubNotifyFull(urls) {
def msg = "#### :white_check_mark: "
msg += "[${env.JOB_NAME}${currentBuild.displayName}](${currentBuild.absoluteUrl}) "
msg += "CI BUILD SUCCESSFUL in ${buildDuration()} (${GIT_COMMIT.take(8)})\n"
msg += '| | | | | |\n'
msg += '|-|-|-|-|-|\n'
msg += "| [Android](${urls.Apk}) ([e2e](${urls.Apke2e})) "
msg += "| [iOS](${urls.iOS}) ([e2e](${urls.iOSe2e})) |"
if (urls.Mac != null) {
msg += " [MacOS](${urls.Mac}) | [AppImage](${urls.App}) | [Windows](${urls.Win}) |"
} else {
msg += " ~~MacOS~~ | ~~AppImage~~ | ~~Windows~~~ |"
}
gitHubNotify(msg)
}
def gitHubNotifyPRFailure() {
def d = ":small_orange_diamond:"
def msg = "#### :x: "
@ -343,20 +327,21 @@ def setBuildDesc(Map links) {
currentBuild.description = desc
}
def updateLatestNightlies(urls) {
def updateBucketJSON(urls, fileName) {
/* latest.json has slightly different key names */
def latest = [
def content = [
DIAWI: urls.Diawi,
APK: urls.Apk, IOS: urls.iOS,
APP: urls.App, MAC: urls.Mac,
WIN: urls.Win, SHA: urls.SHA
]
def latestFile = pwd() + '/' + 'pkg/latest.json'
def filePath = "${pwd()}/pkg/${fileName}"
/* it might not exist */
sh 'mkdir -p pkg'
def latestJson = new JsonBuilder(latest).toPrettyString()
println "latest.json:\n${latestJson}"
new File(latestFile).write(latestJson)
return uploadArtifact(latestFile)
def contentJson = new JsonBuilder(content).toPrettyString()
println "${fileName}:\n${contentJson}"
new File(filePath).write(contentJson)
return uploadArtifact(filePath)
}
def getParentRunEnv(name) {