【问题标题】:Allow CI to run fastlane's download_dsyms action?允许 CI 运行 fastlane 的 download_dsyms 操作?
【发布时间】:2019-12-09 08:26:45
【问题描述】:

我正在尝试在 CircleCI 中运行预定的工作流程,该工作流程将从 iTunes/AppStore Connect 下载我的应用的 DSyms 并将它们上传到 Firebase 的 Crashlytics,但 fastlane 要求我输入 Apple 的密码 - 并且构建停止:

[⠋] ???? [⠙] ???? [⠹] ???? [⠸] ???? [⠼] ???? [⠴] ???? [⠦] ???? [⠧] ???? [⠇] ???? [✔] ???? 
[14:32:26]: Sending anonymous analytics information
[14:32:26]: Learn more at https://docs.fastlane.tools/#metrics
[14:32:26]: No personal or sensitive data is sent.
[14:32:26]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[14:32:26]: ------------------------------
[14:32:26]: --- Step: default_platform ---
[14:32:26]: ------------------------------
[14:32:26]: Driving the lane 'ios dsyms' ????
[14:32:26]: -----------------------------
[14:32:26]: --- Step: setup_circle_ci ---
[14:32:26]: -----------------------------
[14:32:26]: Creating temporary keychain: "fastlane_tmp_keychain".
[14:32:26]: Enabling match readonly mode.
[14:32:26]: -----------------------------------
[14:32:26]: --- Step: clean_build_artifacts ---
[14:32:26]: -----------------------------------
[14:32:26]: Cleaned up build artifacts ????
[14:32:26]: ----------------------------
[14:32:26]: --- Step: download_dsyms ---
[14:32:26]: ----------------------------
[14:32:26]: Login to App Store Connect (MY_APPLE_ID)
-------------------------------------------------------------------------------------
Please provide your Apple Developer Program account credentials
The login information you enter will be stored in your macOS Keychain
You can also pass the password using the `FASTLANE_PASSWORD` environment variable
See more information about it on GitHub: https://github.com/fastlane/fastlane/tree/master/credentials_manager
-------------------------------------------------------------------------------------
Password (for MY_APPLE_ID): **

我正在定义 FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORDFASTLANE_USERMATCH_PASSWORDPILOT_APPLE_ID 环境变量。

这足以运行upload_to_testflight(skip_waiting_for_build_processing: true),但不能使download_dsyms 工作。

我的.circleci/config.yml(复制如下)基本上只运行fastlane dsyms,这样定义的车道:

  desc "Upload latest debug symbols to Crashlytics"
  lane :dsyms do
    clean_build_artifacts
    download_dsyms(version: 'latest')
    upload_symbols_to_crashlytics
    clean_build_artifacts
  end

我的.circleci/config.yml

version: 2
jobs:
  dsyms:
    macos:
      xcode: "10.2.1"
    working_directory: /Users/distiller/project
    environment:
      FL_OUTPUT_DIR: output
      FASTLANE_LANE: dsyms
    shell: /bin/bash --login -o pipefail
    steps:
      - checkout
      - restore_cache:
          key: 1-gems-{{ checksum "Gemfile.lock" }}
      - run: bundle check || bundle install --path vendor/bundle
      - save_cache:
          key: 1-gems-{{ checksum "Gemfile.lock" }}
          paths:
            - vendor/bundle
      - run:
          name: fastlane
          command: bundle exec fastlane $FASTLANE_LANE
      - store_artifacts:
          path: output

workflows:
  version: 2
  scheduled-workflow:
    triggers:
      - schedule:
          cron: "* 0 * * *"
          filters:
            branches:
              only:
                - testflight
    jobs:
      - dsyms

我的(修整过的其他车道)fastlane/Fastfile

default_platform(:ios)

platform :ios do
  before_all do
    setup_circle_ci
  end

  desc "Upload latest debug symbols to Crashlytics"
  lane :dsyms do
    clean_build_artifacts
    download_dsyms(version: 'latest')
    upload_symbols_to_crashlytics
    clean_build_artifacts
  end
end

如何让 CI 从 Apple 下载 DSyms?


编辑:如果我将密码添加为FASTLANE_PASSWORD 环境变量,那么构建仍然无法请求 2FA 令牌。

