IOS - Running script '[CP-User] Generate Specs The following build commands failed: PhaseScriptExecution [CP-User]\ Generate\ Specs In Azure Pipeline - ios

I am working with the azure pipeline for CICD for React native app. I am using macOS Big Sur (11.4) and Xcode 12.4 as a local machine to create and test the app. App working fine on the local machine without any warning or issue for ios. However, when I am pushing the code on the Azure pipeline it is giving me errors as below,
2021-07-27T07:16:59.6470190Z ▸ Building library libRCTTypeSafety.a
2021-07-27T07:17:00.2028870Z ▸ Running script '[CP-User] Generate Specs'
2021-07-27T07:17:01.2282870Z ** BUILD FAILED **
2021-07-27T07:17:01.2284310Z
2021-07-27T07:17:01.2284960Z
2021-07-27T07:17:01.2285770Z The following build commands failed:
2021-07-27T07:17:01.2288070Z PhaseScriptExecution [CP-User] Generate\ Specs /Users/runner/Library/Developer/Xcode/DerivedData/QualityGateTest-fpifffctlauicvdetlisjqinofwg/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/FBReactNativeSpec.build/Script-650A047D1ACF74FC1AD8108A78938588.sh
2021-07-27T07:17:01.2289360Z (1 failure)
2021-07-27T07:17:01.2705660Z ##[debug]success of first tool:false
2021-07-27T07:17:01.2787820Z ##[debug]rc:0
2021-07-27T07:17:01.2788560Z ##[debug]success:true
2021-07-27T07:17:01.2807190Z ##[debug]task result: Failed
2021-07-27T07:17:01.2844600Z ##[error]Error: /usr/bin/xcodebuild failed with return code: 65
2021-07-27T07:17:01.2856630Z ##[debug]Processed: ##vso[task.issue type=error;]Error: /usr/bin/xcodebuild failed with return code: 65
2021-07-27T07:17:01.2866680Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: /usr/bin/xcodebuild failed with return code: 65
2021-07-27T07:17:01.2867800Z ##[debug]Agent.Version=2.189.0
My observation is that the Azure pipeline does not have macOS Big Sur as Agent. My local machine changes some configurations during POD install and adds the script to support the latest Xcode and macOS and the azure pipeline agent does not support macOS Big Sur reason it is not able to execute the script.
NOTE: I have tried all clean processes like yarn, pod, or delete node_module.
[azure-devops]

I have got the solution for the issue.
Actually, the latest version of macOS Big Sur (11.4) was not having a node install on VM.
A) I did some changes in the pipeline.
pool:
vmImage: macOS-11
steps:
- checkout: self
persistCredentials: true
clean: true
- task: NodeTool#0
displayName: 'Install Node'
inputs:
versionSpec: 'v16.6.2' # you can use your desired version here
- script: yarn install
displayName: Install Dependencies
B)
Also created patch inside react native lib for version 0.64. by adding "unset PREFIX" on node_modules/react-native/scripts/find-node.sh

Related

How to use specific iOS version on Azure hosted agent?

