Gym no longer signs with Xcode 8 #6055

Closed
programmin1 opened this Issue Sep 9, 2016 · 18 comments

Comments

Projects
None yet
10 participants
@programmin1

New Issue Checklist

Issue Description

In previous versions, before Xcode 8, the handy thing about Gym was that you didn't have to give it a provisioning profile in command line, it found the right one. (compared to xcodebuild command line)

Now, accoring to the release notes of Xcode 8: "Xcode 8 does not automatically copy the aps-environment entitlement from provisioning profiles at build time. This behavior is intentional. To use this entitlement, either enable Push Notifications in the project editor’s Capabilities pane, or manually add the entitlement to your entitlements file."
(https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-DontLinkElementID_49)
(I'm curious how this automatic-provisioning-and-certs would work along with fastlane, but that's probably another question for another ticket)

Furthermore you have to go in and manually uncheck "automatic", then go and choose a name of the correct provisioning profile manually in xcode, to make gym use the specific mobile provisioning profile, then Gym works.

Complete output when running fastlane, including the stack trace and command used
The following build commands failed:
Check Dependencies
(1 failure)
[16:48:20]: Exit status: 65

Environment

fastlane version (run fastlane -v): fastlane 1.99.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)? NO

@fastlane-bot

This comment has been minimized.

Show comment
Hide comment
@fastlane-bot

fastlane-bot Sep 9, 2016

It seems like this issue might be related to code signing 🚫

Have you seen our new Code Signing Troubleshooting Guide? It will help you resolve the most common code signing issues 👍

It seems like this issue might be related to code signing 🚫

Have you seen our new Code Signing Troubleshooting Guide? It will help you resolve the most common code signing issues 👍

@sahandnayebaziz

This comment has been minimized.

Show comment
Hide comment
@sahandnayebaziz

sahandnayebaziz Sep 9, 2016

I am seeing the same using the Xcode 8 GM, the Sierra GM, and Swift 2.3 syntax.

fastlane -v: fastlane 1.102.0
gym -v: gym 1.9.0

sahandnayebaziz commented Sep 9, 2016

I am seeing the same using the Xcode 8 GM, the Sierra GM, and Swift 2.3 syntax.

fastlane -v: fastlane 1.102.0
gym -v: gym 1.9.0

@programmin1

This comment has been minimized.

Show comment
Hide comment
@programmin1

programmin1 Sep 9, 2016

@sahandnayebaziz Interesting, did you find a better solution than going in to Xcode, unchecking auto, going and selecting the provisioing profile?

I was not on Swift, so I don't think that is a cause of the problem.

@sahandnayebaziz Interesting, did you find a better solution than going in to Xcode, unchecking auto, going and selecting the provisioing profile?

I was not on Swift, so I don't think that is a cause of the problem.

@sahandnayebaziz

This comment has been minimized.

Show comment
Hide comment
@sahandnayebaziz

sahandnayebaziz Sep 9, 2016

@programmin1 I tried unchecking auto and manually selecting a provisioning profile for each of my configurations, but I still can't build with fastlane. So I've been manually archiving/submitting today.

This is the error I see:

[01:32:22]: -----------------
[01:32:22]: --- Step: gym ---
[01:32:22]: -----------------
[01:32:22]: $ xcodebuild -list -workspace Breakr.xcworkspace
[01:32:23]: $ xcodebuild clean -showBuildSettings -workspace Breakr.xcworkspace -scheme Breakr

+----------------------+----------------------+
|            Summary for gym 1.9.0            |
+----------------------+----------------------+
| scheme               | Breakr               |
| workspace            | Breakr.xcworkspace   |
| configuration        | Release              |
| destination          | generic/platform=iOS |
| output_name          | Breakr               |
| clean                | false                |
| output_directory     | .                    |
| silent               | false                |
| use_legacy_build_api | false                |
| buildlog_path        | ~/Library/Logs/gym   |
+----------------------+----------------------+

