xcodebuild 归档失败,CircleCI 上的退出状态为 65

Posted

技术标签:

【中文标题】xcodebuild 归档失败,CircleCI 上的退出状态为 65【英文标题】:xcodebuild archive fails with exit status 65 on CircleCI 【发布时间】:2018-02-08 00:28:32 【问题描述】:

大纲

你好! 我正在尝试通过将 fastlane 与 match 和 gym 结合使用来自动化 adhoc 构建。 我可以在本地环境中存档。 但我无法在 Circle CI 存档。 看起来 xcodebuild 命令失败了。 我通过 ssh 登录作业,此命令在 Circle CI 失败。

$ xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Release -destination 'generic/platform=ios' -archivePath MyApp.xcarchive clean archive |三通 /Users/distiller/Library/Logs/gym/MyApp-MyApp.log

请告诉我解决方案。

我做了什么

https://circleci.com/docs/2.0/ios-codesigning/

我已经参考这个页面设置了项目设置。

我的代码符号设置在这里。

https://circleci-discourse.s3.amazonaws.com/original/2X/6/6e3c5cf2ed04b16a3d782d99c99107d5889a29f8.png

快车道来了。

version: 2
jobs:
 setup:
   macos:
     xcode: "9.2.0"
   shell: /bin/bash --login -eo pipefail
   steps:
     - checkout
     - run:
         name: Set Ruby Version
         command:  echo "ruby-2.4" > ~/.ruby-version
     - restore_cache:
         keys:
           - gems- checksum "Gemfile.lock" 
     - run:
         name: Running bundle install
         command: bundle check || bundle install --path vendor/bundle
         environment:
             - BUNDLE_JOBS: 4
             - BUNDLE_RETRY: 3
     - save_cache:
         key: gems- checksum "Gemfile.lock" 
         paths:
           - vendor/bundle
     - restore_cache:
         keys:
           - pods-- checksum "Podfile.lock" 
     - run:
         name: Running pod install
         command: |
           curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
           bundle exec pod install
     - save_cache:
         key: pods- checksum "Podfile.lock" 
         paths:
           - Pods
           - MyApp.xcworkspace
 beta-deployment:
   macos:
     xcode: "9.2.0"
   shell: /bin/bash --login -eo pipefail
   steps:
     - checkout
     - restore_cache:
         keys:
           - gems- checksum "Gemfile.lock" 
     - restore_cache:
         keys:
           - pods- checksum "Podfile.lock" 
     - run: echo "ruby-2.4" > ~/.ruby-version
     - run: bundle install
     - run: bundle exec fastlane build_adhoc
     - store_artifacts:
         path: MyApp.app.dSYM.zip
     - store_artifacts:
         path: MyApp.ipa
workflows:
  version: 2
  build_test_deployment:
    jobs:
      - setup
      - beta-deployment:
          requires:
            - setup

config.yml 在这里。

fastlane_version "2.35.1"

default_platform :ios

platform :ios do
  lane :build_adhoc do
    setup_circle_ci
    match(type: "appstore", app_identifier: "jp.hogehoge.MyApp", readonly: true)
    match(type: "adhoc", app_identifier: "jp.hogehoge.MyApp", readonly: true)
    gym(
      scheme: "MyApp",
      workspace: "MyApp.xcworkspace",
      configuration: "Release",
      export_method: "ad-hoc",
      export_options: 
        provisioningProfiles: 
        "jp.hogehoge.MyApp" => "match AdHoc jp.hogehoge.MyApp"
        
      ,
      clean: true
    )
  end
end

失败的日志在这里。

...
...
▸ Running script '[CP] Embed Pods Frameworks'
▸ Running script '[CP] Copy Pods Resources'
▸ Touching MyApp.app
▸ Signing /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dsgauupkymppmmgymocmzptqnqrr/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
▸ Touching MyApp.app.dSYM
** ARCHIVE FAILED **
[01:51:08]: Exit status: 65
[01:51:08]: 
[01:51:08]: Maybe the error shown is caused by using the wrong version of Xcode
[01:51:08]: Found multiple versions of Xcode in '/Applications/'
[01:51:08]: Make sure you selected the right version for your project
[01:51:08]: This build process was executed using '/Applications/Xcode-9.2.app'
[01:51:08]: If you want to update your Xcode path, either
[01:51:08]: 
[01:51:08]: - Specify the Xcode version in your Fastfile
[01:51:08]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[01:51:08]: 
[01:51:08]: - Specify an absolute path to your Xcode installation in your Fastfile
[01:51:08]: ▸ xcode_select "/Applications/Xcode8.app"
[01:51:08]: 
[01:51:08]: - Manually update the path using
[01:51:08]: ▸ sudo xcode-select -s /Applications/Xcode.app
[01:51:08]: 

