fastlane: Gym finish with error - exit code 65

New Issue Checklist

Issue Description

I have error “Exit status 65”, nothing special, I always was able to find reason of error, but not this time. No error in logs from xcodebuild/gym. Running gym almost always fails, 1 on 10/20 builds are success. Last line in gym log is:

`Touch build/App\ Name.DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/App\ Name/BuildProductsPath/Release-iphoneos/App\ Name.app.dSYM
    cd /Users/pawel/Documents/Projects/Project
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/(User)/.rvm/gems/ruby-2.4.0/bin:/Users/(User)/.rvm/gems/ruby-2.4.0@global/bin:/Users/(User)/.rvm/rubies/ruby-2.4.0/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/(User)/.rvm/bin"
    /usr/bin/touch -c /Users/(User)/Documents/Projects/Project/build/App\
Name.DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/App\ Name/BuildProductsPath/Release-iphoneos/App\ Name.app.dSYM`

Lasts part of output from lane:

▸ Running script 'Run Script'
▸ Running script '[CP] Embed Pods Frameworks'
▸ Running script '[CP] Copy Pods Resources'
▸ Running script 'SafeDK'
▸ Copying build/Appname.DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Appname/BuildProductsPath/Release-iphoneos/Appname NSE.appex
▸ Running script 'Carthage'
▸ Touching Appname.app
▸ Signing build/Appname.DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Appname/InstallationBuildProductsLocation/Applications/Appname.app
▸ Touching Appname.app.dSYM
** ARCHIVE FAILED **
ERROR [2018-03-22 13:01:56.80]: Exit status: 65
INFO [2018-03-22 13:01:56.81]: 
WARN [2018-03-22 13:01:56.81]: Maybe the error shown is caused by using the wrong version of Xcode
WARN [2018-03-22 13:01:56.81]: Found multiple versions of Xcode in '/Applications/'
WARN [2018-03-22 13:01:56.81]: Make sure you selected the right version for your project
WARN [2018-03-22 13:01:56.82]: This build process was executed using '/Applications/Xcode.app'
WARN [2018-03-22 13:01:56.82]: If you want to update your Xcode path, either
INFO [2018-03-22 13:01:56.82]: 
INFO [2018-03-22 13:01:56.82]: - Specify the Xcode version in your Fastfile
INFO [2018-03-22 13:01:56.82]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
INFO [2018-03-22 13:01:56.82]: 
INFO [2018-03-22 13:01:56.82]: - Specify an absolute path to your Xcode installation in your Fastfile
INFO [2018-03-22 13:01:56.82]: ▸ xcode_select "/Applications/Xcode8.app"
INFO [2018-03-22 13:01:56.82]: 
INFO [2018-03-22 13:01:56.82]: - Manually update the path using
INFO [2018-03-22 13:01:56.82]: ▸ sudo xcode-select -s /Applications/Xcode.app
INFO [2018-03-22 13:01:56.82]: 

Environment

✅ fastlane environment ✅

Stack

Key Value
OS 10.13.3
Ruby 2.4.0
Bundler? false
Git git version 2.14.3 (Apple Git-98)
Installation Source ~/.rvm/gems/ruby-2.4.0/bin/fastlane
Host Mac OS X 10.13.3 (17D47)
Ruby Lib Dir ~/.rvm/rubies/ruby-2.4.0/lib
OpenSSL Version OpenSSL 1.1.0e 16 Feb 2017
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 9.2

System Locale

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

fastlane files:

`./fastlane/Fastfile`

fastlane_version "2.60"
# Custom functions
require "./loaders.rb"
require "./filters.rb"
# This is the minimum version number required.
import "./Match"
import "./Tools"
import "./Metrics"
# Imports above

# FASTLANE JOBS

default_platform :ios