[01:32:24]: $ set -o pipefail && xcodebuild -workspace Breakr.xcworkspace -scheme Breakr -configuration 'Release' -destination 'generic/platform=iOS' -archivePath /Users/sahand/Library/Developer/Xcode/Archives/2016-09-09/Breakr\ 2016-09-09\ 01.32.24.xcarchive archive | tee /Users/sahand/Library/Logs/gym/Breakr-Breakr.log | xcpretty
[01:32:25]: ▸ Building Pods/AFDateHelper [Release]
[01:32:25]: ▸ Check Dependencies
[01:32:25]: ▸ Building Pods/AWSCore [Release]
[01:32:25]: ▸ Check Dependencies
[01:32:25]: ▸ Building Pods/Alamofire [Release]
[01:32:25]: ▸ Check Dependencies
[01:32:25]: ▸ Building Pods/Dwifft [Release]
[01:32:25]: ▸ Check Dependencies
[01:32:25]: ▸ ** ARCHIVE FAILED **
[01:32:25]: ▸ The following build commands failed:
[01:32:25]: ▸ Check dependencies
[01:32:25]: ▸ Check dependencies
[01:32:25]: ▸ Check dependencies
[01:32:25]: ▸ (3 failures)
▸ Building Pods/AFDateHelper [Release]
▸ Check Dependencies
▸ Building Pods/AWSCore [Release]
▸ Check Dependencies
▸ Building Pods/Alamofire [Release]
▸ Check Dependencies
▸ Building Pods/Dwifft [Release]
▸ Check Dependencies
** ARCHIVE FAILED **


The following build commands failed:
Check dependencies
Check dependencies
Check dependencies
(3 failures)
[01:32:25]: Exit status: 65
[01:32:25]: Variable Dump:
[01:32:25]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios beta_build", :BUILD_NUMBER=>"5"}
[01:32:25]: Error building the application - see the log above

+------+-------------------------------------+-------------+
|                     fastlane summary                     |
+------+-------------------------------------+-------------+
| Step | Action                              | Time (in s) |
+------+-------------------------------------+-------------+
| 1    | Verifying required fastlane version | 0           |
| 2    | default_platform                    | 0           |
| 3    | cocoapods                           | 3           |
| 4    | increment_build_number              | 1           |
| 5    | gym                                 | 3           |
+------+-------------------------------------+-------------+

[01:32:25]: fastlane finished with errors

[!] Error building the application - see the log above

@programmin1 I tried unchecking auto and manually selecting a provisioning profile for each of my configurations, but I still can't build with fastlane. So I've been manually archiving/submitting today.

This is the error I see:

[01:32:22]: -----------------
[01:32:22]: --- Step: gym ---
[01:32:22]: -----------------
[01:32:22]: $ xcodebuild -list -workspace Breakr.xcworkspace
[01:32:23]: $ xcodebuild clean -showBuildSettings -workspace Breakr.xcworkspace -scheme Breakr

+----------------------+----------------------+
|            Summary for gym 1.9.0            |
+----------------------+----------------------+
| scheme               | Breakr               |
| workspace            | Breakr.xcworkspace   |
| configuration        | Release              |
| destination          | generic/platform=iOS |
| output_name          | Breakr               |
| clean                | false                |
| output_directory     | .                    |
| silent               | false                |
| use_legacy_build_api | false                |
| buildlog_path        | ~/Library/Logs/gym   |
+----------------------+----------------------+

