From c825ff285ae50fc4d192061abe7e7cda42dc3b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 13 Nov 2018 19:35:17 +0100 Subject: [PATCH] use a table to post links to build artifacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- Makefile | 4 ++-- ci/Jenkinsfile.combined | 12 ++++------ ci/Jenkinsfile.fastlane.clean | 36 +++++++++++++++++------------ ci/common.groovy | 43 ++++++++++++++++------------------- 4 files changed, 49 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index cda6f7cafe..7bbd09c18c 100644 --- a/Makefile +++ b/Makefile @@ -51,11 +51,11 @@ _prepare-mobile: ##@prepare Install mobile platform dependencies and prepare wor npm install $(STATUS_GO_IOS_ARCH): - cd $(RCTSTATUS_DIR) && curl -OL "$(GITHUB_URL)/$(STATUS_GO_VER)/status-go-ios.zip" + cd $(RCTSTATUS_DIR) && curl -s -OL "$(GITHUB_URL)/$(STATUS_GO_VER)/status-go-ios.zip" $(STATUS_GO_DRO_ARCH): mkdir -p $(ANDROID_LIBS_DIR) - cd $(ANDROID_LIBS_DIR) && curl -o status-go-$(STATUS_GO_VER).aar -OL "$(GITHUB_URL)/$(STATUS_GO_VER)/status-go-android.aar" + cd $(ANDROID_LIBS_DIR) && curl -s -o status-go-$(STATUS_GO_VER).aar -OL "$(GITHUB_URL)/$(STATUS_GO_VER)/status-go-android.aar" prepare-ios: $(STATUS_GO_IOS_ARCH) _prepare-mobile ##@prepare Install and prepare iOS-specific dependencies cd $(RCTSTATUS_DIR) && unzip -q -o status-go-ios.zip diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 1748d13f02..abdf96e228 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -74,7 +74,6 @@ pipeline { steps { script { e2eUrl = cmn.uploadArtifact(cmn.pkgFind('e2e.apk')) apkUrl = cmn.uploadArtifact(cmn.pkgFind("${btype}.apk")) - if (btype != 'release') { dmgUrl = cmn.uploadArtifact(cmn.pkgFind('dmg')) appUrl = cmn.uploadArtifact(cmn.pkgFind('AppImage')) @@ -102,8 +101,7 @@ pipeline { steps { script { if (env.CHANGE_ID != null) { cmn.githubNotify( - apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, zipUrl, - env.CHANGE_ID + apk: apkUrl, e2e: e2eUrl, ipa: ipaUrl, app: appUrl, dmg: dmgUrl, win: zipUrl, ) } } } @@ -129,10 +127,10 @@ pipeline { when { expression { btype == 'nightly' } } steps { script { e2eApk = e2e.getBuildVariables().get('SAUCE_URL') - build( - job: 'end-to-end-tests/status-app-nightly', wait: false, - parameters: [string(name: 'apk', value: "--apk=${e2eApk}")] - ) + build( + job: 'end-to-end-tests/status-app-nightly', wait: false, + parameters: [string(name: 'apk', value: "--apk=${e2eApk}")] + ) } } } } diff --git a/ci/Jenkinsfile.fastlane.clean b/ci/Jenkinsfile.fastlane.clean index e496399db3..193ff9eebc 100644 --- a/ci/Jenkinsfile.fastlane.clean +++ b/ci/Jenkinsfile.fastlane.clean @@ -4,23 +4,31 @@ env.LC_ALL="en_US.UTF-8" env.FASTLANE_DISABLE_COLORS=1 env.REALM_DISABLE_ANALYTICS=1 -timeout(90) { - node ('fastlane'){ - - stage('Git & Dependencies'){ - - checkout([$class: 'GitSCM', branches: [[name: 'develop']], - doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout']], - submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/status-im/status-react.git']]]) - - load "$HOME/env.groovy" +timeout(120) { + node ('macos') { + stage('Git Checkout'){ + checkout([ + $class: 'GitSCM', + branches: [[name: 'develop']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout']], + submoduleCfg: [], + userRemoteConfigs: [[url: 'https://github.com/status-im/status-react.git']] + ]) } - stage('Clean Testflight Users'){ + stage('Install Deps'){ + sh ('bundle install') + } - withCredentials([string(credentialsId: 'FASTLANE_PASSWORD', variable: 'FASTLANE_PASSWORD'), - string(credentialsId: 'APPLE_ID', variable: 'APPLE_ID')]) { + stage('Clean Users'){ + withCredentials([ + string(credentialsId: 'FASTLANE_PASSWORD', variable: 'FASTLANE_PASSWORD'), + string(credentialsId: 'APPLE_ID', variable: 'APPLE_ID')] + ) { sh ('bundle install') - sh ('bundle exec fastlane ios clean')}} + sh ('bundle exec fastlane ios clean') + } } + } } diff --git a/ci/common.groovy b/ci/common.groovy index 53151870cf..afd24d31eb 100644 --- a/ci/common.groovy +++ b/ci/common.groovy @@ -142,31 +142,28 @@ def pkgFilename(type, ext) { } -def githubNotify(apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, zipUrl, changeId) { +def githubNotify(Map urls) { + def githubIssuesUrl = 'https://api.github.com/repos/status-im/status-react/issues' withCredentials([string(credentialsId: 'GIT_HUB_TOKEN', variable: 'githubToken')]) { - def message = ( - "#### :white_check_mark: CI BUILD SUCCESSFUL\\n" + - "Jenkins job: [${currentBuild.displayName}](${currentBuild.absoluteUrl})\\n"+ - "##### Mobile\\n" + - "* [Android](${apkUrl}), ([e2e](${e2eUrl}))\\n" + - "* [iOS](${ipaUrl})\\n") - - if (dmgUrl != null && appUrl != null && zipUrl != null) { - message = message + - "##### Desktop\\n" + - "* [MacOS](${dmgUrl})\\n" + - "* [AppImage](${appUrl})\\n" + - "* [Windows](${zipUrl})" + def message = "#### :white_check_mark: [${currentBuild.displayName}](${currentBuild.absoluteUrl}) " + message += "CI BUILD SUCCESSFUL in ${currentBuild.durationString} (${GIT_COMMIT})\n" + message += '| | | | | |\n' + message += '|-|-|-|-|-|\n' + message += "| [Android](${urls.apk})([e2e](${urls.e2e})) | [iOS](${urls.ipa}) |" + if (dmgUrl != null) { + message += " [MacOS](${urls.dmg}) | [AppImage](${urls.app}) | [Windows](${urls.win}) |" + } else { + message += " ~~MacOS~~ | ~~AppImage~~ | ~~Windows~~~ |" } - def script = ( - "curl "+ - "-u status-im:${githubToken} " + - "-H 'Content-Type: application/json' " + - "--data '{\"body\": \"${message}\"}' " + - "https://api.github.com/repos/status-im/status-react/issues/${changeId}/comments" - ) - def ghOutput = sh(returnStdout: true, script: script) - println("Result of github comment curl: " + ghOutput); + def msgObj = [body: message] + def msgJson = new JsonBuilder(msgObj).toPrettyString() + sh """ + curl --silent \ + -u status-im:${githubToken} \ + -H "Content-Type: application/json" \ + --data '${msgJson}' \ + "${githubIssuesUrl}/${env.CHANGE_ID}/comments" + """.trim() } }