fastlane: Cannot Upload to Testflight using Spaceship but working in Transporter

New Issue Checklist

Issue Description

We started noticing our CI automation of submitting builds to Testflight started failing with the error: A required agreement is missing or has expired. - This request requires an in-effect agreement that has not been signed or has expired undefined method 'error_info' for #<Spaceship::ProgramLicenseAgreementUpdated:0x00007fc3ab1e3900>

We do have a pending agreement due to a legal entity change, but we also still have a valid agreement in place while Apple and my company are finalizing this agreement, and we have been publishing apps and using Testflight without any issue, and this has been like that for a couple weeks already: image

We were able to submit builds using the upload_to_testflight action using an API key just fine a couple days ago, but then today it started failing.

I tried uploading using Transporter and it worked fine, so I’m not sure why this started failing out of nowhere.

Command executed
upload_to_testflight(
      app_identifier: options[:app_identifier], 
      ipa: options[:ipa], 
      skip_waiting_for_build_processing: true, 
      team_id: options[:team_id],
      api_key: api_key
    )
Complete output when running fastlane, including the stack trace and command used
static:project distiller$ bundle exec fastlane deploy enterprise:false type:release market:main apple_id:$APPLEID_STAGING ipa:$(cat deploy_path).ipa dsym:$(cat deploy_path).app.dsym.zip --verbose
[✔] 🚀 
DEBUG [2021-12-28 06:55:09.53]: Checking if there are any plugins that should be loaded...
DEBUG [2021-12-28 06:55:09.53]: Loading 'fastlane-plugin-aws_s3' plugin
INFO [2021-12-28 06:55:09.53]: gem 'fastlane-plugin-aws_s3' is already installed
DEBUG [2021-12-28 06:55:09.70]: Loading 'fastlane-plugin-xcconfig_actions' plugin
INFO [2021-12-28 06:55:09.71]: gem 'fastlane-plugin-xcconfig_actions' is already installed
DEBUG [2021-12-28 06:55:09.73]: Loading 'fastlane-plugin-xcconfig' plugin
INFO [2021-12-28 06:55:09.73]: gem 'fastlane-plugin-xcconfig' is already installed
DEBUG [2021-12-28 06:55:09.74]: Loading 'fastlane-plugin-firebase_app_distribution' plugin
INFO [2021-12-28 06:55:09.74]: gem 'fastlane-plugin-firebase_app_distribution' is already installed
+-------------------------------------------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                              Used plugins                                                                                                              |
+-------------------------------------------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Plugin                                    | Version | Action                                                                                                                                                                           |
+-------------------------------------------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| fastlane-plugin-aws_s3                    | 2.0.3   | aws_s3                                                                                                                                                                           |
| fastlane-plugin-xcconfig_actions          | 1.4.2   | build_settings_to_flags, read_xcconfig, validate_xcconfig                                                                                                                        |
| fastlane-plugin-xcconfig                  | 2.0.0   | update_xcconfig_value, set_xcconfig_value, get_xcconfig_value                                                                                                                    |
| fastlane-plugin-firebase_app_distribution | 0.3.1   | firebase_app_distribution_login, firebase_app_distribution_add_testers, firebase_app_distribution_get_udids, firebase_app_distribution, firebase_app_distribution_remove_testers |
+-------------------------------------------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Successfully loaded Appfile at path ‘/Users/distiller/project/fastlane/Appfile’

  • apple_id: ‘-- REDACTED --’
  • team_id: ‘-- REDACTED --’

