Jenkins iOS Submit app Crashlytics failed (with Xcode Integration plug-in) - ios

Jenkins grab my source from git and compile and generate a build is working fine. But when I run the Crashlytics command in Execute Shell to submit the build to Crashlytics Beta, it failed.
Error I received:
2016-06-02 13:52:05.232 submit Crashlytics: Crashlytics.framework/submit
1.3.5 (17)
2016-06-02 13:52:07.405 submit Crashlytics: Unable to package source due to
error: Error Domain=CLSIPABuilderErrorDomain Code=-6 "(null)" UserInfo=
{UnderlyingError=Error Domain=CLSCodeSignerErrorDomain Code=-2 "(null)"
UserInfo={arguments=(
"--sign",
B0DC1AA9228E7CB89E7ACE1576AEF3B1EC166012,
"--all-architectures",
"--force",
"--entitlements",
"/var/folders/k5/656qxxbs6854_mdjb53j2gp80000gn/T/com.crashlytics.ipas/991D8904-72CA-4B9C-A9D7-377F9D8420FF/Payload/entitlements.xml",
"/var/folders/k5/656qxxbs6854_mdjb53j2gp80000gn/T/com.crashlytics.ipas/991D8904-72CA-4B9C-A9D7-377F9D8420FF/Payload/elevenstreet.app"
), environment={
"CODESIGN_ALLOCATE" = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate";
}, status=1, stderr=B0DC1AA9228E7CB89E7ACE1576AEF3B1EC166012: no identity found
, command=/usr/bin/codesign, stdout=}, SourcePath=/var/folders/k5/656qxxbs6854_mdjb53j2gp80000gn/T/com.crashlytics.ipas/991D8904-72CA-4B9C-A9D7-377F9D8420FF}
2016-06-02 13:52:07.452 submit Crashlytics: Failed to prepare the binary for release
Build step 'Execute shell' marked build as failure
Archiving artifacts
Finished: FAILURE
Shell code is from its doc.
Not sure where it goes wrong. Please help.

Without changing anything on Keychain and distribution cert, and settings on Jenkins and Xcode Integration plugins, delete the existing Jenkins project and make a new one and re-assign all the settings and everything works.
Things to take note:
Make sure to have latest version of Crashlytics and Fabrics frameworks.
Make sure distribution cert in in your Keychain.
In Jenkins, in Xcode Integration plugin, under Code signing & OS X keychain options, make sure your Code Signing Identity is your certificate name (exactly the name of your distribution cert), and you can left Embedded Profile blank for it to point to the default location.
Tick Unlock Keychain option, and it will expand its panel. Make sure the path of Keychain is correct. Default is /Users/jenkins/Library/Keychains/.keychain, and the password. Default password would be your password that you use to sign in into your computer.
And Lastly, the Crashlytics command:
${WORKSPACE}/Pods/Crashlytics/Crashlytics.framework/submit <API Key> <Build Secret Key> -ipaPath ${WORKSPACE}/ipa-dir/<project_name>-${BUILD_ID}.ipa -emails <your_email> -notifications YES

Related

Fabric Archive packaging Error -6

When I package from XCode via Fabric Plugin a Beta in debug mode, I got an error :
Fabric Archive packaging Error -6
In Xcode I have check code signing manual (or auto same problem) for the app and the widget/extension with valid certificates and provisionning.
I also check that I have all certificates (public/private keys) and provisionning on my keychain.
If I build with fastlane last version 2.58.0, I got the same issue than direcly build from XCode.
Note that without any changes, one day it's work, an other that fails. This is strange.
Any help?
Even if you have the certificates and profiles on your keychain, you may need to refresh them. To do this in Xcode 9, follow the instructions here: https://stackoverflow.com/a/46686725/6543020
Possible duplicate of: Fabric Plugin: Archive Packaging Error: -6 Error re-signing the application for distribution

No matching provisioning profiles found - NativeScript iOS deploy

