CodeSign Error iOS
Asked by Vishal:

I am creating build using bamboo it show me CodeSign error but if i use same command which bamboo use in terminal it create build sucessfully with same certificates and I also try it with xcode tool both way it working well but I face problem only while make build using bamboo.

Step 1: Setting all certificate and configure bamboo  
Step 2: run bamboo plan it show me code sign error i will attach log file below

To cross verify  
Step 1 : I open bamboo log file and copy command from it and run same command via terminal it run sucessfully ... below is command which I used

xcodebuild clean build -sdk iphoneos13.2 -workspace RealtyDaddy.xcworkspace -scheme Staging

Error :-

\*\* BUILD FAILED \*\*  
The following build commands failed:  
CodeSign /Users/cnsoftnet/Library/Developer/Xcode/DerivedData/RealtyDaddy-asgwbiglvmrqdqdshxzozftakezg/Build/Products/Debug-iphoneos/ServiceExt.appex

For more specific detail :-  
ServiceExt.appex is NotifiacationExtension which is having separate bundle identifier and certificate but It should not cause issue we already used same thing with bamboo before and working like a charm before. We face this issue after certificate expired and we generate new one.

What we tried but didnt get successed,  
- create another certificate and try to use it  
- also create automatic certificate enable for service extension  
- delete all certificates from keychain and download and install all certificate again  
- clean build folder  
- even relogin in xcode and fetch all certificate again

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

BAMBOO LOGfile - Command

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

