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 */ /* mobile */
Apk: cmn.pkgUrl(apk), Apke2e: cmn.pkgUrl(apke2e), Apk: cmn.pkgUrl(apk), Apke2e: cmn.pkgUrl(apke2e),
iOS: cmn.pkgUrl(ios), /*iOSe2e: cmn.pkgUrl(iose2e),*/ iOS: cmn.pkgUrl(ios), /*iOSe2e: cmn.pkgUrl(iose2e),*/
Diawi: getEnv(ios, 'DIAWI_URL'),
/* desktop */ /* desktop */
App: cmn.pkgUrl(nix), Mac: cmn.pkgUrl(osx), Win: cmn.pkgUrl(win), App: cmn.pkgUrl(nix), Mac: cmn.pkgUrl(osx), Win: cmn.pkgUrl(win),
/* upload the sha256 checksums file too */ /* upload the sha256 checksums file too */
@ -83,17 +84,14 @@ pipeline {
] ]
/* add URLs to the build description */ /* add URLs to the build description */
cmn.setBuildDesc(urls) cmn.setBuildDesc(urls)
/* Create latest.json with newest nightly URLs */ /* Create JSON file with newest build URLs */
if (btype == 'nightly') { switch (btype) {
cmn.updateLatestNightlies(urls) /* 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') { stage('Publish') {
when { expression { btype == 'nightly' } } when { expression { btype == 'nightly' } }
steps { script { steps { script {

View File

@ -78,12 +78,12 @@ pipeline {
when { expression { cmn.getBuildType() != 'release' } } when { expression { cmn.getBuildType() != 'release' } }
steps { steps {
script { script {
env.PKG_URL = cmn.uploadArtifact(api)
/* e2e builds get tested in SauceLabs */ /* e2e builds get tested in SauceLabs */
if (cmn.getBuildType() == 'e2e') { if (cmn.getBuildType() == 'e2e') {
env.SAUCE_URL = mobile.ios.uploadToSauceLabs() env.SAUCE_URL = mobile.ios.uploadToSauceLabs()
env.PKG_URL = cmn.uploadArtifact(api)
} else { } 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 gitHubNotifyPRFailure() {
def d = ":small_orange_diamond:" def d = ":small_orange_diamond:"
def msg = "#### :x: " def msg = "#### :x: "
@ -343,20 +327,21 @@ def setBuildDesc(Map links) {
currentBuild.description = desc currentBuild.description = desc
} }
def updateLatestNightlies(urls) { def updateBucketJSON(urls, fileName) {
/* latest.json has slightly different key names */ /* latest.json has slightly different key names */
def latest = [ def content = [
DIAWI: urls.Diawi,
APK: urls.Apk, IOS: urls.iOS, APK: urls.Apk, IOS: urls.iOS,
APP: urls.App, MAC: urls.Mac, APP: urls.App, MAC: urls.Mac,
WIN: urls.Win, SHA: urls.SHA WIN: urls.Win, SHA: urls.SHA
] ]
def latestFile = pwd() + '/' + 'pkg/latest.json' def filePath = "${pwd()}/pkg/${fileName}"
/* it might not exist */ /* it might not exist */
sh 'mkdir -p pkg' sh 'mkdir -p pkg'
def latestJson = new JsonBuilder(latest).toPrettyString() def contentJson = new JsonBuilder(content).toPrettyString()
println "latest.json:\n${latestJson}" println "${fileName}:\n${contentJson}"
new File(latestFile).write(latestJson) new File(filePath).write(contentJson)
return uploadArtifact(latestFile) return uploadArtifact(filePath)
} }
def getParentRunEnv(name) { def getParentRunEnv(name) {