[01:32:24]: $ set -o pipefail && xcodebuild -workspace Breakr.xcworkspace -scheme Breakr -configuration 'Release' -destination 'generic/platform=iOS' -archivePath /Users/sahand/Library/Developer/Xcode/Archives/2016-09-09/Breakr\ 2016-09-09\ 01.32.24.xcarchive archive | tee /Users/sahand/Library/Logs/gym/Breakr-Breakr.log | xcpretty
[01:32:25]: ▸ Building Pods/AFDateHelper [Release]
[01:32:25]: ▸ Check Dependencies
[01:32:25]: ▸ Building Pods/AWSCore [Release]
[01:32:25]: ▸ Check Dependencies
[01:32:25]: ▸ Building Pods/Alamofire [Release]
[01:32:25]: ▸ Check Dependencies
[01:32:25]: ▸ Building Pods/Dwifft [Release]
[01:32:25]: ▸ Check Dependencies
[01:32:25]: ▸ ** ARCHIVE FAILED **
[01:32:25]: ▸ The following build commands failed:
[01:32:25]: ▸ Check dependencies
[01:32:25]: ▸ Check dependencies
[01:32:25]: ▸ Check dependencies
[01:32:25]: ▸ (3 failures)
▸ Building Pods/AFDateHelper [Release]
▸ Check Dependencies
▸ Building Pods/AWSCore [Release]
▸ Check Dependencies
▸ Building Pods/Alamofire [Release]
▸ Check Dependencies
▸ Building Pods/Dwifft [Release]
▸ Check Dependencies
** ARCHIVE FAILED **


The following build commands failed:
Check dependencies
Check dependencies
Check dependencies
(3 failures)
[01:32:25]: Exit status: 65
[01:32:25]: Variable Dump:
[01:32:25]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios beta_build", :BUILD_NUMBER=>"5"}
[01:32:25]: Error building the application - see the log above

+------+-------------------------------------+-------------+
|                     fastlane summary                     |
+------+-------------------------------------+-------------+
| Step | Action                              | Time (in s) |
+------+-------------------------------------+-------------+
| 1    | Verifying required fastlane version | 0           |
| 2    | default_platform                    | 0           |
| 3    | cocoapods                           | 3           |
| 4    | increment_build_number              | 1           |
| 5    | gym                                 | 3           |
+------+-------------------------------------+-------------+

[01:32:25]: fastlane finished with errors

[!] Error building the application - see the log above
@programmin1

This comment has been minimized.

Show comment
Hide comment
@programmin1

programmin1 Sep 9, 2016

@sahandnayebaziz Are you sure it's not a problem of one of those 3 libraries? Not sure if how it links them in changes in Xcode 8. If a simple example app compiles perhaps that problem should be a different issue.

The natural next question on the provisioning profile problem would be, is there a tool in Fastlane that lists all the mobileprovisions loaded on the machine, so you can set the PROVISIONING_PROFILE and PROVISIONING_PROFILE_SPECIFIER strings in the project.pbxproj without needing "automatic" mode?

programmin1 commented Sep 9, 2016

@sahandnayebaziz Are you sure it's not a problem of one of those 3 libraries? Not sure if how it links them in changes in Xcode 8. If a simple example app compiles perhaps that problem should be a different issue.

The natural next question on the provisioning profile problem would be, is there a tool in Fastlane that lists all the mobileprovisions loaded on the machine, so you can set the PROVISIONING_PROFILE and PROVISIONING_PROFILE_SPECIFIER strings in the project.pbxproj without needing "automatic" mode?

@sahandnayebaziz

This comment has been minimized.

Show comment
Hide comment
@sahandnayebaziz

sahandnayebaziz Sep 9, 2016

@programmin1 True! My problem could be different. I saw your issue reporting the same exit status on Xcode 8 and thought it'd be worth adding my experience. I'll step aside in this thread!

@programmin1 True! My problem could be different. I saw your issue reporting the same exit status on Xcode 8 and thought it'd be worth adding my experience. I'll step aside in this thread!

@newmarcel

This comment has been minimized.

Show comment
Hide comment
@newmarcel

newmarcel Sep 9, 2016

I had the same problem, and I could resolve it by leaving out the --codesigning_identity parameter and prefix the gym command with PROVISIONING_PROFILE_SPECIFIER in CI without changing to manual signing:

PROVISIONING_PROFILE_SPECIFIER="Team/1234" gym --clean …

It works for my setup at least 😉

