Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis CI Fails to Build with a Code Signing Error

Tags:

Travis CI fails to build my app because the Xcode project is set up to require code signing and Travis doesn't have my certificates. I could fix this by disabling code signing, but then sandboxing and entitlements won't work. I know when building from the command line ordinarily, you can pass CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO to xcodebuild to disable the code signing, but how do you do this in Travis CI?

Here's my .travis.yml:

language: objective-c xcode_workspace: "Mac Linux USB Loader.xcworkspace" xcode_scheme: "Mac Linux USB Loader" 

And here's the error (I've code out many previous lines referring to Cocoapods, as they're not relevant:

Check dependencies Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “T47PR9EQY5” were found. 
like image 603
SevenBits Avatar asked Dec 27 '14 22:12

SevenBits


People also ask

Could not authorize build request Travis?

If a build hasn't been triggered for your commit, these are the possible build request messages: “Could not authorize build request”, usually means that the account's subscription expired or that it ran out of build credits.

How do you debug a Travis build?

The “Debug build” or “Debug job” button is available on the upper right corner of the build and job pages for private repositories. For open source repositories, this button is not available and you will need to use an API call instead.

Which of the following file is used to configure the Travis CI?

Configuration. Travis CI is configured by adding a file named . travis. yml , which is a YAML format text file, to the root directory of the repository.


2 Answers

Did you try to add this on you travis.yml:

language: objective-c  script:   - xcodebuild [DEFAULT_OPTIONS] CODE_SIGNING_REQUIRED=NO 

Or import a development (and distribution if you are going to use on your build) cert/key to the keychain and copy your team provisioning profile, to make the code signing work. Like this:

language: objective-c  before_script: - ./scripts/add-key.sh  script:   - xcodebuild [DEFAULT_OPTIONS] CODE_SIGNING_REQUIRED=NO 

add-key.sh

#!/bin/sh  KEY_CHAIN=ios-build.keychain security create-keychain -p travis $KEY_CHAIN # Make the keychain the default so identities are found security default-keychain -s $KEY_CHAIN # Unlock the keychain security unlock-keychain -p travis $KEY_CHAIN # Set keychain locking timeout to 3600 seconds security set-keychain-settings -t 3600 -u $KEY_CHAIN  # Add certificates to keychain and allow codesign to access them security import ./scripts/certs/dist.cer -k $KEY_CHAIN -T /usr/bin/codesign security import ./scripts/certs/dev.cer -k $KEY_CHAIN -T /usr/bin/codesign  security import ./scripts/certs/dist.p12 -k $KEY_CHAIN -P DISTRIBUTION_KEY_PASSWORD  -T /usr/bin/codesign security import ./scripts/certs/dev.p12 -k $KEY_CHAIN -P DEVELOPMENT_KEY_PASSWORD  -T /usr/bin/codesign  echo "list keychains: " security list-keychains echo " ****** "  echo "find indentities keychains: " security find-identity -p codesigning  ~/Library/Keychains/ios-build.keychain echo " ****** "  # Put the provisioning profile in place mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles  cp "./scripts/profiles/iOSTeam_Provisioning_Profile_.mobileprovision" ~/Library/MobileDevice/Provisioning\ Profiles/ cp "./scripts/profiles/DISTRIBUTION_PROFILE_NAME.mobileprovision" ~/Library/MobileDevice/Provisioning\ Profiles/ 
like image 188
Marcio Klepacz Avatar answered Oct 14 '22 21:10

Marcio Klepacz


Please find my .travis.yml file below, which fixes this error message and others, when using an Xcode 7 project + Swift + iOS 9 + the continuous integration tool available on travis-ci.org:

# http://docs.travis-ci.com/user/languages/objective-c/ # https://github.com/facebook/xctool  language: objective-c  osx_image: xcode7  # xcode_project: SampleNotifcations/SampleNotifcations.xcodeproj # xcode_workspace: SampleNotifcations/SampleNotifcations.xcworkspace  # xcode_scheme: SampleNotifcationsTests  podfile: SampleNotifcations/Podfile  # xcode_sdk: iphonesimulator9.0  script:    xctool   -workspace SampleNotifcations/SampleNotifcations.xcworkspace   -scheme SampleNotifcationsTests   -sdk iphonesimulator   -destination 'platform=iOS Simulator,name=iPhone 6 Plus'   build    test   ONLY_ACTIVE_ARCH=NO   CODE_SIGN_IDENTITY=""   CODE_SIGNING_REQUIRED=NO  before_install:   - brew update   - brew uninstall xctool && brew install --HEAD xctool 

Sources:

  • XCTool issue where people talk about that and where a solution is given at the end of the page.
  • See Travis CI fix for an example.
like image 44
King-Wizard Avatar answered Oct 14 '22 21:10

King-Wizard