platform :ios do

  desc "Run metrics for app. @options: appname - name of app to run"
  lane :metrics do |options|
    appname = options[:appname]
    scheme = filter_by_scheme_name(appname).first
    isOclint = scheme["isOclint"]
    isSwiftlint = scheme["isSwiftlint"]
    isCarthage = scheme["isCarthage"]
  	isCocoapods = scheme["isCocoapods"]

    make(isCarthage: isCarthage,
  		   isCocoapods: isCocoapods)

    run_metrics(scheme: scheme,
    			 isOclint: isOclint,
            	        isSwiftlint: isSwiftlint)
  end
  desc "Release for internal tests using fabric. @options: appname - name of app to build"
  lane :fabric do |options|
  	
  	appname = options[:appname]
  	config = load_config()
  	scheme = filter_by_scheme_name(appname).first
  	scheme_name = scheme["scheme"]
  	workspace_name = scheme["xcworkspace"]
  	xcproj_name = scheme["xcproj"]
  	default_config = config["default_config"]
  	crashlytics_path = config["crashlytics_path"]
  	isCarthage = scheme["isCarthage"]
  	isCocoapods = scheme["isCocoapods"]

  	make(isCarthage: isCarthage,
  		 isCocoapods: isCocoapods)

  	# download_profiles_read_only - dsiabled for now

  	run_fabric(scheme: scheme_name,
  			   config: default_config,
  			   xcworkspace: workspace_name,
  			   xcproj: xcproj_name,
  			   crashlytics_path: crashlytics_path)
  end

  desc "Build app lane. @options: appname - name of app to build"
  lane :build do |options|

  	  appname = options[:appname]
  	  config = load_config()
  	  scheme = filter_by_scheme_name(appname).first
  	  scheme_name = scheme["scheme"]
  	  workspace_name = scheme["xcworkspace"]
  	  isCarthage = scheme["isCarthage"]
  	  isCocoapods = scheme["isCocoapods"]
  	  default_config = config["default_config"]
  	  clean = true
  	  export = "ad-hoc"

	  make(isCarthage: isCarthage,
	  	   isCocoapods: isCocoapods)
      # download_profiles_read_only - dsiabled for now
      run_build(export: export,
      			workspace: workspace_name,
      			scheme: scheme_name,
      			config: default_config,
      			clean: true)
  end

  desc "Test on app. @options: appname - name of app to test"

  lane :test do |options|
  	appname = options[:appname]
  	scheme = filter_by_scheme_name(appname).first
  	isCarthage = scheme["isCarthage"]
  	isCocoapods = scheme["isCocoapods"]
  	isTestable = scheme["unit_tests"]

  	if isTestable == true
	  	make(isCarthage: isCarthage,
	 		 isCocoapods: isCocoapods)
		run_test(scheme: scheme)
  	end
  end

  # PRIVATE lanes

  private_lane :run_fabric do |options|

    scheme_name = options[:scheme]
    config =  options[:config]
    build_number = number_of_commits
    project_name = options[:xcproj]
    workspace_name = options[:xcworkspace]
    crashlytics_path = options[:crashlytics_path]
    export = "ad-hoc"
    version_number = get_version_number(xcodeproj: "#{project_name}.xcodeproj")
    git_tag = "CI/v#{version_number}/##{build_number}"

    m_build_number = "Build number: #{build_number}"
    m_build_branch = "Branch: #{git_branch}"
    m_build_commit = "Commit: #{last_git_commit[:abbreviated_commit_hash]}"
    # m_groups = ENV["CRASHLYTICS_GROUPS"]
    # m_comments = ENV["CRASHLYTICS_NOTES"]
    m_groups = "developers"
    m_comments = "Fastlane test of Fabric upload"
    
    message = [
      m_build_number,
      m_build_branch,
      m_build_commit,
      "GIT TAG: #{git_tag}",
      "Groups: #{m_groups}",
      "Release Notes: #{m_comments}"
    ]
    .join("\n")

    increment_build_number(
       build_number: build_number,
       xcodeproj: "#{project_name}.xcodeproj")

	  run_build(export: export,
	  		      workspace: workspace_name,
	  		      scheme: scheme_name,
	  		      config: config)

    crashlytics(
         crashlytics_path: "#{crashlytics_path}",
         api_token: "token",
         build_secret: "secret",
         notes: "#{message}",
         groups: m_groups)

    if !git_tag_exists(tag: git_tag)
        add_git_tag(tag: git_tag)
        push_git_tags
    end

    notifier(message: message,
             success: true)
  end

  desc "Runs all the tests"
  private_lane :run_test do |options|

  schemes = options[:scheme]
	devices = load_devices()
	schemeName = scheme["scheme"]
	scan(
	    scheme: "#{schemeName}Tests",
	    code_coverage: true,
	    clean: true,
	    skip_build: false,
	    devices: devices,
	    output_style: "basic",
	    derived_data_path: "./build/#{schemeName}.DerivedData",
	    output_directory: "./build/#{schemeName}.reports/")
  end

  # Fastlane cycles

  before_all do
      unlock_keychain(path: "login.keychain-db",
                      add_to_search_list: :replace,
                      password: "Password")
      sh("rm -rf /build")
  end

  after_all do |lane|
  	  appname = ENV["APPNAME"]
           notifier(message: "CI build for #{appname} completed",
            success: true)
  end

  # Error handling

  error do |lane, exception, options|
      message = [
      "Exception: #{exception}",
      "Options: #{options}",
      "On Lane: #{lane}"
      ]
      .join("\n")

    notifier(message: message,
             success: false)
  end