I had the same problem, and I could resolve it by leaving out the --codesigning_identity parameter and prefix the gym command with PROVISIONING_PROFILE_SPECIFIER in CI without changing to manual signing:

PROVISIONING_PROFILE_SPECIFIER="Team/1234" gym --clean …

It works for my setup at least 😉

@mfurtak mfurtak added the tool: gym label Sep 9, 2016

@sahandnayebaziz

This comment has been minimized.

Show comment
Hide comment
@sahandnayebaziz

sahandnayebaziz Sep 9, 2016

thank you @newmarcel 😊 That didn't work for me, but for anyone else that has my problem, specifying the 2.3 toolchain and use_legacy_build_api when building 2.3 fixed it!

gym(
scheme: "Breakr", 
workspace: "Breakr.xcworkspace", 
configuration: "Release",
toolchain: "com.apple.dt.toolchain.Swift_2_3", 
use_legacy_build_api: true
)

thank you @newmarcel 😊 That didn't work for me, but for anyone else that has my problem, specifying the 2.3 toolchain and use_legacy_build_api when building 2.3 fixed it!

gym(
scheme: "Breakr", 
workspace: "Breakr.xcworkspace", 
configuration: "Release",
toolchain: "com.apple.dt.toolchain.Swift_2_3", 
use_legacy_build_api: true
)
@programmin1

This comment has been minimized.

Show comment
Hide comment
@programmin1

programmin1 Sep 10, 2016

It appears fastlane wasn't the problem, it was Xcode 8. Setting all the code signing settings to "Distribution", which worked before, breaks.

If you uncheck the automatic in general settings, then check it again, it sets the correct settings, 2 "iOS Distribution", for code signing, and 2 "iOS Developer" under "Any iOS SDK", in the pbxproj file and in Xcode project build settings.

It appears fastlane wasn't the problem, it was Xcode 8. Setting all the code signing settings to "Distribution", which worked before, breaks.

If you uncheck the automatic in general settings, then check it again, it sets the correct settings, 2 "iOS Distribution", for code signing, and 2 "iOS Developer" under "Any iOS SDK", in the pbxproj file and in Xcode project build settings.

@rodriguv

This comment has been minimized.

Show comment
Hide comment
@rodriguv

rodriguv Sep 23, 2016

@newmarcel Could you paste that section of the fastfile where you added that line inlcuding the gym step so I can take a look? Just curious to how you set it up exactly. Thanks!

@newmarcel Could you paste that section of the fastfile where you added that line inlcuding the gym step so I can take a look? Just curious to how you set it up exactly. Thanks!

@newmarcel

This comment has been minimized.

Show comment
Hide comment
@newmarcel

newmarcel Sep 24, 2016

@rodriguv I'm not using fastlane in CI currently, but a custom Makefile. In the meantime my setup has also changed, because I have a better understanding of the codesigning process of Xcode 8 now:

  • I moved the team ID back into the project (xcconfig)
  • Provisioning Profiles are set to automatic
  • I call gym without xcodebuild overrides
  • Xcode 8 required me to add development certificates and prov. profiles to CI because the archive phase now always uses developer credentials, and export archive will re-sign my app with the distribution cert (this caused a lot of confusion and Exit status: 65 errors)
  • my pretty verbose use of gym looks like this and works perfectly:
gym \
    --clean \
    --workspace "$(WORKSPACE)" \
    --scheme "$(SCHEME)" \
    --configuration "Release" \
    --sdk "iphoneos" \
    --export_method "enterprise" \
    --derived_data_path "$(BUILD_DIR)" \
    --archive_path "$(ARCHIVE_PATH)" \
    --output_directory "$(OUTPUT_DIR)" \
    --output_name "$(APP_NAME)" \
    --buildlog_path "$(OUTPUT_DIR)" \
    --use_legacy_build_api false

