ci: avoid running pod while there's another instance running
Signed-off-by: Jakub Sokołowski <jakub@status.im> Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
parent
0613563fa9
commit
62dc664090
2
Makefile
2
Makefile
|
@ -89,6 +89,8 @@ prepare-ios: $(STATUS_GO_IOS_ARCH) ##@prepare Install and prepare iOS-specific d
|
|||
yarn install --frozen-lockfile
|
||||
unzip -q -o "$(STATUS_GO_IOS_ARCH)" -d "$(RCTSTATUS_DIR)"
|
||||
ifeq ($(OS),Darwin)
|
||||
# CocoaPods are trash and can't handle other pod instances running at the same time
|
||||
./scripts/wait-for.sh pod 240
|
||||
cd ios && pod install
|
||||
endif
|
||||
|
||||
|
|
|
@ -2,37 +2,6 @@ cmn = load 'ci/common.groovy'
|
|||
ios = load 'ci/ios.groovy'
|
||||
android = load 'ci/android.groovy'
|
||||
|
||||
def wait(lockFile) {
|
||||
/* Crude wait for a lock file to disappear */
|
||||
def maxAttempts = 20
|
||||
def success = false
|
||||
for (i = 0; i <= maxAttempts; i++) {
|
||||
rval = fileExists(lockFile)
|
||||
if (!rval) {
|
||||
return
|
||||
}
|
||||
sleep 10
|
||||
}
|
||||
error("Failed to acquire lock: ${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 lockFile = "${env.HOME}/.cocoapods.lock"
|
||||
try {
|
||||
wait(lockFile)
|
||||
sh "touch ${lockFile}"
|
||||
sh 'pod update --silent --no-ansi'
|
||||
} finally {
|
||||
sh "rm -f ${lockFile}"
|
||||
}
|
||||
}
|
||||
|
||||
def prep(type = 'nightly') {
|
||||
cmn.doGitRebase()
|
||||
/* ensure that we start from a known state */
|
||||
|
@ -52,21 +21,8 @@ def prep(type = 'nightly') {
|
|||
}
|
||||
/* install ruby dependencies */
|
||||
sh 'bundle install --quiet'
|
||||
/* node deps and status-go download */
|
||||
/* node deps, pods, and status-go download */
|
||||
sh "make prepare-${env.BUILD_PLATFORM}"
|
||||
/* generate ios/StatusIm.xcworkspace */
|
||||
if (env.BUILD_PLATFORM == 'ios') {
|
||||
dir('ios') {
|
||||
try {
|
||||
sh 'pod install --silent'
|
||||
} catch (Exception ex) {
|
||||
println "pod installation failed, trying to upgrade the repo"
|
||||
/* only if pod install fails, we try to upgrade the repo */
|
||||
podUpdate()
|
||||
sh 'pod install --silent'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def leinBuild(platform) {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
PROC_NAME=${1}
|
||||
TIMEOUT=${2:-600}
|
||||
SLEEP_SEC=5
|
||||
STEPS=$((TIMEOUT / SLEEP_SEC))
|
||||
|
||||
if [[ -z ${PROC_NAME} ]]; then
|
||||
echo "No process name specified!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for ((i = 0; i < ${STEPS}; i += 1)); do
|
||||
if pgrep ${PROC_NAME} > /dev/null; then
|
||||
echo "Process found. Sleeping ${SLEEP_SEC}..." >&2
|
||||
sleep ${SLEEP_SEC}
|
||||
else
|
||||
echo "Process '${PROC_NAME}' gone." >&2
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Timeout reached! (${TIMEOUT}s) Process still up: ${PROC_NAME}" >&2
|
||||
exit 1
|
Loading…
Reference in New Issue