You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure DevOps中Xcode@5任务随机挂起求助(Xcode 15.0)

Azure DevOps Xcode@5任务随机挂起在Asset Catalog编译阶段

环境信息

  • 构建服务:Azure DevOps(AZDO)
  • 任务类型:Xcode@5
  • 托管代理:macos-13微软代理,版本3.227.1/3.227.2(已排除版本与超时关联)
  • Xcode版本:15.0

问题现象

  • 本地执行相同xcodebuild命令(清理Derived Data后)可正常完成构建
  • CI流水线任务随机挂起:有时连续2次运行正常,第3次就卡住
  • 流水线超时设置为60分钟,挂起后会停滞直至触发超时;正常构建仅需约10分钟
  • 挂起时控制台最后停留在CompileAssetCatalog步骤,正常情况下该步骤后会输出Asset Catalog编译通知及后续Swift编译内容

挂起时的最后控制台输出

2023-10-15T13:00:48.9604720Z CompileAssetCatalog /Users/runner/Library/Developer/Xcode/DerivedData/mobile-erawnnainwlxhxbadsuelqkzpzoi/Build/Intermediates.noindex/ArchiveIntermediates/mobile\ staging/InstallationBuildProductsLocation/Applications/staging.app /Users/runner/work/1/s/mobile/mobile/Assets.xcassets (in target 'staging' from project 'mobile')
2023-10-15T13:00:48.9606750Z     cd /Users/runner/work/1/s/mobile
2023-10-15T13:00:48.9632920Z     /Applications/Xcode_15.0.app/Contents/Developer/usr/bin/actool --output-format human-readable-text --notices --warnings --export-dependency-info /Users/runner/Library/Developer/Xcode/DerivedData/mobile-erawnnainwlxhxbadsuelqkzpzoi/Build/Intermediates.noindex/ArchiveIntermediates/mobile\ staging/IntermediateBuildFilesPath/mobile.build/Debug-iphoneos/staging.build/assetcatalog_dependencies --output-partial-info-plist /Users/runner/Library/Developer/Xcode/DerivedData/mobile-erawnnainwlxhxbadsuelqkzpzoi/Build/Intermediates.noindex/ArchiveIntermediates/mobile\ staging/IntermediateBuildFilesPath/mobile.build/Debug-iphoneos/staging.build/assetcatalog_generated_info.plist --app-icon AppIcon-Debug --compress-pngs --enable-on-demand-resources YES --development-region en --target-device iphone --target-device ipad --minimum-deployment-target 15.0 --platform iphoneos --compile /Users/runner/Library/Developer/Xcode/DerivedData/mobile-erawnnainwlxhxbadsuelqkzpzoi/Build/Intermediates.noindex/ArchiveIntermediates/mobile\ staging/InstallationBuildProductsLocation/Applications/staging.app /Users/runner/work/1/s/mobile/mobile/Assets.xcassets

当前Xcode任务配置

- task: Xcode@5
  displayName: "Archiving IPA"
  inputs:
    script: 'xcodebuild -showsdks'
    actions: 'clean'
    configuration: 'Debug'
    sdk: ''
    xcWorkspacePath: 'mobile/mobile.xcodeproj'
    scheme: 'mobile staging'
    packageApp: true
    exportMethod: 'ad-hoc'
    signingOption: 'manual'
    signingIdentity: 'Apple Distribution: .....'
    provisioningProfileUuid: '....'
    teamId: '....'
    destinationPlatformOption: 'iOS'
    args: '-verbose'
    useXcpretty: false

排查解决建议

  • 拆分clean与archive步骤:将clean和archive拆分为两个独立的Xcode任务,避免单任务内连续执行清理与归档操作可能引发的资源竞争
  • 手动清理Derived Data:在Xcode任务前添加脚本步骤,强制删除Derived Data目录,确保每次构建环境完全干净:
    rm -rf ~/Library/Developer/Xcode/DerivedData
    
  • 禁用actool并发处理:在任务的args中添加-Xactool --no-concurrent-processing参数,关闭actool的并发处理能力,避免托管代理上的资源竞争导致死锁
  • 回退Xcode版本测试:临时切换到Xcode 14.3.1版本运行流水线,确认是否为Xcode 15.0的actool组件存在已知bug
  • 添加资源监控:在任务中插入监控脚本,当任务运行到Asset Catalog编译阶段时,定期输出系统资源使用情况(如CPU、内存、进程状态),便于定位挂起原因:
    while true; do top -l 1 | grep -E '(actool|CPU|PhysMem)'; sleep 30; done &
    
  • 检查Asset Catalog资源:排查Assets.xcassets中是否存在异常资源(如超大尺寸图片、格式不兼容的资源),这类资源可能导致actool处理时卡住

内容的提问来源于stack exchange,提问作者LonestarX

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 08:29:58