@rodriguv I'm not using fastlane in CI currently, but a custom Makefile. In the meantime my setup has also changed, because I have a better understanding of the codesigning process of Xcode 8 now:

  • I moved the team ID back into the project (xcconfig)
  • Provisioning Profiles are set to automatic
  • I call gym without xcodebuild overrides
  • Xcode 8 required me to add development certificates and prov. profiles to CI because the archive phase now always uses developer credentials, and export archive will re-sign my app with the distribution cert (this caused a lot of confusion and Exit status: 65 errors)
  • my pretty verbose use of gym looks like this and works perfectly:
gym \
    --clean \
    --workspace "$(WORKSPACE)" \
    --scheme "$(SCHEME)" \
    --configuration "Release" \
    --sdk "iphoneos" \
    --export_method "enterprise" \
    --derived_data_path "$(BUILD_DIR)" \
    --archive_path "$(ARCHIVE_PATH)" \
    --output_directory "$(OUTPUT_DIR)" \
    --output_name "$(APP_NAME)" \
    --buildlog_path "$(OUTPUT_DIR)" \
    --use_legacy_build_api false
@pedro380085

This comment has been minimized.

Show comment
Hide comment
@pedro380085

pedro380085 Sep 26, 2016

When I run it, the provisioning profile I set through PROVISIONING_PROFILE_SPECIFIER is marked as having the aps-environment = production entitlement:

screen shot 2016-09-26 at 12 27 39

However; when I run it on gym, the gym.log outputs that it is not activated:

Entitlements:

{
    "application-identifier" = "......";
    "beta-reports-active" = 1;
    "com.apple.developer.team-identifier" = ......;
    "get-task-allow" = 0;
    "keychain-access-groups" =     (
        "......"
    );
}

My current setup:

    ProfileDirectory = "/..../fastlane/Profiles"
    ProfileFile = "........mobileprovision"
    sigh(
        output_path: ProfileDirectory,
        filename: ProfileFile
    )

    ProfileTarget = Plist.parse_xml(`security cms -D -i '#{ProfileDirectory}/#{ProfileFile}'`)['UUID'];
    ProfileSpecifier = Plist.parse_xml(`security cms -D -i '#{ProfileDirectory}/#{ProfileFile}'`)['Name'];
    puts ProfileTarget;
    gym(
        xcargs: "PROVISIONING_PROFILE='#{ProfileTarget}' PROVISIONING_PROFILE_SPECIFIER='#{ProfileSpecifier}'"
    )

Someone has any idea what it might be?

pedro380085 commented Sep 26, 2016

When I run it, the provisioning profile I set through PROVISIONING_PROFILE_SPECIFIER is marked as having the aps-environment = production entitlement:

screen shot 2016-09-26 at 12 27 39

However; when I run it on gym, the gym.log outputs that it is not activated:

Entitlements:

{
    "application-identifier" = "......";
    "beta-reports-active" = 1;
    "com.apple.developer.team-identifier" = ......;
    "get-task-allow" = 0;
    "keychain-access-groups" =     (
        "......"
    );
}

My current setup:

    ProfileDirectory = "/..../fastlane/Profiles"
    ProfileFile = "........mobileprovision"
    sigh(
        output_path: ProfileDirectory,
        filename: ProfileFile
    )

    ProfileTarget = Plist.parse_xml(`security cms -D -i '#{ProfileDirectory}/#{ProfileFile}'`)['UUID'];
    ProfileSpecifier = Plist.parse_xml(`security cms -D -i '#{ProfileDirectory}/#{ProfileFile}'`)['Name'];
    puts ProfileTarget;
    gym(
        xcargs: "PROVISIONING_PROFILE='#{ProfileTarget}' PROVISIONING_PROFILE_SPECIFIER='#{ProfileSpecifier}'"
    )

Someone has any idea what it might be?

@mgrebenets

This comment has been minimized.

Show comment
Hide comment
@mgrebenets

mgrebenets Sep 29, 2016

Contributor

