how to solve codesign fail on mac with jenkis ci and electron-builder? - jenkins

when i build in terminal codesign suceess but when i build in jenkins ci, throw error always.
the error content:
file=build/mac/VIPThink-test-online.app identityName=Developer ID xxxx identityHash=xxx provisioningProfile=none
Error: Command failed: codesign --sign xxx --force /Users/Shared/Jenkins/Home/workspace/pc-student-build-test/build/mac/VIPThink-test-online.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework
/Users/Shared/Jenkins/Home/workspace/pc-student-build-test/build/mac/VIPThink-test-online.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework: errSecInternalComponent

1st> just type this code in terminal
export CSC_IDENTITY_AUTO_DISCOVERY=false
2nd> run electron-builder --mac zip
It will temporarily create a zip without sign in key
It also successfully build the project for mac

Related

":CFBundleIdentifier", Does Not Exist: ReactNative 0.58 on Mac / iOS

I am following the ReactNative tutorial for 0.58. I do everything it says to do and I am crashing after running react-native run-ios. I have seen this extremely similar SO question from 2016.
I attempted react-native upgrade and it recommended doing react-native-git-upgrade.This did nothing. Same problem.
The bit on running ./configure in the question above after cd-ing into glog did nothing. There was no configure script there. In the path NewStupidProject/node_modules/react-native/scripts there is a script called ios-configure-glog.sh. I run bash ios-configure-glog.sh and it says ios-configure-glog.sh: line 31: ./configure: No such file or directory.
I have also attempted setting Xcode to use the legacy build system. This did not fix the issue. I am restarting my laptop now to see if that makes any of these changes take effect. No luck. At the top it says:
Found Xcode project NewStupidProject.xcodeproj Building using
"xcodebuild -project NewStupidProject.xcodeproj -configuration Debug
-scheme NewStupidProject -destination id=854019D1-8EE7-4D13-87E1-385E6CAC21BE -derivedDataPath build" User
defaults from command line:
IDEDerivedDataPathOverride = /Users/me/NewStupidProject/ios/build
Prepare build
note: Using legacy build system
=== BUILD TARGET double-conversion OF PROJECT React WITH CONFIGURATION Debug ===
When I go into the home directory and run react-native --version the output is:
[NewStupidProject](master)$ react-native --version
react-native-cli: 2.0.1
react-native: 0.58.4
[NewStupidProject](master)$
My output after crashing is:
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Install\ Third\ Party /Users/me/native_react_apps/NewStupidProject/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
(1 failure)
Installing
build/Build/Products/Debug-iphonesimulator/NewStupidProject.app An
error was encountered processing the command
(domain=NSPOSIXErrorDomain, code=22): Failed to install the requested
application The bundle identifier of the application could not be
determined. Ensure that the application's Info.plist contains a value
for CFBundleIdentifier. Print: Entry, ":CFBundleIdentifier", Does Not
Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier
build/Build/Products/Debug-iphonesimulator/NewStupidProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error: Command failed: /usr/libexec/PlistBuddy -c
Print:CFBundleIdentifier
build/Build/Products/Debug-iphonesimulator/NewStupidProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:637:11)
at Object.execFileSync (child_process.js:655:13)
at Promise.then (/Users/me/native_react_apps/NewStupidProject/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
How is it possible for the setup process to be this fraught with errors and this difficult?
WHY is this error message not in the Troubleshooting ReactNative setup?
HOW do I fix this? Is it possible to avoid this altogether in the future?
Other versioning info:
XCode: 10.1
Command Line Tools: 10.1
yarn: 0.27.5
watchman: 4.9.0
homebrew: 2.0.1
npm: 6.8.0
node: v11.9.0
macOS: 10.13.6
UPDATE:
I am trying to implement the solution in this issue in GitHub and I'm getting:
dyld: Library not loaded:
/usr/local/opt/readline/lib/libreadline.7.dylib Referenced from:
/usr/local/bin/awk Reason: image not found
./ios-install-third-party.sh: line 20: 24497 Broken pipe: 13
shasum -p "$cachedir/$file"
24498 Abort trap: 6 | awk -v hash="$hash" '{exit $1 != hash}' Incorrect hash: 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc
?/Users/me/.rncache/glog-0.3.5.tar.gz
UPDATE No. 2 I am trying to run the watchman watch-del-all command as recommended here to clear the cache for RN > 0.50 and the whole thing is hanging.
I tried modify the build system and it worked for me.
Detail:
Open your project workspace file in Xcode, and
File -> Workspace Settings -> Build system -> Legacy Build system

How to run xcodebuild commands via ssh?

I am trying to run iOS tests with xcodebuild commands over ssh. When I try to run those commands which build and run the iOS UI Tests I am facing following error.
Note: I have all the keychains on the machine where I ssh in unlocked.
Command
HOME=/Users/mcj xcodebuild build-for-testing -project ios/ios_test_app/HXKPIIOS/HXKPIIOS.xcodeproj -scheme HXKPIIOS -destination 'platform=iOS,id=d623bacb04507071723fe1286c148edb822d5422' -derivedDataPath /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data| tee /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/uitest/build1.log
Error
/usr/bin/codesign '-r-' '--display' '/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib'
/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib: code object is not signed at all
Codesigning /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib
/usr/bin/codesign '--force' '--sign' '<code sign identity>' '--verbose' '/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib'
/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib: unknown error -1=ffffffffffffffff
error: Task failed with exit 1 signal 0 {
/usr/bin/codesign '--force' '--sign' '<code sign identity>' '--verbose' '/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib'
}
** TEST BUILD FAILED **
The following build commands failed:
CopySwiftLibs /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app
(1 failure)
My guess is that although you have the proper items within your Keychain it still needs to be unlocked before it can execute the build process properly. When ssh in (before building) try:
$ security unlock-keychain
If your keychain is not unlocked, it needs a window server connection
in order to prompt the user to unlock the keychain. Use security(1) to
unlock the keychain on the remote machine prior to executing the
xcodebuild.
If that doesn't work for you please review this question and subsequent answers.

Jenkins return "unknown error -1=ffffffffffffffff" when building Xcode Project with Cocoapods

I'm getting below error when trying to build Xcode workspace on Jenkins
usr/bin/codesign --force --sign B5E96BDFADAF51D771B158A29BF1D16565215A2D --preserve-metadata=identifier,entitlements '/Users/servicebuild/Desktop/Jenkins/workspace/Hello-Branch/build/Hello Test.app/Frameworks/Alamofire.framework'
16:06:07 /Users/servicebuild/Desktop/Jenkins/workspace/Hello-Branch/build/Hello Test.app/Frameworks/Alamofire.framework: unknown error -1=ffffffffffffffff
16:06:07 Command /bin/sh failed with exit code 1
16:06:07
16:06:07 ** BUILD FAILED **
16:06:07
16:06:07
16:06:07 The following build commands failed:
16:06:07 PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/servicebuild/Library/Developer/Xcode/DerivedData/Hello-dcvxwbnovymfusbrvfyyekingznu/Build/Intermediates.noindex/Garanti\ Filo.build/Release-iphoneos/Hello\ Hello\ Test.build/Script-2617FEF7DE193736656550249B.sh
I have more than one targets and in workspace scheme targets that I created are ticked as shared (not the pod targets). In pod project every framework has "Don't Code Sign" (As Default). I can successfully get IPA export from Xcode. However, when I try to build in Jenkins I get this error.
I tried solution in below post but can't figure out. I think the problem is Jenkins is forcing to sign pods when It doesn't need to.
Codesign returned unknown error -1=ffffffffffffffff
I figured out how to run below code (posted in the post added in my question) and it worked. Important point is that giving right path for keychain and password. Otherwise, It doesn't work.
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password ${KEYCHAIN}

Error no mobile provisioning profile found

While using the build system instruction from https://webrtc.org/native-code/ios/ all went fine except following error
Error: no mobile provisioning profile found for
When i do xcrun security find-identity -v -p codesigning i do see my certificates, Is there anyway to fix it?
$ gn gen out/ios_64 --args='target_os="ios" target_cpu="arm64"'
Done. Made 719 targets from 110 files in 2444ms
$ ninja -C out/ios_64 AppRTCMobile
ninja: Entering directory `out/ios_64'
[2086/2100] CODE SIGNING //webrtc/sdk:r...(//build/toolchain/mac:ios_clang_arm64)
FAILED: WebRTC.framework/WebRTC WebRTC.framework/_CodeSignature/CodeResources WebRTC.framework/embedded.mobileprovision
python ../../build/config/ios/codesign.py code-sign-bundle -t=iphoneos -i=3F06B010E7BE32A3D212219D02DF440B0F20D6A3 -e=../../build/config/ios/entitlements.plist -b=obj/webrtc/sdk/WebRTC WebRTC.framework
Error: no mobile provisioning profile found for "org.webrtc.WebRTC".
ninja: build stopped: subcommand failed.
Let me tell the steps that works for me
Edit the file src/examples/objc/AppRTCMobile/ios/Info.plist and change the value com.google.AppRTCMobile with your own bundle identifier.
Edit the file src/sdk/objc/Framework/Info.plist and change the value org.webrtc.WebRTC with your own bundle identifier
I have created bundle identifiers on Xcode and after that build is successful

Jenkins error: /usr/bin/codesign --force failed exit code 1

I am configuring CI for my IOS project on MAC yosemite-OS and got on problem:
error: /usr/bin/codesign --force --preserve-metadata=identifier,entitlements,resource-rules --sign /Users/mitul/Desktop/jenkins_ios_profile/PCertificates.p12 --resource-rules=/var/folders/rj/cc6d38nn53v6tk8y4jn7ghkr0000gp/T/42RbMszHQX/Payload/XXX.app/ResourceRules.plist /var/folders/rj/cc6d38nn53v6tk8y4jn7ghkr0000gp/T/42RbMszHQX/Payload/XXX.app failed with error 1
even my build and archive are getting success but not able to make .ipa file
even tried all possibilities from this
/usr/bin/codesign failed with exit code 1 but no luck
Please help me what I am missing to do
My Xcode configuration is as follows:
Custom xcodebuild arguments:
CODE_SIGN_RESOURCE_RULES_PATH=/Users/mitul/Public/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ResourceRules.plist
rest are all with default setting
I unchecked the code signing checkbox in jenkins project configuration and it started building, hope it can help some else too!

Resources