diff --git a/ci/common.groovy b/ci/common.groovy index 80101144f2..4402c7ed13 100644 --- a/ci/common.groovy +++ b/ci/common.groovy @@ -7,29 +7,30 @@ def getBuildType() { if (jobName.startsWith('status-react/pull requests')) { return 'pr' } - if (jobName.startsWith('status-react/nightly')) { return 'nightly' } - if (jobName.startsWith('status-react/release')) { return 'release' } - return params.BUILD_TYPE } - def buildBranch(name = null, buildType) { /* need to drop origin/ to match definitions of child jobs */ def branchName = env.GIT_BRANCH.replace('origin/', '') /* always pass the BRANCH and BUILD_TYPE params with current branch */ - return build( + def b = build( job: name, + /* this allows us to analize the job even after failure */ + propagate: false, parameters: [ [name: 'BRANCH', value: branchName, $class: 'StringParameterValue'], [name: 'BUILD_TYPE', value: buildType, $class: 'StringParameterValue'], ]) + /* BlueOcean seems to not show child-build links */ + print "URL: ${b.getAbsoluteUrl()}" + return b } def copyArts(projectName, buildNo) { diff --git a/ci/mobile.groovy b/ci/mobile.groovy index 8ad8a3dc56..81c239d544 100644 --- a/ci/mobile.groovy +++ b/ci/mobile.groovy @@ -2,6 +2,36 @@ common = load 'ci/common.groovy' ios = load 'ci/ios.groovy' android = load 'ci/android.groovy' +def podLockExists() { + def lockFile = ( + env.HOME+ + '/.cocoapods/repos/master/.git/refs/remotes/origin/master.lock' + ) + return fileExists(lockFile) +} + +def podUpdate() { + /** + * This is awful BUT multiple jobs running on the same host can + * clash when trying to update the CocoaPods maste repo. + * We could set CP_REPOS_DIR, but the would result in + * multiple ~3GB directories all over the place and would be slow. + **/ + def maxAttempts = 10 + def success = false + for (i = 0; i <= maxAttempts; i++) { + if (!podLockExists()) { + success = true + break + } + sleep 10 + } + if (!success) { + error('Another pod proc. is preventing us from updating!') + } + sh 'pod update --silent' +} + def prep(type = 'nightly') { /* select type of build */ switch (type) { @@ -19,7 +49,8 @@ def prep(type = 'nightly') { sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack' /* generate ios/StatusIm.xcworkspace */ dir('ios') { - sh 'pod install --silent --repo-update' + podUpdate() + sh 'pod install --silent' } }