I have a requirement to use exactly iOS 14.5 on our pipeline.
I tried the following:
variables:
sdk: 'iphoneos14.5' // I also tried to iphoneos
- task: Xcode#5
inputs:
actions: 'test'
configuration: '$(configuration)'
sdk: '$(sdk)'
xcWorkspacePath: 'MyProject.xcworkspace'
scheme: '$(secondaryScheme)'
xcodeVersion: 'specifyPath'
xcodeDeveloperDir: '/Applications/Xcode_13.2.1.app'
packageApp: false
destinationPlatformOption: 'iOS'
destinationSimulators: 'iPhone 11,OS=14.5'
args: '-derivedDataPath $(agent.buildDirectory)/DerivedData'
But both runs failed with
xcodebuild: error: SDK "iphoneos14.5" cannot be located.
##[error]Error: /usr/bin/xcodebuild failed with return code: 64
And
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS Simulator, OS:14.5, name:iPhone 11 }
That's what I understood from reading the preinstalled software documentation. https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md
Grateful if you could tell me what I am doing wrong
By using your pipeline definition, I am able to reproduce your issue.
I think below YAML file will help you understand why the official document said 'iOS 14.5' is supported but you can't use it.
pool:
name: Azure Pipelines
#Your build pipeline references an undefined variable named ‘secondaryScheme’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
steps:
- script: |
xcodebuild -showsdks
echo "========================================================="
sudo xcode-select -switch /Applications/Xcode_12.5.1.app/Contents/Developer
xcodebuild -showsdks
displayName: 'Command Line Script'
When you see the result of the pipeline run, I believe you will understand everything:
After switching the version, you should be able to use the specific IOS version you want.
Reference: https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow
You upload your app for notarization using notarytool command line
tool. Xcode 13 or later supports this tool, so if you have more than
one version of Xcode installed on your Mac, be sure to use the
xcode-select utility to choose an appropriate version:
% sudo xcode-select -s /path/to/Xcode13.app
Added this step
gem install xcode-install
xcversion simulators --install='iOS 13.5'
If someone finds a way to use the installed sdk for other Xcode, please comment here

Azure pipeline fails during xcode build for iOS project

Trying to build iOS project with xcode build. Using -
Xcode 12.4
Agent Specification - macOS-10.15
Workspace or project path - Project.xcworkspace
Configuration - Release (Tried with Debug also, it gives more error)
Scheme -valid name
SDK - iphoneos
Now After xcode build using Azure pipeline give following error.
We can build this xcode on locally and Gitlab too. But same code is failing on Azure Devops.
Kindly help.
2021-05-12T13:00:30.6465950Z ❌ /Users/runner/work/1/s/Project/Framework/csdk_common.framework/Modules/module.modulemap:2:19: umbrella header 'csdk_common.h' not found
2021-05-12T13:00:30.6466920Z
2021-05-12T13:00:30.6468430Z umbrella header "csdk_common.h"
2021-05-12T13:00:30.6471390Z ^
2021-05-12T13:00:30.6471830Z
2021-05-12T13:00:30.6472160Z
2021-05-12T13:00:30.6472470Z
2021-05-12T13:00:30.6473810Z ❌ /Users/runner/work/1/s/Project/TTS/main_internal.swift:2:8: could not build Objective-C module 'csdk_common'
2021-05-12T13:00:30.6474420Z
2021-05-12T13:00:30.6475000Z import csdk_common
2021-05-12T13:00:30.6475580Z ^
2021-05-12T13:00:30.6475930Z
2021-05-12T13:00:30.6476250Z
2021-05-12T13:00:30.6730310Z ** BUILD FAILED **
2021-05-12T13:00:30.6731680Z
2021-05-12T13:00:30.6732100Z
2021-05-12T13:00:30.6732840Z The following build commands failed:
2021-05-12T13:00:30.6733510Z CompileSwift normal arm64
2021-05-12T13:00:30.6740330Z CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
2021-05-12T13:00:30.6746120Z (2 failures)
2021-05-12T13:00:30.7025590Z ##[error]Error: /usr/bin/xcodebuild failed with return code: 65
2021-05-12T13:00:30.7365340Z ##[section]Finishing: Xcode build
Please check the repos branch, and make sure you have added this under framework header file. Maybe you did not push the right project and necessary part into the azure devops repos.
#import "xxx\csdk_common.h"
More info you could check this issue and that.

Cordova build failed for ios after installing pushwoosh notifications plugin