[07:04:08]: Sending anonymous analytics information
[07:04:08]: Learn more at https://docs.fastlane.tools/#metrics
[07:04:08]: No personal or sensitive data is sent.
[07:04:08]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[07:04:08]: ------------------------------
[07:04:08]: --- Step: default_platform ---
[07:04:08]: ------------------------------
[07:04:08]: Driving the lane 'ios dsyms' ????
[07:04:08]: -----------------------------
[07:04:08]: --- Step: setup_circle_ci ---
[07:04:08]: -----------------------------
[07:04:08]: Creating temporary keychain: "fastlane_tmp_keychain".
[07:04:08]: Enabling match readonly mode.
[07:04:08]: -----------------------------------
[07:04:08]: --- Step: clean_build_artifacts ---
[07:04:08]: -----------------------------------
[07:04:08]: Cleaned up build artifacts ????
[07:04:08]: ----------------------------
[07:04:08]: --- Step: download_dsyms ---
[07:04:08]: ----------------------------
[07:04:08]: Login to App Store Connect (xxxxxxxx@example.com)
Two-factor Authentication (6 digits code) is enabled for account 'xxxxxxxx@example.com'
More information about Two-factor Authentication: https://support.apple.com/en-us/HT204915

If you're running this in a non-interactive session (e.g. server or CI)
check out https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification

(Input `sms` to escape this prompt and select a trusted phone number to send the code as a text message)

(You can also set the environment variable `SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER` to automate this)
(Read more at: https://github.com/fastlane/fastlane/blob/master/spaceship/docs/Authentication.md#auto-select-sms-via-spaceship-2fa-sms-default-phone-number)

Please enter the 6 digit code:
+---------------------------+--------------------------------------------------------+
|                                    Lane Context                                    |
+---------------------------+--------------------------------------------------------+
| DEFAULT_PLATFORM          | ios                                                    |
| PLATFORM_NAME             | ios                                                    |
| LANE_NAME                 | ios dsyms                                              |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/distiller/Library/Keychains/login.keychain-db" |
+---------------------------+--------------------------------------------------------+

+------+-----------------------+-------------+
|              fastlane summary              |
+------+-----------------------+-------------+
| Step | Action                | Time (in s) |
+------+-----------------------+-------------+
| 1    | default_platform      | 0           |
| 2    | setup_circle_ci       | 0           |
| 3    | clean_build_artifacts | 0           |
| ????   | download_dsyms        | 0           |
+------+-----------------------+-------------+

[07:04:09]: fastlane finished with errors

【问题讨论】:

    标签: continuous-integration fastlane app-store-connect


    【解决方案1】:

    您需要定义 FASTLANE_PASSWORD 环境变量。这是苹果开发者帐户密码。您的 App Store Connect / Apple Developer Portal 密码,如果您还设置了 FASTLANE_USER 变量,通常需要此密码

    upload_to_testflight - 这使用 FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD 将二进制文件上传到 App Store Connect

    lane: refresh_dsyms do
      download_dsyms                           
    end
    

    此操作会在 Apple 重新编译 IPA 后从 App Store Connect 下载 dSYM 文件。此操作需要 FASTLANE_PASSWORD

    【讨论】:

    • 但是 FASTLANE_PASSWORD 触发了 2FA 令牌的提示 - 我无法提供,因为这是在 CI 环境中
    • 您还需要添加 FASTLANE_SESSION 变量,该变量还可以通过在终端中运行以下命令获得的值(user@email.com 将替换为 Apple id)。 fastlane spaceauth -u user@email.com
    【解决方案2】:

    最后更新 App Store Connect API 版本 1.6 添加了对获取 dSYM 网址的支持。和 您现在可以使用 2.197.0 版本的 fastlane 通过 AppStore Connect API 下载 dsyms

    app_store_connect_api_key(
      key_id: "D383SF739",
      issuer_id: "6053b7fe-68a8-4acb-89be-165aa6465141",
      key_filepath: "./AuthKey_D383SF739.p8"
    )
    
    download_dsyms(
      app_identifier: "com.joshdholtz.example"
    )
    

    【讨论】:

      猜你喜欢
      • 2020-05-20
      • 2016-07-25
      • 1970-01-01
      • 2020-09-12
      • 2015-08-20
      • 2021-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多