command 11-Apr-2020 10:41:40 Beginning to execute external process for build 'RealtyDaddyIOS - IOS-Stage - Default Job #163 (REAL-IOS-TEMP-163)'\\n ... running command line: \\n/usr/bin/xcodebuild clean build -sdk iphoneos13.2 -workspace RealtyDaddy.xcworkspace -scheme Staging\\n ... in: /Volumes/Software/bamboo-home/xml-data/build-dir/REAL-IOS-TEMP\\n ... using extra environment variables: \\nbamboo_repository_1966081_git_username=\\nbamboo_planRepository_1_branch=stage\\nbamboo_repository_1966081_name=IOS-Stage\\nbamboo_planRepository_1_branchDisplayName=stage\\nbamboo_repository_revision_number=d35bf7e5fa3c8eb7e704291357dcdaf6abdb6072\\nbamboo_resultsUrl=[http://127.0.0.1:8085/browse/REAL-IOS-TEMP-163\\nbamboo_repository_1966081_branch_name=stage\\nbamboo_build_working_directory=/Volumes/Software/bamboo-home/xml-data/build-dir/REAL-IOS-TEMP\\nbamboo_planRepository_1_name=IOS-Stage\\nbamboo_buildKey=REAL-IOS-TEMP\\nbamboo_shortPlanName=IOS-Stage\\nbamboo_capability_system_builder_xcode_Simulator___iOS_13_2=iphonesimulator13.2\\nbamboo_planRepository_name=IOS-Stage\\nbamboo_repository_1966081_git_branch=stage\\nbamboo_capability_system_builder_xcode_iOS_13_...](http://127.0.0.1:8085/browse/REAL-IOS-TEMP-163\nbamboo_repository_1966081_branch_name=stage\nbamboo_build_working_directory=/Volumes/Software/bamboo-home/xml-data/build-dir/REAL-IOS-TEMP\nbamboo_planRepository_1_name=IOS-Stage\nbamboo_buildKey=REAL-IOS-TEMP\nbamboo_shortPlanName=IOS-Stage\nbamboo_capability_system_builder_xcode_Simulator___iOS_13_2=iphonesimulator13.2\nbamboo_planRepository_name=IOS-Stage\nbamboo_repository_1966081_git_branch=stage\nbamboo_capability_system_builder_xcode_iOS_13_2=iphoneos13.2\nbamboo_buildNumber=163\nbamboo_shortJobName=Default) Job\\nbamboo_buildResultsUrl=[http://127.0.0.1:8085/browse/REAL-IOS-TEMP-163\\nbamboo_planRepository_repositoryUrl=http://nzalavadia:abc@123$@stash:7990/scm/ec/ios-app.git\\nbamboo_agentId=360449\\nbamboo_planName=RealtyDaddyIOS](http://127.0.0.1:8085/browse/REAL-IOS-TEMP-163\nbamboo_planRepository_repositoryUrl=http://nzalavadia:abc@123$@stash:7990/scm/ec/ios-app.git\nbamboo_agentId=360449\nbamboo_planName=RealtyDaddyIOS) - IOS-Stage\\nbamboo_shortPlanKey=IOS\\nbamboo_capability_system_builder_command_firebaseCLI=firebase\\nbamboo_shortJobKey=TEMP\\nbamboo_planRepository_revision=d35bf7e5fa3c8eb7e704291357dcdaf6abdb6072\\nbamboo_buildTimeStamp=2020-04-11T10:41:35.912+05:30\\nbamboo_repository_previous_revision_number=dd629fbc44a735f46a34a8f964015b0027ed8f4c\\nbamboo_planRepository_previousRevision=dd629fbc44a735f46a34a8f964015b0027ed8f4c\\nbamboo_repository_1966081_previous_revision_number=dd629fbc44a735f46a34a8f964015b0027ed8f4c\\nbamboo_repository_git_branch=stage\\nbamboo_buildResultKey=REAL-IOS-TEMP-163\\nbamboo_repository_branch_name=stage\\nbamboo_repository_1966081_git_repositoryUrl=http://nzalavadia:abc@123$@stash:7990/scm/ec/ios-app.git\\nbamboo_buildPlanName=RealtyDaddyIOS - IOS-Stage - Default Job\\nbamboo_planRepository_1_revision=d35bf7e5fa3c8eb7e704291357dcdaf6abdb6072\\nbamboo_repository_name=IOS-Stage\\nbamboo_dependenciesDisabled=false\\nbamboo_buildFailed=false\\nbamboo_repository_1966081_revision_number=d35bf7e5fa3c8eb7e704291357dcdaf6abdb6072\\nbamboo_planRepository_branch=stage\\nbamboo_agentWorkingDirectory=/Volumes/Software/bamboo-home/xml-data/build-dir\\nbamboo_capability_system_git_executable=/usr/bin/git\\nbamboo_repository_git_username=\\nbamboo_planRepository_1_previousRevision=dd629fbc44a735f46a34a8f964015b0027ed8f4c\\nbamboo_planRepository_branchDisplayName=stage\\nbamboo_planRepository_1_type=gitv2\\nbamboo_planRepository_branchName=stage\\nbamboo_capability_system_jdk_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home\\nbamboo_plan_storageTag=plan-819201\\nbamboo_hg_cache_directory=/Volumes/Software/bamboo-home/xml-data/build-dir/_hg-repositories-cache\\nbamboo_planRepository_1_username=\\nbamboo_capability_system_builder_command_xcodebuild=xcodebuild\\nbamboo_planRepository_type=gitv2\\nbamboo_capability_system_builder_xcode_iphoneos13_2=iphoneos13.2\\nbamboo_git_cache_directory=/Volumes/Software/bamboo-home/xml-data/build-dir/_git-repositories-cache\\nbamboo_ManualBuildTriggerReason_userName=cnsoftnet\\nbamboo_repository_git_repositoryUrl=http://nzalavadia:abc@123$@stash:7990/scm/ec/ios-app.git\\nbamboo_tmp_directory=/Volumes/Software/bamboo-home/temp\\nbamboo_working_directory=/Volumes/Software/bamboo-home/xml-data/build-dir/REAL-IOS-TEMP\\nbamboo_planKey=REAL-IOS\\nbamboo_planRepository_1_repositoryUrl=http://nzalavadia:abc@123$@stash:7990/scm/ec/ios-app.git\\nbamboo_planRepository_username=\\nbamboo_capability_system_jdk_JDK_1_8=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home\\nbamboo_capability_system_jdk_JDK_1_8_0_241=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home\\nbamboo_planRepository_1_branchName=stage\\n

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

BAMBOO LOG Error

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

The following build commands failed:

error 11-Apr-2020 10:42:47 CodeSign /Users/cnsoftnet/Library/Developer/Xcode/DerivedData/RealtyDaddy-asgwbiglvmrqdqdshxzozftakezg/Build/Products/Debug-iphoneos/ServiceExt.appex

error 11-Apr-2020 10:42:47 (1 failure)

simple 11-Apr-2020 10:42:47 Failing task since return code of \[/usr/bin/xcodebuild clean build -sdk iphoneos13.2 -workspace RealtyDaddy.xcworkspace -scheme Staging\] was 65 while expected 0

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

Terminal below Command succeed

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

xcodebuild clean build -sdk iphoneos13.2 -workspace RealtyDaddy.xcworkspace -scheme Staging


Answers:
author: Gerhard Forster
body: Hey Vishal,

Thanks for joining us on Atlassian Community and thanks for your XCode build inquiry here.

Walking over your error print-out and the related messages, the error seems to be the below

```
error 11-Apr-2020 10:42:47 (1 failure)
simple 11-Apr-2020 10:42:47 Failing task since return code of [/usr/bin/xcodebuild clean build -sdk iphoneos13.2 -workspace RealtyDaddy.xcworkspace -scheme Staging] was 65 while expected 0
```

so it originates back to the *xcodebuild* call apparently.

I wonder, do you run this from out of a Bamboo Script task? I don't think that this would work, even more as Bamboo provides an **XCode task**. Did you try running the XCode task in your build plan? If not, please do so.

Find the below KB providing details about how to use this task in Bamboo.

[Xcode](https://confluence.atlassian.com/bamboo/xcode-354353193.html "Xcode")

Please carefully check out this KB's "Prerequisites" section, the given task configuration details and also the aspect of the "XCode SDK" capability as of section "Updating the available SDKs when Xcode is upgraded".

Please quote this message with "Accept answer" if it could help you out and if not, feel free to come back to us on this thread.

Thanks and and stay healthy!  
Gerhard