fastlane: "Check Dependencies" error when building with Gym : Gym bug? Xcode 8? Travis? Human error?

New Issue Checklist

Issue Description

When building on Travis CI, I continue to get “check dependencies” errors when doing builds for Fabric Beta distribution (Enterprise builds), with 2 of the 8 dependencies reporting a problem. The problem appears to be that manual code signing choices, for example a scheme which uses “iOS Distribution” identity with “Release” configuration", is not being respected by some subprojects (which try to sign against “iOS Development” identity, despite explicitly setting to “iOS Distribution” in the main project)

Using @tmm1 's advice, I spit out the gym log and finally see something that explains the situation (see “output” below). Basically I get two errors, depending on if I explicitly set codesigning_identity in Gym. If I do not set it, gym’s log says it can’t find a certificate for iOS Developer on this scheme, which is true. It doesn’t exist and it never existed. If I do set it, I’m told (for example) AdjustSdk has conflicting provisioning settings. AdjustSdk is automatically signed, but code signing identity <<REDACTED>> has been manually specified.

Running locally (running the same Fastlane lane “do_the_beta”) I do not have this mysterious certificate in my local keychain, but fastlane builds for Fabric Beta without incident locally. I don’t think that certificate has ever existed before for us. The BETA scheme with RELEASE configuration is set to, and should be using, “iOS Distribution,” not “iOS Development” when doing our enterprise builds for Fabric Beta.

Our project contains two submodules, but most dependencies are brought into the project via git subtree. It is my understanding that these subprojects can be left as-is with “automatic codesigning” and should inherit from the parent project.

So, Adjust and iOS Reachability are trying to sign with “iOS Development” (which is the default build setting for these, and really all, of the subprojects imported), but none of the other projects in the subtree express this problem:

  • GRMustache
  • SocketRocket
  • Some private SDKs
  • MBProgressHUD

I’m having a really difficult time understanding how fastlane + gym + Xcode 8 + subproject dependencies + manual code sign works together, and what needs to be set in what way. Every documentation I read seems to assume a very simple, “set the main project targets to manual code signing”. I assume this means I should be able to forget about subprojects and let the build system handle those, and yet here we are.

I’ve looked at the Build Settings for all of the subprojects. They are, indeed, set to iOS Developer in the Code Signing Identify, but this is just the default for all of them and was not altered by our team. This just “how things have always been”. If the main project is set to manual code signing, and these subprojects are set to “Automatic”, should that not override any other legacy settings?

Or, and this would really suck, do we have to manually manage code signing for all subprojects from now on? That wouldn’t make much sense to me, because code signing identities are relative to our schemes, and our schemes are unique to our project. Subprojects would have no knowledge of that.

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

What Gym Tried to Run

+----------------------+-------------------------+
|             Summary for gym 1.9.0              |
+----------------------+-------------------------+
| scheme               | <<REDACTED>> Beta          |
| configuration        | Release                 |
| sdk                  | iphoneos                |
| use_legacy_build_api | true                    |
| workspace            | ./<<REDACTED>>.xcworkspace |
| destination          | generic/platform=iOS    |
| output_name          | <<REDACTED>>               |
| clean                | false                   |
| output_directory     | .                       |
| silent               | false                   |
| buildlog_path        | ~/Library/Logs/gym      |
+----------------------+-------------------------+
+------------------------------------------------------------------------------------------------------------------+----------------------+
|                                                         Generated Build Command                                                         |
+------------------------------------------------------------------------------------------------------------------+----------------------+
| Option                                                                                                           | Value                |
+------------------------------------------------------------------------------------------------------------------+----------------------+
| set -o pipefail &&                                                                                               |                      |
| xcodebuild                                                                                                       |                      |
| -workspace ./<<REDACTED>>.xcworkspace                                                                               |                      |
| -scheme <<REDACTED>>\ Beta                                                                                          |                      |
| -configuration                                                                                                   | Release              |
| -sdk                                                                                                             | iphoneos             |
| -destination                                                                                                     | generic/platform=iOS |
| -archivePath /Users/travis/Library/Developer/Xcode/Archives/2016-09-21/<<REDACTED>>\ 2016-09-21\ 02.21.20.xcarchive |                      |
| archive                                                                                                          |                      |
| | tee /Users/travis/Library/Logs/gym/<<REDACTED>>-<<REDACTED>>\ Beta.log                                                |                      |
| | xcpretty                                                                                                        |                      |
+------------------------------------------------------------------------------------------------------------------+----------------------+
INFO [2016-09-21 02:21:20.19]: $ set -o pipefail && xcodebuild -workspace ./<<REDACTED>>.xcworkspace -scheme <<REDACTED>>\ Beta -configuration 'Release' -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath /Users/travis/Library/Developer/Xcode/Archives/2016-09-21/<<REDACTED>>\ 2016-09-21\ 02.21.20.xcarchive archive | tee /Users/travis/Library/Logs/gym/<<REDACTED>>-<<REDACTED>>\ Beta.log | xcpretty