I want to publish an update of my NativeScript app into AppStore. Until yesterday the following steps worked:
move into app directory (from Terminal)
execute tns publish ios
enter valid e-mail & password combination
Now I need to do another update, but I keep getting the following error:
=== BUILD TARGET HandyApp OF PROJECT HandyApp WITH CONFIGURATION Release ===
Check dependencies
Code Sign error: No matching provisioning profiles found: No provisioning profiles matching an applicable signing identity were found.
** ARCHIVE FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Command xcodebuild failed with exit code 65
# publish ios
I am working under Xcode 7.3. I checked my iPhone Developer certificate in Xcode and in my keychain, it is active and not expired. The Provisioning Profile is shown in Xcode. I ensured to use the certificate that is saved in apple.developer.com (by downloading it and replacing the old one in that directory).
I got:
my .mobileprovision
my .cer
my .p12
everything in the same directory.
Still there seems something not to be matching. I just can't figure out what might be running wrong. Does anyone know what else I could try to get it working?

Codesign returns unknown error after "replacing existing signature"

I am trying to build a Xamarin iOS app using xbuild on Jenkins. Sometimes the build fails during the codesigning process with an unknown error -1=ffffffffffffffff and sometimes the build succeeds. The provisioning profile is stored in a separate keychain jenkins.keychain (not the system or login keychain) that is referenced by Jenkins through the Keychains and Provisioning Profiles Plugin.
This is the console log of Jenkins:
Target _CodesignAppBundle:
Codesign Task
CodesignAllocate: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
DisableTimestamp: False
Entitlements: obj/iPhone/In-House/Entitlements.xcent
Keychain: <null>
Resources:
bin/iPhone/In-House/MyApp.app
ResourceRules: <null>
SigningKey: 123
ExtraArgs: <null>
IsAppExtension: False
Tool /usr/bin/codesign execution started with arguments: -v --force --sign 123 --entitlements /private/var/lib/jenkins/workspace/Master/Apps/iOS/obj/iPhone/In-House/Entitlements.xcent /private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app
bin/iPhone/In-House/MyApp.app: error : /private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app: replacing existing signature
/private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app: unknown error -1=ffffffffffffffff
Task "Codesign" execution -- FAILED
Done building target "_CodesignAppBundle" in project "/private/var/lib/jenkins/workspace/Master/Apps/iOS/MyApp.csproj".-- FAILED
As suggested in Codesign returned unknown error -1=ffffffffffffffff I added set-key-partition-list -S apple-tool:,apple:,codesign: -s -k ${KEYCHAIN_PW} ${KEYCHAIN_PATH} to my build script but it did not fix the issue.
Do you have any idea how to address this issue? Why is there an existing signature to be replaced?
Update 1 - We keep getting the error after:
switching from xbuild to msbuild version 15.3.0.0
setting jenkins keychain to "Allow all applications to access this item"
deleting the derived data folder
not using relative paths for security commands
A similar problem is described in the Apple forum.
What fixed the issue:
The keychain filename extension changed from *.keychain to *.keychain-db on macOS Sierra. The code signing error was caused by referencing the old keychain file while we were editing in fact the jenkins.keychain-db file containing updated certificates. Keychains with the new extension are rejected from the upload with Jenkins' keychain plugin. So we do not use the keychain plugin any longer and store the signing certificates inside the login.keychain-db. With this we can successfully build the app without the unknown error.
My resolution to this problem was ensuring that the Mac had proper permissions to use the new certificate. I was getting this code signing issue when trying to run a Jenkins job, but things ran properly on my local machine. When I tried manually code signing one of the Swift libraries (e.g. libswiftos.dylib), the Mac then asked for a password to be able to use the new certificate. Once I did that, the Jenkins job ran successfully.
Restarting the Mac could Fix the issue

Crashlytics: Unable to package source due to error

