From 76f5f020ef3b88cd22a795b1ef9227c87a59e698 Mon Sep 17 00:00:00 2001 From: Igor Mandrigin Date: Thu, 24 May 2018 15:41:41 +0200 Subject: [PATCH] [#4292] Use separate jobs to upload files to iTC and Google Play. Signed-off-by: Igor Mandrigin --- Jenkinsfile.upload_release_android | 89 +++++++++++++++++++ ..._release => Jenkinsfile.upload_release_ios | 14 +-- 2 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 Jenkinsfile.upload_release_android rename Jenkinsfile.upload_release => Jenkinsfile.upload_release_ios (90%) diff --git a/Jenkinsfile.upload_release_android b/Jenkinsfile.upload_release_android new file mode 100644 index 0000000000..d34958e052 --- /dev/null +++ b/Jenkinsfile.upload_release_android @@ -0,0 +1,89 @@ +// We need release builds for users who want to test apps, diawi removes old builds and limits downloads, hence the need for Artifactory. +// To see env: echo sh(returnStdout: true, script: 'env') + +env.LANG="en_US.UTF-8" +env.LANGUAGE="en_US.UTF-8" +env.LC_ALL="en_US.UTF-8" + +def installJSDeps() { + def attempt = 1 + def maxAttempts = 10 + def installed = false + while (!installed && attempt <= maxAttempts) { + println "#${attempt} attempt to install npm deps" + sh 'npm install' + installed = fileExists('node_modules/web3/index.js') + attemp = attempt + 1 + } +} + +timeout(90) { + node ('macos'){ + def apkUrl = '' + def ipaUrl = '' + def testPassed = true + def version + + load "$HOME/env.groovy" + + try { + + stage('Git & Dependencies') { + slackSend color: 'good', message: BRANCH_NAME + ' build started. ' + env.BUILD_URL + + if (!BRANCH_NAME.startsWith("release/")){ + error "Wrong branch name format: " + BRANCH_NAME + ", but it should be `release/version`" + } + + checkout scm + + version = readFile("${env.WORKSPACE}/VERSION").trim() + sh 'echo "' + version + '" > .version' + + sh 'git fetch --tags' + + sh 'rm -rf node_modules' + sh 'cp .env.prod .env' + sh 'lein deps' + installJSDeps() + + sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack' + sh 'cd ios && pod install && cd ..' + } + + stage('Tests') { + sh 'lein test-cljs' + } + + stage('Build') { + sh 'lein prod-build' + } + + stage('Build (Android)') { + sh 'cd android && ./gradlew assembleRelease -PreleaseVersion=' + version + } + + stage('Deploy (Android)') { + sh ('bundle exec fastlane android release') + } + + stage('Push build tag') { + withCredentials([[ + $class: 'UsernamePasswordMultiBinding', + credentialsId: 'jenkins-status-im', + usernameVariable: 'GIT_USER', + passwordVariable: 'GIT_PASS' + ]]) { + sh ('git push --tags https://${GIT_USER}:${GIT_PASS}@github.com/status-im/status-react --tags') + } + } + } catch (e) { + slackSend color: 'bad', message: 'Release build failed uploading to the Play Market. ' + env.BUILD_URL + throw e + } + + stage('Slack Notification') { + slackSend color: 'good', message: 'Release build ' + version + ' succesfully aploade to the Play Market' + } + } +} diff --git a/Jenkinsfile.upload_release b/Jenkinsfile.upload_release_ios similarity index 90% rename from Jenkinsfile.upload_release rename to Jenkinsfile.upload_release_ios index 099bd1294a..26378723f0 100644 --- a/Jenkinsfile.upload_release +++ b/Jenkinsfile.upload_release_ios @@ -27,7 +27,6 @@ timeout(90) { load "$HOME/env.groovy" try { - stage('Git & Dependencies') { slackSend color: 'good', message: BRANCH_NAME + ' build started. ' + env.BUILD_URL @@ -58,10 +57,6 @@ timeout(90) { sh 'lein prod-build' } - stage('Build (Android)') { - sh 'cd android && ./gradlew assembleRelease -PreleaseVersion=' + version - } - stage('Build (iOS)') { withCredentials([string(credentialsId: 'jenkins_pass', variable: 'password')]) { def build_no = sh(returnStdout: true, script: './scripts/build_no.sh --tag').trim() @@ -73,15 +68,10 @@ timeout(90) { } } - stage('Deploy (Android)') { - sh ('bundle exec fastlane android release') - } - stage('Deploy (iOS)') { sh ('bundle exec fastlane ios release') } - stage('Push build tag') { withCredentials([[ $class: 'UsernamePasswordMultiBinding', @@ -93,12 +83,12 @@ timeout(90) { } } } catch (e) { - slackSend color: 'bad', message: 'Release build failed uploading to iTC/Play Market. ' + env.BUILD_URL + slackSend color: 'bad', message: 'Release build failed uploading to iTunes Connect. ' + env.BUILD_URL throw e } stage('Slack Notification') { - slackSend color: 'good', message: 'Release build ' + version + ' succesfully aploade to iTC/Play Market' + slackSend color: 'good', message: 'Release build ' + version + ' succesfully aploade to iTunes Connect' } } }