add a wait for cocoapods lock to disappear

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2018-08-29 16:29:09 -04:00
parent 7d87666c60
commit 6353039171
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
2 changed files with 38 additions and 6 deletions

View File

@ -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) {

View File

@ -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'
}
}