Permissions error in Jenkins when building CocoaPods based Xcode workspace - ios

I'm trying to setup Jenkins to compile an iOS Xcode project. The xcode project uses CocoaPods. However, I get this error in Jenkins when I attempt a build. All files in the Pods/ directory have full write/read/execute permissions. Any thoughts?
/bin/sh -c /Users/Shared/Jenkins/Library/Developer/Xcode/DerivedData/MyApp-dripdwqnufuksvhcfgcgxajaahyq/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-EAAE77068BA044C9B06632CE.sh
/Users/samy/Work/mobile/iphone/MyApp/Pods/Pods-resources.sh: line 5: /Users/samy/Work/mobile/iphone/MyApp/Pods/resources-to-copy-MyApp.txt: Permission denied
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Copy\ Pods\ Resources /Users/Shared/Jenkins/Library/Developer/Xcode/DerivedData/MyApp-dripdwqnufuksvhcfgcgxajaahyq/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-EAAE77068BA044C9B06632CE.sh
(1 failure)
Build step 'Xcode' marked build as failure
Finished: FAILURE

"Full read/write/execute permissions" for whom? Which user? Jenkins usually runs under it's own user, called jenkins

The only workaround I came across was to move the entire Xcode project to jenkins user directory.

You might want to add a custom build setting PODS_ROOT
PODS_ROOT=$(PROJECT_DIR)/Pods

Related

I can't start fastlane iOS build. gym ends up with error [duplicate]

following is the error in xcode
I have also tried build legacy from workspace settings but failed to do so.
Multiple commands produce '/Users/saifubaid/Library/Developer/Xcode/DerivedData/antispam-bjwrxskogxnnophfhgkpyxxcqcuj/Build/Intermediates.noindex/ArchiveIntermediates/antispam/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle':
Target 'React-Core.common-AccessibilityResources' has create directory command with output '/Users/saifubaid/Library/Developer/Xcode/DerivedData/antispam-bjwrxskogxnnophfhgkpyxxcqcuj/Build/Intermediates.noindex/ArchiveIntermediates/antispam/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'
Target 'React-Core.common-CoreModulesHeaders-AccessibilityResources' has create directory command with output '/Users/saifubaid/Library/Developer/Xcode/DerivedData/antispam-bjwrxskogxnnophfhgkpyxxcqcuj/Build/Intermediates.noindex/ArchiveIntermediates/antispam/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'
stuck on it. tried almost every solution.
Multiple commands produce '/Users/shubhamnagota/dev/zest/zest-app/ios/DerivedData/zestapp/Build/Intermediates.noindex/ArchiveIntermediates/zestapp/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle':
Click on Pods App
From the list remove React-Core-AccessibilityResources
Clean Project
Build Again
Archive.
Worked for me! :)

GitHub Actions workflow fails for iOS Build

I am trying to set up CI/CD for my React Native App using GitHub actions. I have added Firebase configuration files for my project as GitHub Secrets. The iOS build workflow fails with the following error log.
2021-10-05T12:43:48.3073900Z ** BUILD FAILED **
2021-10-05T12:43:48.3075130Z
2021-10-05T12:43:48.3075970Z
2021-10-05T12:43:48.3077170Z The following build commands failed:
2021-10-05T12:43:48.3081040Z CopyPlistFile /Users/runner/Library/Developer/Xcode/DerivedData/TLS-dlqmcvmjotwzuugkybwxlhjuzmzz/Build/Products/Debug-iphoneos/TLS.app/GoogleService-Info.plist /Users/runner/work/ALT/ALT/App/ios/GoogleService-Info.plist
2021-10-05T12:43:48.3086250Z (1 failure)
2021-10-05T12:43:48.3584560Z ##[error]Process completed with exit code 65.
I have tried changing the target path of the GoogleService-Info.plist but the same error persists. The workflow file can be found here. Any insights into this would be helpful.

Error while trying to run script in Xcode for firebase crash reporting

I am trying to integrate the crash reporting of firebase in my project. Though I am successfully getting the crash report in the firebase console I seem to get these 3 errors:
/Users/human/Library/Developer/Xcode/DerivedData/DummyProject-cousedziotoermfdyvgdmbmchdta/Build/Intermediates/DummyProject.build/Debug-iphoneos/DummyProject.build/Script-45E477EF1D33D4631052B160.sh:
line 3: /Users/human/DummyProject/ServiceAccount.json:
Permission denied
cat: : No such file or directory
Command /bin/sh emitted errors but did not return a nonzero exit code
to indicate failure
How do I resolve these errors?
I followed these instructions in firebase
Try the following:
Replace the Run Script build phase you added in Step 3b of the instructions with the simplified:
"${PODS_ROOT}"/FirebaseCrash/upload-sym
In short, delete everything but the last line. This will put upload-sym in interactive mode. If you did not use Cocoapods to install FirebaseCrash, use the full path to the upload-sym script where you installed the framework.
Delete any cached credentials you may have accidentally added:
/bin/rm -f $HOME/Library/Preferences/com.google.SymbolUpload.plist
/bin/rm -f $HOME/Library/Preferences/com.google.SymbolUploadToken.plist
Do a build. When the Run Script build phase starts, you will be prompted with a dialog for the location of the JSON credential file you downloaded in Step 1 of the instructions. You will only be prompted once. Future builds will have the information in the credential cache. If you have permission problems, make sure you have the right JSON file and repeat step 2 above.
What is your "Debug Information Format" set to in your Xcode Build Options? If it’s set to only "DWARF" it will show this erros during build. You could set to "DWARF with dSYM File" errors should disappear.

Jenkins not downloading Android SDK automatically

I'm running Jenkins locally on my mac and I can't seem to get Jenkins to download the Android SDK automatically. I'm not defining a path, and according to the documentation, Jenkins will auto download it. What am I missing here?
"The plugin will automatically download and install the Android SDK, if it's not already installed when a build starts."
Jenkin Log
[Gradle] - Launching build.
[workspace] $ /var/root/.jenkins/jobs/TestingBuild/workspace/gradlew clean
FAILURE: Build failed with an exception.
* Where:
Build file '/private/var/root/.jenkins/jobs/TestingBuild/workspace/app/build.gradle' line: 17
* What went wrong:
A problem occurred evaluating project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 19.418 secs
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
So two days later... problem solved. I had to place an instance of the android sdk at this location. /Users/Shared/Jenkins/Home/tools/android-sdk. I also set an Environment variable ANDROID_HOME with the same path. Here's a screenshot.

Target "debug" doesn't exist in the Project

I have tried to create APK file using the "ant debug" command. But when i tried i got the following error
Build Failed
Target "debug" does not exist in the Project "androiddemo"
Total Time: 0 Seconds
Build Failed
Target "release" does not exist in the Project "androiddemo"
Total Time: 0 Seconds
Checked with release command also. Getting the same error. Could you please guide me to get APK file of Android application
I did a stupid mistake with my command. The actual command is
"ant -debug"
But APK file is not created. Is anything i missed in that?

Resources