ios - carthage bootstrap 失败,因为并行 git 进程访问共享缓存 index.lock 文件
问题描述
我正在Jenkins 从站上从 Jenkins并行触发多个 iOS 构建。当构建触发以下命令时,我收到错误消息。
命令
carthage bootstrap --no-use-binaries --platform ios --use-ssh --cache-builds
输出
2020-01-29 21:34:58.471 carthage[85379:2625480] INFO: fetch-response is unable to open the file /Users/user/Library/Caches/carthage/fsCachedData/7A4CE621-0AC6-4FAF-B0CE-33FDD32A0113. Errno: 2
*** Checking out Alamofire at "4.8.2"
*** Checking out ios-client at "3.0.0"
*** Checking out stripe-ios at "v18.3.0"
*** Checking out swift-protobuf at "1.5.0"
A shell task (/usr/bin/env git checkout --quiet --force v18.3.0 (launched in /Users/user/Library/Caches/org.carthage.CarthageKit/dependencies/stripe-ios)) failed with exit code 128:
fatal: Unable to create '/Users/user/Library/Caches/org.carthage.CarthageKit/dependencies/stripe-ios/./index.lock': File exists.
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
make: *** [carthage-install] Error 1
如何解决这个问题?我猜这是因为多个进程试图访问共享的 Carthage 缓存。
解决方案
您是否在 Carthage 存储库中发现了这个问题?似乎它描述了您遇到的问题:https ://github.com/Carthage/Carthage/issues/1187
问题是 Carthage 从未打算并行运行,因为如果多个 Carthage 作业以同一用户身份运行,它使用的锁可能会挂起。如果您将 CI 机器配置为拥有多个用户,其中每个用户运行一个 Carthage 作业,则不应出现此问题。如果您有一个用户在机器启动时自动登录,该用户启动多个构建代理,并且这些代理可以在他们的 Carthage 活动中重叠,那么构建可能会以您描述的方式失败。
Carthage 的一个分支声称已经解决了这个问题:https ://github.com/nsoperations/Carthage - 我还没有尝试过,但我想我会的。如果您在使用 Carthage 时遇到困难,并且希望您的 Mac CI 机器从断电中恢复到多个构建代理(例如 Buildkite)正在运行的状态,我认为这可能是唯一的答案。如果我知道一种使多个用户自动登录的可靠方法,每个用户在登录时启动代理进程,那将使得继续使用 Carthage 的主分支成为可能。
推荐阅读
- sql - 为什么 null||null 在 postgres 中返回一个空值而 concat(null,null) 返回一个空字符串?
- ignite - 在 Apache Ignite 中合并两个持久缓存
- python-2.7 - 当我对语音识别说话时没有响应
- tensorflow - ImportError: import tensorflow_model_analysis as tfma [PYTHON on datalab]
- r - 在多个(唯一和二进制)列中拆分调查文本单元格
- javascript - 来自动态 JS 的图像源相对路径未正确加载
- amazon-ecs - AWS Fargate vs Batch vs ECS 每天一次的批处理过程
- android - Android Studio 无法识别 wav 文件
- excel - 仅处理特定的 VBA 错误
- python - 我的日期格式为 m/dd/yyyy h:mm 和 mm/dd/yyyy h:mm,我想在 sparksql 中以 yyyy-mm-dd hh:mm:ss 输出。但我越来越空