@pedro380085
isn’t PROVISIONING_PROFILE deprecated now?
we had some hiccups and weird build errors when having both PROVISIONING_PROFILE and PROVISIONING_PROFILE_SPECIFIER set.

Ideally, if you moved on to PROVISIONING_PROFILE_SPECIFIER, the PROVISIONING_PROFILE should be set to blank then.

Contributor

mgrebenets commented Sep 29, 2016

@pedro380085
isn’t PROVISIONING_PROFILE deprecated now?
we had some hiccups and weird build errors when having both PROVISIONING_PROFILE and PROVISIONING_PROFILE_SPECIFIER set.

Ideally, if you moved on to PROVISIONING_PROFILE_SPECIFIER, the PROVISIONING_PROFILE should be set to blank then.

@biolinh

This comment has been minimized.

Show comment
Hide comment
@biolinh

biolinh Oct 24, 2016

That is weird that when I configured

 "xcargs "PROVISIONING_PROFILE_SPECIFIER='#{ENV["PROVISIONING_PROFILE_SPECIFIER"]}'""

in Gymfile, it build forever with Jenkins and take me 5h11m in local (running in my laptop) to build app.

Gymfile:


output_directory "./build/"
output_name "360"
include_symbols "false"
include_bitcode "false"
codesigning_identity  (ENV["CODE_SIGN_IDENTITY"])
# provisioning_profile_path ENV["SIGH_OUTPUT_PATH"]
xcargs "PROVISIONING_PROFILE_SPECIFIER='#{ENV["PROVISIONING_PROFILE_SPECIFIER"]}'"
configuration "Fastlane"

Fastlane: 1.105.3

biolinh commented Oct 24, 2016

That is weird that when I configured

 "xcargs "PROVISIONING_PROFILE_SPECIFIER='#{ENV["PROVISIONING_PROFILE_SPECIFIER"]}'""

in Gymfile, it build forever with Jenkins and take me 5h11m in local (running in my laptop) to build app.

Gymfile:


output_directory "./build/"
output_name "360"
include_symbols "false"
include_bitcode "false"
codesigning_identity  (ENV["CODE_SIGN_IDENTITY"])
# provisioning_profile_path ENV["SIGH_OUTPUT_PATH"]
xcargs "PROVISIONING_PROFILE_SPECIFIER='#{ENV["PROVISIONING_PROFILE_SPECIFIER"]}'"
configuration "Fastlane"

Fastlane: 1.105.3

@TKBurner

This comment has been minimized.

Show comment
Hide comment
@TKBurner

TKBurner Oct 25, 2016

@biolinh Are you using automatic code signing in Xcode on this project? That could be the issue.

@biolinh Are you using automatic code signing in Xcode on this project? That could be the issue.

@biolinh

This comment has been minimized.

Show comment
Hide comment
@biolinh

biolinh Oct 27, 2016

@TKBurner no, I already set manual sigining in General tab in Xcode

biolinh commented Oct 27, 2016

@TKBurner no, I already set manual sigining in General tab in Xcode

@TKBurner

This comment has been minimized.

Show comment
Hide comment
@TKBurner

TKBurner Oct 28, 2016

@biolinh Why do you need to use the option for provisioning_profile_specifier? If you have manual code signing setup, what function is it serving? Thanks so much and hope you have a great weekend 👍

@biolinh Why do you need to use the option for provisioning_profile_specifier? If you have manual code signing setup, what function is it serving? Thanks so much and hope you have a great weekend 👍

@biolinh

This comment has been minimized.

Show comment
Hide comment
@biolinh

biolinh Nov 3, 2016

@TKBurner: Because our code is used for build many app with many different identifier therefore we must change it when branding with Jenkins. And I follow a suggestion in #6324

biolinh commented Nov 3, 2016

@TKBurner: Because our code is used for build many app with many different identifier therefore we must change it when branding with Jenkins. And I follow a suggestion in #6324

@fastlane fastlane locked and limited conversation to collaborators Feb 1, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.