+---------------+-----------------------------+
|              Build environment              |
+---------------+-----------------------------+
| xcode_path    | /Applications/Xcode-9.2.app |
| gym_version   | 2.79.0                      |
| export_method | ad-hoc                      |
| sdk           | iPhoneOS11.2.sdk            |
+---------------+-----------------------------+

[01:51:08]: ▸ Touch /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dsgauupkymppmmgymocmzptqnqrr/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphoneos/MyApp.app.dSYM
[01:51:08]: ▸     cd /Users/distiller/project
[01:51:08]: ▸     export PATH="/Applications/Xcode-9.2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode-9.2.app/Contents/Developer/usr/bin:/Users/distiller/.gem/ruby/2.4.2/bin:/Users/distiller/.rubies/ruby-2.4.2/lib/ruby/gems/2.4.0/bin:/Users/distiller/.rubies/ruby-2.4.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
[01:51:08]: ▸     /usr/bin/touch -c /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dsgauupkymppmmgymocmzptqnqrr/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphoneos/MyApp.app.dSYM
[01:51:08]: 
[01:51:08]: ⬆️  Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[01:51:08]: ????  For the complete and more detailed error log, check the full log at:
[01:51:08]: ????  /Users/distiller/Library/Logs/gym/MyApp-MyApp.log
[01:51:08]: 
[01:51:08]: Looks like fastlane ran into a build/archive error with your project
[01:51:08]: It's hard to tell what's causing the error, so we wrote some guides on how
[01:51:08]: to troubleshoot build and signing issues: docs.fastlane.tools/codesigning/getting-started/
[01:51:08]: Before submitting an issue on GitHub, please follow the guide above and make
[01:51:08]: sure your project is set up correctly.
[01:51:08]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[01:51:08]: the full commands printed out in yellow in the above log.
[01:51:08]: Make sure to inspect the output above, as usually you'll find more error information there
[01:51:08]: 
+------------------------------------+--------------------------------------------------------------------------------+
|                                                    Lane Context                                                     |
+------------------------------------+--------------------------------------------------------------------------------+
| DEFAULT_PLATFORM                   | ios                                                                            |
| PLATFORM_NAME                      | ios                                                                            |
| LANE_NAME                          | ios build_adhoc                                                                |
| ORIGINAL_DEFAULT_KEYCHAIN          | "/Users/distiller/Library/Keychains/login.keychain-db"                         |
| SIGH_PROFILE_TYPE                  | ad-hoc                                                                         |
| MATCH_PROVISIONING_PROFILE_MAPPING | "jp.hogehoge.MyApp"=>"match AdHoc jp.hogehoge.MyApp" |
+------------------------------------+--------------------------------------------------------------------------------+
[01:51:08]: Error building the application - see the log above

+------+---------------------------------+-------------+
|                   fastlane summary                   |
+------+---------------------------------+-------------+
| Step | Action                          | Time (in s) |
+------+---------------------------------+-------------+
| 1    | Verifying fastlane version      | 0           |
| 2    | default_platform                | 0           |
| 3    | setup_circle_ci                 | 0           |
| 4    | Switch to ios certificates lane | 0           |
| 5    | match                           | 2           |
| 6    | match                           | 2           |
| 7    | match                           | 1           |
| ????   | gym                             | 207         |
+------+---------------------------------+-------------+

[01:51:08]: fastlane finished with errors

[!] Error building the application - see the log above

...

[23:25:14]: WARNING: fastlane requires your locale to be set to UTF-8. To learn more go ://docs.fastlane.tools/getting-started/ios/setup/#set-up-environment-variables
Exited with code 1

【问题讨论】:

你能解决这个问题吗? 【参考方案1】:

我遇到了同样的问题,但原因完全不同。

我错误地添加了带有过时路径的文件导入。由于这个问题,我无法在本地启动应用程序。

一旦我解决了源代码的问题,应用就可以正常启动,并且工作按预期工作。

【讨论】:

以上是关于xcodebuild 归档失败,CircleCI 上的退出状态为 65的主要内容,如果未能解决你的问题,请参考以下文章

xcodebuild 卡在代码设计上?如何禁用提示?

Xcodebuild-由于代码签名错误,Travis CI 无法归档使用 cocoapods 的项目?

xcodebuild 归档 - 未捕获的异常:对象不能为 nil(键:IDEArchivePathOverride)

xcodebuild 存档配置不起作用

CircleCI 2.0 Android 构建总是失败

测试在 Xcode 中通过,但在 Circleci 上失败