I am setting up an Xcode Bot to automatically upload and distribute my beta app.
I have setup a mac with macOS Server and Xcode activated and am able to build and export an IPA manually just fine.
The Xcode Bot I created also archives and exports an IPA with no problem.
However, when I try to run the Crashlytics submit script in the Xcode Bot's post triggers, the uploading fails. But if I save the bot generated IPA and manually call the Crashlytics script via Terminal, it uploads just fine. It seems that only the Xcode Bot fails to submit to Crashlytics.
I have all the correct certificates installed on the server Keychain and everything works fine for manual archive/export both in Xcode and using the Xcode Bot's generated IPA.
Here is the log from Xcode Bot:
2016-11-22 17:15:53.942 submit Crashlytics: Crashlytics.framework/submit 1.3.5 (18)
2016-11-22 17:16:03.125 submit Crashlytics: Unable to package source due to error: Error Domain=CLSIPABuilderErrorDomain Code=-6 "(null)" UserInfo={UnderlyingError=Error Domain=CLSCodeSignerErrorDomain Code=-2 "(null)" UserInfo={arguments=(
"--sign",
ACFE8B8E177196BFF1974841752020FE96687508,
"--all-architectures",
"--force",
"--entitlements",
"/var/folders/81/5t89fdcn3h3680gh99mgvl7934dkfg/T/com.crashlytics.ipas/E357A31C-B1A2-424B-8A5A-E7D499A92C73/Payload/entitlements.xml",
"/var/folders/81/5t89fdcn3h3680gh99mgvl7934dkfg/T/com.crashlytics.ipas/E357A31C-B1A2-424B-8A5A-E7D499A92C73/Payload/Ebates Beta.app"
), environment={
"CODESIGN_ALLOCATE" = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate";
}, status=1, stderr=ACFE8B8E177196BFF1974841752020FE96687508: no identity found
, command=/usr/bin/codesign, stdout=}, SourcePath=/var/folders/81/5t89fdcn3h3680gh99mgvl7934dkfg/T/com.crashlytics.ipas/E357A31C-B1A2-424B-8A5A-E7D499A92C73}
2016-11-22 17:16:03.187 submit Crashlytics: Failed to prepare the binary for release
Been pulling my hair out over this all day, hoping someone can shed some light on this problem.
Ok so turns out you need to run the app on a device directly from Xcode on the server machine so that Xcode will automatically generate all the appropriate XC iOS provisioning profiles. Apparently the Crashlytics script will re-package the IPA and need valid provisioning profiles in order to do so. I think the Xcode Bot generates an IPA but it is not fully code signed until you save from the bot results, instead of just running from a bot post-trigger.
If you go to the developer.apple.com portal and look under Provisioning Profiles you should see something like this:

iOS Code Signing Fails Only For Jenkins

I'm trying to build a Xamarin Touch project from a Jenkins build it fails at the code signing phase.
My certificates and keys are in the System keychain so should be accessible to Jenkins. I have no code signing issues when I build the project:
Using Xamarin Studio.
Using /bin/bash and xbuild logged in as the Jenkins user.
Using /bin/sh and xbuild logged in as the Jenkins user.
The only time the code signing issue is seen is when the Jenkins build itself.
The error is "User interaction is not allowed", I'm at a loss as to explain what is going wrong for the Jenkins build when everything is working as the Jenkins user when I run the same command from a shell.
You could try importing your credentials in the Jenkins credentials area.
from here:
Allowing Jenkins to stage developer profile This plugin builds on top
of Credentials Plugin to allow you to store your Apple Developer
Profile (*.developerprofile) file. This file contains a code signing
private key, corresponding developer/distribution certificates, and
mobile provisioning profiles. You can create this file from your
XCode.
To upload the developer profile into Jenkins, go to "Manage
Credentials" in the system configuration page, and select "Apple
Developer Profile" from the "Add" button. See Credentials Plugin for
further details.
To use this profile for signing, add "Import developer profile" as a
build step before you run xcode, and select the developer profile to
import into the build machine. This build step will install the
developer profile into the slave's keychain.
So it turns out my problem was that my code signing keys were still in the login keychain as well as the system keychain.
I'm guessing this meant the build saw the keys in the login keychain first but then failed because that wasn't unlocked.
Once I deleted them from the login keychain, so they were only in the system keychain, it started working.
I'm still not sure why this was only a problem from within Jenkins as everything was working fine using a shell logged in as Jenkins.

Resources