Console Output

â–¸ Building Framework/iOSReachability [Release]
â–¸ Check Dependencies
â–¸ Building Adjust/AdjustSdk [Release]
â–¸ Check Dependencies
** ARCHIVE FAILED **
The following build commands failed:
Check dependencies
Check dependencies
(2 failures)
ERROR [2016-09-21 01:43:12.28]: Exit status: 65
WARN [2016-09-21 01:43:12.29]: Variable Dump:
INFO [2016-09-21 01:43:12.29]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios do_the_build"}
ERROR [2016-09-21 01:43:12.29]: Error building the application - see the log above

~/Library/Logs/gym/<<REDACTED>>.log

If I do not specify a specific codesigning_identity in gym:

Build settings from command line:
    SDKROOT = iphoneos10.0
=== BUILD TARGET iOSReachability OF PROJECT Framework WITH CONFIGURATION Release ===
Check dependencies
No signing certificate "iOS Development" found:  No "iOS Development" signing certificate matching team ID "9WS<<REDACTED>>" with a private key was found.
=== BUILD TARGET AdjustSdk OF PROJECT Adjust WITH CONFIGURATION Release ===
Check dependencies
No signing certificate "iOS Development" found:  No "iOS Development" signing certificate matching team ID "9WS<<REDACTED>>" with a private key was found.

If I do specify a specific codesigning_identity in gym

Build settings from command line:
    CODE_SIGN_IDENTITY = <<REDACTED>>
    SDKROOT = iphoneos10.0
=== BUILD TARGET AdjustSdk OF PROJECT Adjust WITH CONFIGURATION Release ===
Check dependencies
AdjustSdk has conflicting provisioning settings. AdjustSdk is automatically signed, but code signing identity <<REDACTED>> has been manually specified. Set the code signing identity value to "iPhone Developer" in the build settings editor, or switch to manual signing in the project editor.
=== BUILD TARGET iOSReachability OF PROJECT Framework WITH CONFIGURATION Release ===
Check dependencies
iOSReachability has conflicting provisioning settings. iOSReachability is automatically signed, but code signing identity <<REDACTED>> has been manually specified. Set the code signing identity value to "iPhone Developer" in the build settings editor, or switch to manual signing in the project editor.

Code signing identity settings for the above two subprojects have been verified to match those of the other subprojects, which return no such error.

Configuration Files

Travis yml

before_install:
    - rvm get stable --auto-dotfiles
    - rvm use ruby-2.0.0-p648
    - gem install scan -v '>=0.12.1'
    - gem install gym -v '>=1.9.0'
    - gem install fastlane --no-rdoc --no-ri
    - gem cleanup
    - sed -i -e "s/https:\/\/github.com\//git@github.com:/" .gitmodules
    - git submodule update --init --recursive
    - fastlane setup_ci

before_script:
    - open -b com.apple.iphonesimulator

script:
    - fastlane run_test
    - fastlane do_the_build --verbose

Fastfile:

# Customise this file, documentation can be found here:
# https://github.com/KrauseFx/fastlane/tree/master/docs
# All available actions: https://github.com/KrauseFx/fastlane/blob/master/docs/Actions.md

#define some environment variables; remap Travis environment vars to Fastlane equivalents
<<ENVIRONMENT VARIABLES REDACTED>>

