fastlane: Export error, exportOptionsPlist error, Exit code 70 on Travis

🔑

New Issue Checklist

Issue Description

gym is failing with the following error:

xcodebuild -exportArchive -exportOptionsPlist /var/folders/17/5mc7816d3mndxjqgplq6057w0000gn/T/gym_config20190522-7155-lu6ej8.plist -archivePath '/Users/travis/Library/Developer/Xcode/Archives/2019-05-22/Emission 2019-05-22 18.38.59.xcarchive' -exportPath /var/folders/17/5mc7816d3mndxjqgplq6057w0000gn/T/gym_output20190522-7155-465ami
2019-05-22 18:46:43.155 xcodebuild[12139:24336] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/17/5mc7816d3mndxjqgplq6057w0000gn/T/Emission_2019-05-22_18-46-43.154.xcdistributionlogs'.
2019-05-22 18:46:43.266 xcodebuild[12139:24336] [MT] IDEDistributionMethodManager: -[IDEDistributionMethodManager orderedDistributionMethodsForTask:archive:]: Error = Error Domain=IDEDistributionMethodManagerErrorDomain Code=2 "Unknown Distribution Error" UserInfo={NSLocalizedDescription=Unknown Distribution Error}
error: exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found app-store

I can run the command locally and it works fine. It lists Exit code 70. The archive appears to succeed, but exporting it fails.

More error details
[18:46:32]: â–¸ Archive Succeeded
[18:46:33]: Generated plist file with the following values:
[18:46:33]: â–¸ -----------------------------------------
[18:46:33]: â–¸ {
[18:46:33]: â–¸   "provisioningProfiles": {
[18:46:33]: â–¸     "net.artsy.Emission": "match AppStore net.artsy.Emission"
[18:46:33]: â–¸   },
[18:46:33]: â–¸   "method": "app-store",
[18:46:33]: â–¸   "signingStyle": "manual"
[18:46:33]: â–¸ }
[18:46:33]: â–¸ -----------------------------------------
RVM detected, forcing to use system ruby
Now using system ruby.
** Updating RubyGems to the latest compatible version for security reasons. **
** If you need an older version, you can downgrade with 'gem update --system OLD_VERSION'. **
+xcodebuild -exportArchive -exportOptionsPlist /var/folders/17/5mc7816d3mndxjqgplq6057w0000gn/T/gym_config20190522-7155-lu6ej8.plist -archivePath '/Users/travis/Library/Developer/Xcode/Archives/2019-05-22/Emission 2019-05-22 18.38.59.xcarchive' -exportPath /var/folders/17/5mc7816d3mndxjqgplq6057w0000gn/T/gym_output20190522-7155-465ami
2019-05-22 18:46:43.155 xcodebuild[12139:24336] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/17/5mc7816d3mndxjqgplq6057w0000gn/T/Emission_2019-05-22_18-46-43.154.xcdistributionlogs'.
2019-05-22 18:46:43.266 xcodebuild[12139:24336] [MT] IDEDistributionMethodManager: -[IDEDistributionMethodManager orderedDistributionMethodsForTask:archive:]: Error = Error Domain=IDEDistributionMethodManagerErrorDomain Code=2 "Unknown Distribution Error" UserInfo={NSLocalizedDescription=Unknown Distribution Error}
error: exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found app-store
Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key 'method': expected one of {}, but found app-store" UserInfo={NSLocalizedDescription=exportOptionsPlist error for key 'method': expected one of {}, but found app-store}
** EXPORT FAILED **
[18:46:43]: Exit status: 70

The CI build is open source, so you can see the failure here: https://travis-ci.org/artsy/emission-nebula/builds/535885073#L3253 (Note that we attempt the build twice, so Travis lists that build as “cancelled”, though it would’ve failed the second time too.)

I’ve looked around the internet and can’t find anyone else with this problem, Fastlane or otherwise. Any help would be appreciated.

Command executed

bundle exec fastlane ci_deploy

Complete output when running fastlane, including the stack trace and command used

You can see the raw build log here: https://api.travis-ci.org/v3/job/535885074/log.txt

Environment

âś… fastlane environment âś…

Stack

Key Value
OS 10.14.4
Ruby 2.3.7
Bundler? true
Git git version 2.21.0
Installation Source /usr/local/bin/fastlane
Host Mac OS X 10.14.4 (18E226)
Ruby Lib Dir /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
OpenSSL Version LibreSSL 2.6.5
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode-10.2.1.app/Contents/Developer/
Xcode Version 10.2.1

System Locale