end

desc "Build lane"
  lane :run_build do |options|

      export = options[:export]
      workspace = options[:workspace]
      scheme = options[:scheme]
      config = options[:config]

      if options[:clean] == true
	      run_clean(scheme: scheme,
	                xcworkspace: workspace)
      end

      gym(workspace: "#{workspace}.xcworkspace",
          scheme: scheme,
          configuration: config,
          include_bitcode: false,
          export_method: export,
          clean: true,
          xcpretty_report_json: "./compile_commands.json",
          derived_data_path: "./build/#{scheme}.DerivedData",
          output_name: "#{scheme}.ipa")
  end

  private_lane :run_clean do |options|
        workspace = options[:xcworkspace]
        scheme = options[:scheme]

        xcclean(workspace: "#{workspace}.xcworkspace",
                scheme: scheme)

        clear_derived_data
  end

No Appfile found

fastlane gems

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

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.1.2
slack-notifier 2.3.2
atomos 0.1.2
claide 1.0.2
colored2 3.1.2
nanaimo 0.2.3
xcodeproj 1.5.6
multipart-post 2.0.0
word_wrap 1.0.0
public_suffix 2.0.5
tty-screen 0.6.4
tty-cursor 0.5.0
tty-spinner 0.8.0
babosa 1.0.2
colored 1.2
commander-fastlane 4.4.6
unf 0.1.4
domain_name 0.5.20170404
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
gh_inspector 1.1.3
mini_magick 4.5.1
multi_xml 0.6.0
rubyzip 1.2.1
security 0.1.3
naturally 2.1.0
simctl 1.6.2
declarative-option 0.1.0
representable 3.0.4
mime-types-data 3.2016.0521
mime-types 3.1
httpclient 2.8.3
google-api-client 0.13.6
openssl 2.0.4
highline 1.7.10
io-console 0.4.6
excon 0.61.0
CFPropertyList 2.3.6
mini_portile2 2.3.0
nokogiri 1.8.2
plist 3.4.0
faraday 0.14.0
faraday_middleware 0.12.2
os 0.9.6
googleauth 0.6.2
signet 0.8.1
fastimage 2.1.1
json 2.1.0
bundler 1.16.0
terminal-table 1.8.0
unicode-display_width 1.3.0

generated on: 2018-03-22

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

I have exactly same issue here. I have been trying to finish gym action for 2 days and exact same problem happenes. It exits with 65 code when touching .dSYM file.

My xcodebuild log shows no errors, nothing wrong. Xcode build and archives just fine. I am signing properly with match

Fastlane 2.99.0

Edit:

It turned out I had difference between archiving with xcodebuild terminal command and Xcode IDE Archiving.

Exactly my hidden errors: https://stackoverflow.com/questions/38920641/xcodebuild-archive-fails-xcode-archive-succeeds

I found these errors with Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure in my Xcode logs and they were the cause. I fixed them and fastlane works fine!