default_platform :ios
platform :ios do
    # You can define as many lanes as you want

    desc "Called before EVERY lane, so only use this for important cleanup/sanity-check routines"
    before_all do
        #currently not in use
    end

    desc "Setup keychain, install certificates and provisioning profiles"
    lane :setup_ci do

        #update plist file to reflect the commit used to make this build
        set_info_plist_value(path: INFO_PLIST_PATH, key: 'SNBuildCommitIdentifier', value: CURRENT_COMMIT)

        #create a keychain; KEYCHAIN_PASSWORD is throwaway
        #only used because create_keychain needs one; after this it is never referenced again
        create_keychain(name: BUILD_KEYCHAIN,
            default_keychain: true,
            password: ENV['KEYCHAIN_PASSWORD'],
            unlock: true,
            timeout: 3600,
            lock_when_sleeps: true
        )

        # Add certificates to keychain
        import_certificate(keychain_name: BUILD_KEYCHAIN, certificate_path: "#{CERTS_DIR_PATH}/apple.cer")
        import_certificate(keychain_name: BUILD_KEYCHAIN, certificate_path: "#{CERTS_DIR_PATH}/dist.cer")
        import_certificate(keychain_name: BUILD_KEYCHAIN, certificate_path: "#{CERTS_DIR_PATH}/dist.p12", certificate_password: ENV['BETA_CERTIFICATE_PASSWORD'])
        import_certificate(keychain_name: BUILD_KEYCHAIN, certificate_path: "#{CERTS_DIR_PATH}/App_Store_Certificate.p12", certificate_password: ENV['APPSTORE_CERTIFICATE_PASSWORD'])

        # Copy all provisioning profiles to Xcode default directory (could be replaced with "sigh" command, maybe?)
        sh("mkdir -p #{PROFILE_PATH}")
        sh("cp #{PROFILE_DIR_PATH}/* #{PROFILE_PATH}")
        sh("ls -l #{PROFILE_PATH}")
    end

    lane :run_test do
        scan(scheme: SCHEME_BETA,
            configuration: 'Debug',
            sdk: 'iphonesimulator10.0',
            device: 'iPhone 6'
        )
    end

    desc "Build and upload to Crashlytics Beta" 
    lane :do_the_beta do |options|

        # set project team to enterprise account
        update_project_team(path: PROJECT_FILE_PATH, teamid: TEAM_ID_ENTERPRISE)
        set_info_plist_value(path: INFO_PLIST_PATH, key: 'SNBuildCommitIdentifier', value: CURRENT_COMMIT)

        # set default release notes and revision string
        release_notes = Actions.sh('git log -1').chomp
        revision = options[:build_number]
        distribution_group = FABRIC_BASIC_DISTRIBUTION_GROUP

        # set special release notes and revision for prototype and release branches
        if CURRENT_BRANCH != nil && !CURRENT_BRANCH.empty?
            if CURRENT_BRANCH.start_with?('prototype/')     
                release_notes = "**PROTOTYPE** for #{CURRENT_BRANCH}\n#{release_notes}"
                revision = "PROTO-#{CURRENT_COMMIT}"
                distribution_group = FABRIC_PROTOTYPE_DISTRIBUTION_GROUP
            elsif CURRENT_BRANCH.start_with?('release/')
                release_notes = "**RELEASE** for #{CURRENT_BRANCH}\n#{release_notes}"
                revision = "RELEASE-#{CURRENT_COMMIT}"
            end
        end

        puts release_notes

        #set build version for beta distribution ease-of-installation
        set_info_plist_value(path: INFO_PLIST_PATH, key: 'CFBundleVersion', value: revision)    

        #build the archive and ipa
        gym(scheme: SCHEME_BETA,
            configuration: 'Release',
            sdk: 'iphoneos',
            use_legacy_build_api: true
        )

        #automatically uses the ipa from gym and env vars to fill in upload credentials
        #distribute via crashlytics if it isn't a pull request
        if !pull_request?
            crashlytics(notes: release_notes, groups: [distribution_group])
        end
    end

    def pull_request?
        pr_number = ENV['TRAVIS_PULL_REQUEST']
        pr_number != nil && !pr_number.empty? && pr_number != 'false'
    end
end

Environment

Travis CI, running latest Xcode 8 GM

  • fastlane 1.103.0
  • fastlane core 0.52.0
  • Scan 0.13.0
  • Gym 1.9.0

Do you use bundler to execute fastlane (i.e. bundle exec fastlane)? No

Do you use a Ruby environment manager (e.g. chruby, rbenv, rvm)? RVM 1.27.0

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 27

Most upvoted comments

@fastlane-bot Yeah, I know it is. And the troubleshooting guide hasn’t helped me get through this yet. Thanks for the assist though, you’re doing a bang-up job 👍

@ChristopherDrum @cyupa @MarkMolina @puttin @WedgeSparda I have let the core team know about this so we can take a look. Expect an update on this thread 👍

My experience here. I used use_legacy_build_api. it failed using wrong provisioning file. So i turned off automatic signing. and manually picked provisioning file for different configuration. Then everything works perfectly fine. Tested release build with push notification.