Variable Value
LANG en_US.UTF-8 âś…
LC_ALL en_US.UTF-8 âś…
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
# This is documented in the Artsy Blog:
# http://artsy.github.io/blog/2017/07/31/fastlane-travis-weekly-deploys/
require 'cgi'
# Clones Emission and sets it up
lane :setup do
  Dir.chdir("..") do
    sh "rm -rf emission" if Dir.exist? "emission"
    sh "git clone https://github.com/artsy/emission.git"
    Dir.chdir("emission") do
      sh ". ~/.nvm/nvm.sh && nvm use && npm install yarn --global"
      sh "yarn install"
      sh "yarn relay"
      sh "yarn bundle-with-storybooks"
    end
    Dir.chdir("emission/Example") do
      if ENV['ARTSY_API_KEY'] && ENV['ARTSY_API_SECRET'] && ENV['STRIPE_PUBLISHABLE_KEY']
        sh "bundle exec pod keys set ArtsyAPIClientKey $ARTSY_API_KEY"
        sh "bundle exec pod keys set ArtsyAPIClientSecret $ARTSY_API_SECRET"
        sh "bundle exec pod keys set StripePublishableKey $STRIPE_PUBLISHABLE_KEY"
      end
      sh "bundle exec pod repo update"
      # Run `pod install` twice, otherwise pre-patch is not applied and build will fail with CocoaPods-Keys problems.
      sh "bundle exec pod install"
      sh "bundle exec pod install"
    end
    stamp_plist
  end
end
# Lets the CI run a bunch of jobs, and share ENV vars between them
lane :ci_deploy do
  setup_signing
  stamp_plist
  ship
end
# The main job for Fastlane in this repo, you can run this on your computer
# You can run it via `bundle exec fastlane ship`
lane :ship do
  # We were having issues with building an a few folders deep.
  # The /Pods bit is because we can rely on it being there, see
  # this link: https://docs.fastlane.tools/advanced/#directory-behavior
  #
  Dir.chdir("../emission/Example/Pods") do
    disable_automatic_code_signing(
      path: 'Emission.xcodeproj',
      team_id: '23KMWZ572J',
      targets: ['Emission'],
      profile_name: 'match AppStore net.artsy.Emission'
    )
    begin
      gym(workspace: "Emission.xcworkspace",
        configuration: "Deploy",
        scheme: "Emission",
        silent: true, # Travis cuts off our logs because they're too long.
        export_method: "app-store",
        )
      sh "set +e" # Workaround for Travis bug. See https://github.com/travis-ci/travis-ci/issues/6522
      # Right now the second build of the entire CI seems to work,
      # so maybe we can shortcut that by doing it inside the one CI run.
    rescue => exception
      gym(workspace: "Emission.xcworkspace",
        configuration: "Deploy",
        scheme: "Emission",
        silent: true,
        export_method: "app-store",
      )
      sh "set +e" # Workaround for Travis bug. See https://github.com/travis-ci/travis-ci/issues/6522
    end
  end
  # Get the current master changes from the CHANGELOG, filtering out HTML comments, for sending to Testflight
  changelog = "../emission/CHANGELOG.md"
  upcoming_release_notes = CGI.escape_html(File.read(changelog).gsub(/<![^>]*>/, '').split("\n### ")[1])
  # Ship to testflight
  pilot(changelog: upcoming_release_notes,
    itc_provider: 'ArtsyInc',
    distribute_external: true,
    groups: ['Artsy Collaborators'])
  # Log into iTunes connect, get the latest version of the app we shipped, and how many builds we've sent
  client = Spaceship::Tunes.login(ENV["FASTLANE_USERNAME"], ENV["FASTLANE_PASSWORD"])
  client.team_id = "479887"
  app = Spaceship::Tunes::Application.find("net.artsy.Emission")
  latest_version = app.build_trains.versions.sort.last
  # Do a tag, we use a http git remote so we can have push access
  # as the default remote for travis is read-only. This needs to be
  # inside the emission repo, instead of our own.
  Dir.chdir("../emission/Example/") do
    tag = "deploy-#{latest_version}-#{Time.new.strftime("%Y.%m.%d.%H")}"
    add_git_tag(tag: tag)
    if ENV["GITHUB_SUBMODULES_USER"]
      writable_remote = "https://#{ENV['GITHUB_SUBMODULES_USER']}@github.com/artsy/emission.git"
      sh "git remote add http #{writable_remote}"
    else
      sh "git remote add http https://github.com/artsy/emission.git"
    end
    push_git_tags(remote: "http")
  end
  slack message: "There is a new Emission beta available on Testflight.",
        payload: {
          "Version" => latest_version,
          "What's new" => upcoming_release_notes
        },
        default_payloads: []
end
# In case you need to update the signing profiles for this app
lane :update_signing do
  match(type: "appstore")
end
# Used by CI, will not sneakily update (the CI only has read-only access to the repo anyway)
lane :setup_signing do
  setup_travis
  match(type: "appstore")
end
# Minor plist modifications
lane :stamp_plist do
  plist = "emission/Example/Emission/Info.plist"
  # Increment build number to current date
  build_number = Time.new.strftime("%Y.%m.%d.%H")
  `/usr/libexec/PlistBuddy -c "Set CFBundleVersion #{build_number}" "#{plist}"`