DEBUG [2021-12-28 06:55:09.99]: Using enterprise: false DEBUG [2021-12-28 06:55:09.99]: Using type: release DEBUG [2021-12-28 06:55:09.99]: Using market: main DEBUG [2021-12-28 06:55:09.99]: Using apple_id: – REDACTED – DEBUG [2021-12-28 06:55:09.99]: Using ipa: output/gym/App_Release.ipa DEBUG [2021-12-28 06:55:09.99]: Using dsym: output/gym/App_Release.app.dsym.zip INFO [2021-12-28 06:55:10.00]: ------------------------------ INFO [2021-12-28 06:55:10.00]: — Step: default_platform — INFO [2021-12-28 06:55:10.00]: ------------------------------ INFO [2021-12-28 06:55:10.00]: Driving the lane ‘ios deploy’ 🚀 INFO [2021-12-28 06:55:10.00]: ----------------------------- INFO [2021-12-28 06:55:10.01]: — Step: setup_circle_ci — INFO [2021-12-28 06:55:10.01]: ----------------------------- INFO [2021-12-28 06:55:10.01]: Creating temporary keychain: “fastlane_tmp_keychain”. WARN [2021-12-28 06:55:10.01]: Found keychain ‘~/Library/Keychains/fastlane_tmp_keychain’, creation skipped WARN [2021-12-28 06:55:10.01]: If creating a new Keychain DB is required please set the require_create option true to cause the action to fail INFO [2021-12-28 06:55:10.12]: $ security list-keychains -d user INFO [2021-12-28 06:55:10.14]: ▸ “/Users/distiller/Library/Keychains/fastlane_tmp_keychain-db” WARN [2021-12-28 06:55:10.14]: Found keychain ‘/Users/distiller/Library/Keychains/fastlane_tmp_keychain-db’ in list-keychains, adding to search list skipped INFO [2021-12-28 06:55:10.14]: Enabling match readonly mode. INFO [2021-12-28 06:55:10.15]: ------------------------------------------------ INFO [2021-12-28 06:55:10.15]: — Step: Switch to ios get_market_data lane — INFO [2021-12-28 06:55:10.15]: ------------------------------------------------ INFO [2021-12-28 06:55:10.15]: Cruising over to lane ‘ios get_market_data’ 🚖 INFO [2021-12-28 06:55:10.15]: ------------------------ INFO [2021-12-28 06:55:10.15]: — Step: git_branch — INFO [2021-12-28 06:55:10.15]: ------------------------ INFO [2021-12-28 06:55:10.15]: Cruising back to lane ‘ios deploy’ 🚘 INFO [2021-12-28 06:55:10.15]: ------------------------------------------------- INFO [2021-12-28 06:55:10.15]: — Step: Switch to ios bundle_id_helper lane — INFO [2021-12-28 06:55:10.15]: ------------------------------------------------- INFO [2021-12-28 06:55:10.15]: Cruising over to lane ‘ios bundle_id_helper’ 🚖 INFO [2021-12-28 06:55:10.15]: -------------------------------- INFO [2021-12-28 06:55:10.15]: — Step: get_xcconfig_value — INFO [2021-12-28 06:55:10.15]: -------------------------------- INFO [2021-12-28 06:55:10.15]: Cruising back to lane ‘ios deploy’ 🚘 INFO [2021-12-28 06:55:10.15]: ipa: output/gym/App_Release.ipa INFO [2021-12-28 06:55:10.15]: dsym: output/gym/App_Release.app.dsym.zip INFO [2021-12-28 06:55:10.15]: ----------------------------------------------------- INFO [2021-12-28 06:55:10.15]: — Step: Switch to ios deploy_to_testflight lane — INFO [2021-12-28 06:55:10.15]: ----------------------------------------------------- INFO [2021-12-28 06:55:10.15]: Cruising over to lane ‘ios deploy_to_testflight’ 🚖 INFO [2021-12-28 06:55:10.15]: IPA: output/gym/App_Release.ipa INFO [2021-12-28 06:55:10.15]: Bundle: – REDACTED – INFO [2021-12-28 06:55:10.15]: --------------------------------------- INFO [2021-12-28 06:55:10.15]: — Step: app_store_connect_api_key — INFO [2021-12-28 06:55:10.15]: --------------------------------------- INFO [2021-12-28 06:55:10.20]: ---------------------------------- INFO [2021-12-28 06:55:10.20]: — Step: upload_to_testflight — INFO [2021-12-28 06:55:10.20]: ---------------------------------- INFO [2021-12-28 06:55:10.20]: Creating authorization token for App Store Connect API DEBUG [2021-12-28 06:55:10.20]: App identifier (-- REDACTED --) INFO [2021-12-28 06:55:10.53]: ------------------- INFO [2021-12-28 06:55:10.53]: — Step: is_ci — INFO [2021-12-28 06:55:10.53]: ------------------- ERROR [2021-12-28 06:55:10.53]: An error occurred while executing the error block: ERROR [2021-12-28 06:55:10.53]: undefined method `error_info’ for #Spaceship::ProgramLicenseAgreementUpdated:0x00007fc3ab1e3900 WARN [2021-12-28 06:55:10.53]: Lane Context: INFO [2021-12-28 06:55:10.53]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>“ios deploy”, :KEYCHAIN_PATH=>“~/Library/Keychains/fastlane_tmp_keychain”, :ORIGINAL_DEFAULT_KEYCHAIN=>“"/Users/distiller/Library/Keychains/fastlane_tmp_keychain-db"”} ERROR [2021-12-28 06:55:10.53]: A required agreement is missing or has expired. - This request requires an in-effect agreement that has not been signed or has expired. INFO [2021-12-28 06:55:10.53]: Successfully generated documentation at path ‘/Users/distiller/project/fastlane/README.md’

±-----±----------------------------------------±------------+ | fastlane summary | ±-----±----------------------------------------±------------+ | Step | Action | Time (in s) | ±-----±----------------------------------------±------------+ | 1 | default_platform | 0 | | 2 | setup_circle_ci | 0 | | 3 | Switch to ios get_market_data lane | 0 | | 4 | git_branch | 0 | | 5 | Switch to ios bundle_id_helper lane | 0 | | 6 | get_xcconfig_value | 0 | | 7 | Switch to ios deploy_to_testflight lane | 0 | | 8 | app_store_connect_api_key | 0 | | 💥 | upload_to_testflight | 0 | | 10 | is_ci | 0 | ±-----±----------------------------------------±------------+

±--------------------------±-------------±---------------+ | Plugin updates available | ±--------------------------±-------------±---------------+ | Plugin | Your Version | Latest Version | ±--------------------------±-------------±---------------+ | firebase_app_distribution | 0.3.1 | 0.3.2 | ±--------------------------±-------------±---------------+ INFO [2021-12-28 06:55:10.54]: To update all plugins, just run INFO [2021-12-28 06:55:10.54]: $ bundle exec fastlane update_plugins

ERROR [2021-12-28 06:55:10.54]: fastlane finished with errors bundler: failed to load command: fastlane (/Users/distiller/project/vendor/bundle/ruby/2.7.0/bin/fastlane) Traceback (most recent call last): 60: from /Users/distiller/.gem/ruby/2.7.4/bin/bundle:23:in <main>' 59: from /Users/distiller/.gem/ruby/2.7.4/bin/bundle:23:in load’ 58: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/exe/bundle:37:in <top (required)>' 57: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/friendly_errors.rb:128:in with_friendly_errors’ 56: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/exe/bundle:49:in block in <top (required)>' 55: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/cli.rb:25:in start’ 54: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start' 53: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/cli.rb:31:in dispatch’ 52: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch' 51: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command’ 50: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run' 49: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/cli.rb:477:in exec’ 48: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/cli/exec.rb:23:in run' 47: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/cli/exec.rb:58:in kernel_load’ 46: from /Users/distiller/.gem/ruby/2.7.4/gems/bundler-2.2.27/lib/bundler/cli/exec.rb:58:in load' 45: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/bin/fastlane:23:in <top (required)>’ 44: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/bin/fastlane:23:in load' 43: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/bin/fastlane:23:in <top (required)>’ 42: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/cli_tools_distributor.rb:122:in take_off' 41: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/commands_generator.rb:42:in start’ 40: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/commands_generator.rb:353:in run' 39: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in run!’ 38: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:117:in run!' 37: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in run_active_command’ 36: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/commander-4.6.0/lib/commander/command.rb:157:in run' 35: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/commander-4.6.0/lib/commander/command.rb:187:in call’ 34: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/commands_generator.rb:109:in block (2 levels) in run' 33: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/command_line_handler.rb:36:in handle’ 32: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/lane_manager.rb:47:in cruise_lane' 31: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:45:in execute’ 30: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:45:in chdir' 29: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:49:in block in execute’ 28: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/lane.rb:33:in call' 27: from Fastfile:187:in block (2 levels) in parsing_binding’ 26: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/fast_file.rb:159:in method_missing' 25: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:146:in trigger_action_by_name’ 24: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:204:in try_switch_to_lane' 23: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/lane.rb:33:in call’ 22: from Fastfile:212:in block (2 levels) in parsing_binding' 21: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/fast_file.rb:159:in method_missing’ 20: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:157:in trigger_action_by_name' 19: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:229:in execute_action’ 18: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:229:in chdir' 17: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:255:in block in execute_action’ 16: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in execute_action' 15: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/runner.rb:263:in block (2 levels) in execute_action’ 14: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/fastlane/lib/fastlane/actions/upload_to_testflight.rb:34:in run' 13: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/pilot/lib/pilot/build_manager.rb:23:in upload’ 12: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/pilot/lib/pilot/manager.rb:64:in fetch_app_id' 11: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/connect_api/models/app.rb:80:in find’ 10: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/connect_api/models/app.rb:74:in all' 9: from /Users/distiller/.rubies/ruby-2.7.4/lib/ruby/2.7.0/forwardable.rb:235:in get_apps’ 8: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/connect_api/testflight/testflight.rb:22:in get_apps' 7: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/connect_api/api_client.rb:105:in get’ 6: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/connect_api/api_client.rb:162:in with_asc_retry' 5: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/connect_api/api_client.rb:106:in block in get’ 4: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/client.rb:762:in request' 3: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/client.rb:918:in send_request’ 2: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/client.rb:677:in with_retry' 1: from /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/client.rb:922:in block in send_request’ /Users/distiller/project/vendor/bundle/ruby/2.7.0/gems/fastlane-2.199.0/spaceship/lib/spaceship/connect_api/api_client.rb:226:in `handle_error’: \e[31m[!] The request could not be completed because: (Spaceship::ProgramLicenseAgreementUpdated) A required agreement is missing or has expired. - This request requires an in-effect agreement that has not been signed or has expired.\e[0m

Environment

 
  [✔] 🚀 
[06:58:22]: Generating fastlane environment output, this might take a few seconds...
swift-driver version: 1.26.9 
🚫 fastlane environment 🚫

Stack

Key Value
OS 11.5.2
Ruby 2.7.4
Bundler? true
Git git version 2.33.0
Installation Source ~/project/vendor/bundle/ruby/2.7.0/bin/fastlane
Host macOS 11.5.2 (20G95)
Ruby Lib Dir ~/.rubies/ruby-2.7.4/lib
OpenSSL Version OpenSSL 1.0.2t 10 Sep 2019
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode-13.0.app/Contents/Developer/
Xcode Version 13.0
Swift Version 5.5

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#
import("./SupportFastfile")

default_platform(:ios)

platform :ios do

  # Required For CircleCI Integration
  desc "Setup Fastlane for CircleCI"
  before_all do |lane, options|
    setup_circle_ci
  end

  lane :setup_pods do
    cocoapods(
      use_bundle_exec: true,
      podfile: "./Podfile",
      repo_update: true
      )
  end

  # Create and Run these before building. One per type.
  private_lane :before_debug do |options|
    begin
      sh("git pull")
    rescue => ex
      UI.error(ex)
    end

    dev_deploy_adhoc(market_data: options[:market_data])
  end

  private_lane :before_staging_deploy do |options|
    # added pull for cases where we need to re-run failed build
    begin
      sh("git pull")
    rescue => ex
      UI.error(ex)
    end

    if options[:bumpBuild]
      ensure_git_status_clean(show_uncommitted_changes: false)
      increment_build_number(skip_info_plist: true)
      commit_version_bump(xcodeproj: "./App.xcodeproj", message: "Bumping to version #{get_version_number(target: "App")} build #{lane_context[SharedValues::BUILD_NUMBER]} [skip ci]")
      push_to_git_remote
    end
  end

  # MATCH Lane
  desc "Setup Provisioning"
  lane :provisioning do |options|
    match(type: options[:type], app_identifier: options[:app_identifier], readonly: true)
  end

  lane :build do |options|
    # commom values per type
    build_type = {debug: "adhoc", staging: "adhoc", release: "appstore"}
    export_method = {debug: "ad-hoc", staging: "ad-hoc", release: "app-store"}
    market = options[:market] || "main"

    # default values
    type = "#{options[:type] || "debug"}".downcase #debug, staging, release
    deploy = options[:for_deploy] || false
    market_data = get_market_data(type: type, market: market)

    # if you need to run something before building, add it here
    if type == "debug"
      before_debug(market_data: market_data)
    elsif type == "staging" && deploy
      before_staging_deploy(bumpBuild: (market == "main" || market == "cmark"))
    end

    scheme = "#{market_data[:scheme] || "App#{type.capitalize()}"}"

    UI.message("Using Market: #{market_data[:market]}")
    UI.message("Using Scheme: #{scheme}")

    provisioning(type: build_type[:"#{type}"], app_identifier: bundle_id_helper(market_data: market_data))

    build_app(workspace: "./App.xcworkspace",
      skip_archive: !deploy,
      include_symbols: true,
      include_bitcode: false,
      output_name: "App_#{market_data[:market]}_#{type.capitalize()}.ipa",
      scheme: scheme,
      xcconfig: market_data[:xcconfig_path],
      export_method: export_method[:"#{type}"],
      skip_profile_detection: true)

      sh("echo 'output/gym/App_#{market_data[:market]}_#{type.capitalize()}' > ../deploy_path")
  end

  lane :build_enterprise do |options|
    # commom values per type
    market = options[:market] || "main"

    # default values
    type = "#{options[:type] || "debug"}".downcase #debug, staging, release
    deploy = options[:for_deploy] || false
    market_data = get_market_data(type: type, market: market)

    # if you need to run something before building, add it here
    if type == "debug"
      before_debug(market_data: market_data)
    elsif type == "staging" && deploy
      before_staging_deploy(bumpBuild: (market == "main" || market == "cmark"))
    end

    scheme = "#{market_data[:scheme] || "App#{type.capitalize()}"}"

    UI.message("Using Market: #{market_data[:market]}")
    UI.message("Using Scheme: #{scheme}")

    provisioning(
      type: "enterprise",
      app_identifier: bundle_id_helper(market_data: market_data)
    )

    build_app(workspace: "./App.xcworkspace",
      clean: true,
      build_path: "build_path",
      skip_archive: !deploy,
      include_symbols: true,
      include_bitcode: false,
      output_name: "App_#{market_data[:market]}_#{type.capitalize()}.ipa",
      scheme: scheme,
      xcconfig: market_data[:xcconfig_path],
      export_method: "enterprise",
      export_team_id: "-- Redacted --",
      skip_profile_detection: true)

      sh("echo 'output/gym/App_#{market_data[:market]}_#{type.capitalize()}' > ../deploy_path")
  end

  lane :test do |options|
    scan(
      devices: "iPhone 13",
      clean: true,
      scheme: "AppDebug",
      workspace: "App.xcworkspace",
      slack_only_on_failure: "true",
      code_coverage: true,
      output_directory: "./output/scan",
      output_types: "html,junit",
      buildlog_path: "./output/scan"
    )
  end
  
  lane :deploy do |options|    
    type = "#{options[:type] || "debug"}".downcase #debug, staging, release
    market = options[:market] || "main"
    market_data = get_market_data(type: type, market: market)
    bundle_id = bundle_id_helper(market_data: market_data)

    dsym = "#{File.readlines("../deploy_path").sample.strip}.app.dSYM.zip"

    if options[:dsym] && !options[:dsym].empty?
      dsym = options[:dsym]
    end

    UI.message("ipa: #{options[:ipa]}")
    UI.message("dsym: #{dsym}")

    if(options[:enterprise])
      deploy_to_firebase(ipa: options[:ipa] || lane_context[SharedValues::IPA_OUTPUT_PATH], market: options[:market] || "main", env: options[:type], dsym: dsym, release_notes: changelog_from_last_commit)
    else
      if type == "debug"
        deploy_adhoc_tos3(ipa: options[:ipa] || lane_context[SharedValues::IPA_OUTPUT_PATH], dsym: dsym, market: options[:market])
      elsif type == "staging"
        deploy_to_testflight(
          app_identifier: bundle_id, 
          ipa: options[:ipa] || lane_context[SharedValues::IPA_OUTPUT_PATH], 
          team_id: ENV["CONNECT_PROD"], 
          market: options[:market]
        )
      elsif type == "release"
        deploy_to_testflight(
          app_identifier: bundle_id, 
          ipa: options[:ipa] || lane_context[SharedValues::IPA_OUTPUT_PATH], 
          team_id: ENV["CONNECT_PROD"], 
          market: options[:market], 
          dsym: dsym
        )      
      end
    end
  end

  private_lane :deploy_adhoc_tos3 do |options|
    deploy_s3(ipa: options[:ipa], dsym: options[:dsym], market: options[:market])
  end

  private_lane :deploy_to_testflight do |options|
    UI.message("IPA: #{options[:ipa]}")
    UI.message("Bundle: #{options[:app_identifier]}")

    api_key = app_store_connect_api_key(
      key_id: "-- REDACTED --",
      issuer_id: "-- REDACTED --",
      key_filepath: "./fastlane/AuthKey.p8"
    )

    upload_to_testflight(
      app_identifier: options[:app_identifier], 
      ipa: options[:ipa], 
      skip_waiting_for_build_processing: true, 
      team_id: options[:team_id],
      api_key: api_key,
      verbose: true
    )

    upload_symbols_to_crashlytics(
      dsym_path: options[:dsym],
      gsp_path:"./App/Markets/Common/Configuration/GoogleService-Info.plist",
      binary_path:"./Pods/FirebaseCrashlytics/upload-symbols"
    )
  end

  private_lane :deploy_to_firebase do |options|

    app_id = get_info_plist_value(path: "./App/Markets/Google/" + options[:market] + "/" + options[:env] + "/GoogleService-Info-Enterprise.plist", key: "GOOGLE_APP_ID")
    release_notes = options[:release_notes] || ""
    testers_file = "fastlane/testers.txt"
    groups = ""

    if options[:market] == "cmark"
      testers_file = "fastlane/testers_empty.txt"
      groups = "internal-qa"
      release_notes = ""
    end

    UI.message("Starting to deploy build to Firebase, release notes: #{release_notes}")

    firebase_app_distribution(
      app: app_id,
      service_credentials_file: "-- REDACTED --",
      ipa_path: options[:ipa],
      testers_file: testers_file,
      groups: groups,
      debug: true,
      release_notes: release_notes
    )

    upload_symbols_to_crashlytics(
      dsym_path: options[:dsym],
      gsp_path:"./App/Markets/Common/Configuration/GoogleService-Info.plist",
      binary_path:"./Pods/FirebaseCrashlytics/upload-symbols"
    )
  end

  lane :setupConfig do |options|
    configPath = "./App/Markets/Common/Configuration/Configuration.plist"
    infoPlistPath = "./App/Info.plist"

    json = read_xcconfig(path: "./App/Markets/" + options[:market] + "/" + options[:market] +"-"+ options[:env] +".xcconfig")

    # Add market and environment to plist
    set_info_plist_value(path: configPath, key: "MARKET", value: "#{options[:market]}".downcase)
    set_info_plist_value(path: configPath, key: "ENVIRONMENT", value: "#{options[:env]}".downcase)

    json.each do |k,v|
      if ["SRCROOT", "XCODE_VERSION_MAJOR"].include? k
        next
      end
      set_info_plist_value(path: configPath, key: k, value: v)
    end
  end

  private_lane :changelog_from_last_commit do
    sh("git log -n 1 --pretty=format:%s --no-merges --invert-grep --grep=Bumping")
  end
end

`./fastlane/Appfile`
apple_id("-- REDACTED --") # Your Apple email address

#itc_team_id("-- REDACTED --") # App Store Connect Team ID
team_id("-- REDACTED --") # Developer Portal Team ID

# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

Gem Version Update-Status
fastlane 2.199.0 ✅ Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-aws_s3 2.0.3 ✅ Up-To-Date
fastlane-plugin-xcconfig_actions 1.4.2 ✅ Up-To-Date
fastlane-plugin-xcconfig 2.0.0 ✅ Up-To-Date
fastlane-plugin-firebase_app_distribution 0.3.1 🚫 Update available
Loaded gems
Gem Version
did_you_mean 1.4.0
bundler 2.2.27
uri 0.10.0
rake 13.0.6
rexml 3.2.5
CFPropertyList 3.0.5
concurrent-ruby 1.1.9
i18n 1.8.11
minitest 5.14.4
tzinfo 2.0.4
zeitwerk 2.5.1
activesupport 6.1.4.1
public_suffix 4.0.6
addressable 2.8.0
httpclient 2.8.3
json 2.6.1
algoliasearch 1.27.5
rubyzip 2.3.2
apktools 0.7.4
artifactory 3.0.15
atomos 0.1.3
aws-eventstream 1.2.0
aws-partitions 1.541.0
aws-sigv4 1.4.0
jmespath 1.4.0
aws-sdk-core 3.124.0
aws-sdk-kms 1.52.0
aws-sdk-s3 1.109.0
babosa 1.0.4
claide 1.0.3
fuzzy_match 2.0.4
nap 1.1.0
netrc 0.11.0
ffi 1.15.4
ethon 0.15.0
typhoeus 1.4.0
cocoapods-core 1.11.2
cocoapods-deintegrate 1.0.5
cocoapods-downloader 1.5.1
cocoapods-plugins 1.0.0
cocoapods-search 1.0.1
cocoapods-trunk 1.6.0
cocoapods-try 1.2.0
colored2 3.1.2
escape 0.0.4
fourflusher 2.3.1
gh_inspector 1.1.3
molinillo 0.8.0
ruby-macho 2.5.1
nanaimo 0.3.0
xcodeproj 1.21.0
cocoapods 1.11.2
cocoapods-check 1.1.0
colored 1.2
highline 2.0.3
commander 4.6.0
declarative 0.0.20
digest-crc 0.6.4
unf_ext 0.0.8
unf 0.1.4
domain_name 0.5.20190701
dotenv 2.7.6
emoji_regex 3.2.3
excon 0.89.0
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
faraday-net_http 1.0.1
faraday-net_http_persistent 1.2.0
faraday-patron 1.0.0
faraday-rack 1.0.0
multipart-post 2.0.0
ruby2_keywords 0.0.5
faraday 1.8.0
http-cookie 1.0.4
faraday-cookie_jar 0.0.7
faraday_middleware 1.2.0
fastimage 2.2.5
jwt 2.3.0
memoist 0.16.2
multi_json 1.15.0
os 1.1.4
signet 0.16.0
googleauth 1.1.0
mini_mime 1.1.2
trailblazer-option 0.1.2
uber 0.1.0
representable 3.1.1
retriable 3.1.2
webrick 1.7.0
google-apis-core 0.4.1
google-apis-androidpublisher_v3 0.14.0
google-apis-playcustomapp_v1 0.6.0
google-apis-iamcredentials_v1 0.9.0
google-apis-storage_v1 0.10.0
google-cloud-env 1.5.0
google-cloud-errors 1.2.0
google-cloud-core 1.6.0
google-cloud-storage 1.35.0
mini_magick 4.11.0
naturally 2.2.1
optparse 0.1.1
plist 3.6.0
security 0.1.3
simctl 1.6.8
terminal-notifier 2.0.0
unicode-display_width 1.8.0
terminal-table 1.8.0
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
word_wrap 1.0.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.1
mime-types-data 3.2021.1115
mime-types 3.4.1
fastlane-plugin-aws_s3 2.0.3
fastlane-plugin-firebase_app_distribution 0.3.1
fastlane-plugin-xcconfig 2.0.0
mini_portile2 2.6.1
racc 1.6.0
nokogiri 1.12.5
nokogiri-plist 0.5.0
fastlane-plugin-xcconfig_actions 1.4.2
gems 1.2.0
google-apis-discovery_v1 0.7.0
thor 1.1.0
google-apis-generator 0.4.0
google-api-client 0.53.0
google-apis-sheets_v4 0.10.0

generated on: 2021-12-28

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 14
  • Comments: 21

Most upvoted comments

For me it was fine to login to Apple Dev console and to agree the new agreements at the account page

Just to provide some updates to whoever’s interested. We still have this issue but in our case it appears it is related to our account. I found out my company recently submitted a request with Apple to update our Legal Entity Name and instead of updating the entity, they created a second one attached to the same account and because of that we have a Tax document that we need to add but can’t because we can’t use the same Tax ID on both forms, and thus creating the issue at hand.

Our issue has been escalated with Apple for over 2 weeks and still no real help in solving it. CEO is getting involved as our app is crucial to public health security, so hoping this gets resolved soon.

Not sure if I should close this ticket since more people have the same or similar issue as their problem could be resulting from a different thing. But when this is resolved by Apple, I’ll test again and update this thread with the result.

But that’s the thing, we don’t have any pending agreement to sign, we literally released new apps and app updates today, and I’ve been able to submit builds via Transporter, it’s only the fastlane action to upload to TestFlight that is showing me errors. I have zero errors in any Apple interface.

We suffered from same issue even after agreed the recent agreement.

In our case, we are using API Key in app_store_connect_api_key to use latest_testflight_build_number in CI. I am not sure what was the problem but I revoke the current key and generate a new API key, which successfully resolved the issue