We have done ios app using cordova.We used pushwoosh plugin to send push notifications.Recently we have updated pushwoosh plugin from version 3.6.5 to 6.2.2 (https://github.com/Pushwoosh/pushwoosh-phonegap-plugin). After installing new version we are not able to build project.
cordova plugin add pushwoosh-cordova-plugin#6.2.2
After installing
cordova build ios
We are getting below error
The following build commands failed:
CpResource www/plugins/com.pushwoosh.plugins.pushwoosh/www/PushNotification.js build/emulator/ITCPapyra.app/PushNotification.js
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/apple/ITCPapyra/platforms/ios/cordova/build-debug.xcconfig,-project,ITCPapyra.xcodeproj,ARCHS=i386,-target,ITCPapyra,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/apple/ITCPapyra/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/apple/ITCPapyra/platforms/ios/build/sharedpch
ERROR building one of the platforms: Error: /Users/apple/ITCPapyra/platforms/ios/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/apple/ITCPapyra/platforms/ios/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
We are using cordova version 5.2.0, node version 4.4.7 .Please help how to solve this issue and build our project success.
You may not have the required environment or OS to build this project
Which environment do you use?

iOS + Jenkins + git + Archive

I use the Jenkins iOS Archive.
The jenkins project Console Output:
/bin/sh -c /Users/Shared/Jenkins/Home/jobs/YouKuHD/workspace/frameworks/download/build/DownloadManager.build/Debug-iphoneos/DownloadManager.build/Script-DB597F9F14DFD58700CDF0E3.sh
Could not find iphoneos in /Users/Shared/Jenkins/Home/jobs/YouKuHD/workspace/build
Command /bin/sh failed with exit code 1
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Run\ Script build/DownloadManager.build/Debug-iphoneos/DownloadManager.build/Script-DB597F9F14DFD58700CDF0E3.sh
(1 failure)
Build step 'Xcode' marked build as failure
Finished: FAILURE
My project files:
iPad28/frameworks/download/DownloadManager.xcodeproj
iPad28/frameworks/youku.coreYouku.xcodeproj
iPad28/ipad/YouKuHD.xcodeproj
Xcode configuration:
Advanced Xcode build options
Xcode Project File
ipad/YouKuHD.xcodeproj
What should I do?
I make a test project also failed
The following build commands failed:
Check dependencies
(1 failure)
Build step 'Xcode' marked build as failure
Finished: FAILURE
What should I do?

Jenkins can not run build Script

My Jenkins job set for an IOS Project clones (fetches) the code from Bitbucket but fails to run one of the last scripts for building the Xcode project.
The script is called.I get the following error it really does not mean a lot for me.
Has anyone had a similar problem.I am pretty sure that there is something wrong with the project settings since other jobs in the jenkins run perfect.
PhaseScriptExecution Run\ Script
/Users/jenkins/Library/Developer/Xcode/DerivedData/myApp-Workspace-doqiapyymubizteljhyzayqxdtyk/Build/Intermediates/Target.build/Release-iphoneos/Target.build/Script-334A8A5117785D7D001DC5DA.sh
cd "/Users/Shared/Jenkins/Home/workspace/myApp - BETA"
/bin/sh -c /Users/jenkins/Library/Developer/Xcode/DerivedData/myDriveriOSDriver-Workspace- doqiapyymubizteljhyzayqxdtyk/Build/Intermediates/Driver.build/Release-iphoneos/Driver.build/Script-334A8A5117785D7D001DC5DA.sh
fatal: Not a git repository: '/Users/Shared/Jenkins/Home/workspace/myApp - BETA/../.git'
VERSION: 2.1.3.0
2014-01-24 13:54:29.529 defaults[61460:507] Unexpected argument Driver; leaving defaults unchanged.
Command /bin/sh failed with exit code 1
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Run\ Script /Users/jenkins/Library/Developer/Xcode/DerivedData/myApp- Workspace-doqiapyymubizteljhyzayqxdtyk/Build/Intermediates/Target.build/Release-iphoneos/Target.build/Script-334A8A5117785D7D001DC5DA.sh
(1 failure)
The mentioned script sets some environment variables before the fatal error including;
...
setenv YACC yacc
setenv arch armv7s
setenv variant normal
There is a clear error in the log:
fatal: Not a git repository: '/Users/Shared/Jenkins/Home/workspace/myApp - BETA/../.git'
By analyzing your error log I guess that problem is in following statement
cd "/Users/Shared/Jenkins/Home/workspace/myApp - BETA"
instead try
cd "/Users/Shared/Jenkins/Home/workspace/myApp\ -\ BETA"
hope it helps

Resources