end
# Mainly so we don't forget to include these vars in the future
lane :validate_env_vars do
  unless ENV["FASTLANE_USERNAME"] && ENV["FASTLANE_PASSWORD"] && ENV["MATCH_PASSWORD"]
    raise "You need to set FASTLANE_USERNAME, FASTLANE_PASSWORD and MATCH_PASSWORD in your environment"
  end
  unless ENV["SLACK_URL"]
    raise "You need to set SLACK_URL (#{ENV['SLACK_URL']}) in your environment."
  end
end
# If the weekly task fails, then ship a message, a success would also send
error do |_, exception|
  slack(message: "Error Deploying Emission: #{exception}",
        success: false,
        payload: { Output: exception.to_s })
end
`./fastlane/Appfile`
app_identifier "net.artsy.Emission"
apple_id "[secure]"
team_name "Art.sy Inc."
team_id "23KMWZ572J"
itc_team_id '479887'

fastlane gems

Gem Version Update-Status
fastlane 2.123.0 âś… Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.0.0
bundler 2.0.1
io-console 0.4.5
CFPropertyList 3.0.0
ZenTest 4.11.2
RubyInline 3.12.4
concurrent-ruby 1.1.5
i18n 0.9.5
minitest 5.11.3
thread_safe 0.3.6
tzinfo 1.2.5
activesupport 4.2.11.1
public_suffix 2.0.5
addressable 2.6.0
atomos 0.1.3
babosa 1.0.2
claide 1.0.2
fuzzy_match 2.0.4
nap 1.1.0
cocoapods-core 1.6.1
cocoapods-deintegrate 1.0.3
cocoapods-downloader 1.2.2
cocoapods-plugins 1.0.0
cocoapods-search 1.0.0
cocoapods-stats 1.1.0
netrc 0.11.0
cocoapods-trunk 1.3.1
cocoapods-try 1.1.0
colored2 3.1.2
escape 0.0.4
fourflusher 2.2.0
gh_inspector 1.1.3
molinillo 0.6.6
ruby-macho 1.4.0
nanaimo 0.2.6
xcodeproj 1.9.0
cocoapods 1.6.1
cocoapods-fix-react-native 2019.03.19.11
dotenv 2.7.2
osx_keychain 1.0.2
cocoapods-keys 2.1.0
coderay 1.1.2
colored 1.2
highline 1.7.10
commander-fastlane 4.4.6
declarative 0.0.10
declarative-option 0.1.0
digest-crc 0.4.1
unf_ext 0.0.7.6
unf 0.1.4
domain_name 0.5.20180417
emoji_regex 1.0.1
excon 0.64.0
multipart-post 2.0.0
faraday 0.15.4
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
faraday_middleware 0.13.1
fastimage 2.1.5
jwt 2.1.0
memoist 0.16.0
multi_json 1.13.1
os 1.0.1
signet 0.11.0
googleauth 0.6.7
httpclient 2.8.3
mime-types-data 3.2019.0331
mime-types 3.2.2
uber 0.1.0
representable 3.0.4
retriable 3.1.2
google-api-client 0.23.9
google-cloud-env 1.0.5
google-cloud-core 1.3.0
google-cloud-storage 1.16.0
json 2.2.0
mini_magick 4.5.1
multi_xml 0.6.0
plist 3.5.0
rubyzip 1.2.2
security 0.1.3
naturally 2.2.0
simctl 1.6.5
slack-notifier 2.3.2
terminal-notifier 2.0.0
unicode-display_width 1.6.0
terminal-table 1.8.0
tty-screen 0.7.0
tty-cursor 0.6.1
tty-spinner 0.9.0
word_wrap 1.0.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.0
method_source 0.9.2
pry 0.12.2
*generated on:* **2019-05-22**

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 41 (26 by maintainers)

Most upvoted comments

Hi! I’d like to share my experience with this kind of problem with my project. It might be one of the reason mentioned, so please double check these cases:

  • make sure that Skip Install value is setup properly (should be NO for app targets and YES otherwise: test targets, framework targets). Links about it somewhere in this topic.
  • you have latests tools installed.

In my project we use different schemes to build app for different environments. We produce these schemes by duplicating default and fine tune it after. For some reason in new scheme in Build setup we’ve got two targets to build: default and copy of it. copy_scheme_setup

Archiving with this setup cause to produce “Generic Archive” which is failed to export with error: error: exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found ad-hoc This is understandable because archive contained two apps and it is not clear how to export this to IPA. generic_archive

Fix is simple: just remove unnecessary target from Build setup for one of the schemes (or at least uncheck it from archiving).

Hope this help someone âś‹

This is still happening as of this morning, but has fallen off my radar as a priority. This will be the last time that I tell @fastlane-bot to keep the issue open, so if someone else care about the bug, they’ll need to take over.

Let me know if I can provide more context. Thanks again everyone 🙇‍♂️

No, you’re good here - the bot just doesn’t know better. I hope we will find time to look into this deeper soon.

Yeah, definitely – I’ve looked into those resources to try to pinpoint the issue. Because I’m able to intermittently reproduce the empty archive problem on my machine locally, using xcodebuild, I don’t think it has to do with the system Ruby. I’ve only seen the invalid archives happen from xcodebuild and not from Xcode itself. I’ll keep at it 👍