Fastlane command not found in XCode bots post build trigger - xcode

Here's my script
echo "===================="
echo "MAKE ENTERPRISE IPA"
echo "===================="
pwd
cd "${XCS_PRIMARY_REPO_DIR}/"
pwd
fastlane enterprise
This is what's in the logs
====================
MAKE ENTERPRISE IPA
====================
/Users/XcodeServer/Library/Caches/XCSBuilder/Bots/1fc5d5c4b44f01807859f14cc303b56c/Source
/Users/XcodeServer/Library/Caches/XCSBuilder/Bots/1fc5d5c4b44f01807859f14cc303b56c/Source/ProjectName
/var/folders/rc/28t61gwn3c1bcsn1b360d0h40000gp/T/F389538F-77F0-481A-A413-456C809755D1-22343-000364DDDB596983: line 10: fastlane: command not found
If I march directly to the directory on the build server and go to XCS_PRIMARY_REPO_DIR and type in fastlane enterprise everything works fine. I don't know why it's looking in var/folders for fastlane.
Any help would be greatly appreciated thank you.

I added usr/local/bin to the path. I added the following line before I call fastlane. If anyone knows of a better place to put it. I'm all ears.
export PATH=/usr/local/bin:$PATH

Follow this steps:
Navigate inside the repo. e.g.cd TemplateProject.
Add fastlane command.(Since xcode server can't find the Fastlane command you need to specify path)
To know the path navigate to your project folder from terminal and execute command:
which fastlane
Result will look as:
/Users/yourcomputername/.fastlane/bin/fastlane beta
Now use this to create a post Script command as attached in the image
This now makes xcode server find your fastlane.

Related

zsh: command not found: hiptest-publisher

I'm using hiptest-publisher in order to push test results on the cucumber studio platform. The tests run and pass.
I installed Ruby and then ran gem install hiptest-publisher.
When I try to run this command to push the test execution result back to Cucumber Studio:
hiptest-publisher --config-file=<path> --push="target/cucumber.json" --push-format=cucumber-json --test-run-id=123
I receive this error:
Any advice to solve this problem is welcome.
Thanks a lot!
Problem solved!
How did I solve it?
Step 1
$ gem environment
Will tell you the EXECUTABLE DIRECTORY.
Step 2
Put whatever that value is in your PATH in your .bashrc or other shell config file.
export PATH="$PATH:/path/to/bin"
Thank you!

CFBundleIdentifier does not exist on react-native

Easy bounty here for grabs. Does not necessarily require any react-native experience. Problem seems to be in open source code, which is available out there:
Updated xcode, and now when I try to run my react-native app by issuing following command: react-native run-ios I get an error:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/MyAppName.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
debug Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/MyAppName.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnSimulator (project-root-dir/node_modules/#react-native-community/cli/build/commands/runIOS/runIOS.js:181:45)
Before those errors, the command prints out info about successful build, and that it is about to install the build:
info ** BUILD SUCCEEDED **
info Installing DerivedData/Build/Products/Debug-iphonesimulator/MyAppName.app
So it seems the build is ok, but when it tries to install the app it fails?
Think I've tried "everything" I found from other questions with this similar error message, but nothing has worked for me.
Some specs:
react-native: 0.59.10
react: 16.8.3
xcode-version: Version 12.2 (12B45b)
I know there are similar questions on stackoverflow. But since none of the solutions provided there worked for me, and I wish to get it fixed, I made this separate question.
I do not know where the Info.plist file is that it tries to find: DerivedData/Build/Products/Debug-iphonesimulator/MyAppName.app/Info.plist
Inside my ios folder, there is a folder called DerivedData, but inside that there are no folder with a name Build. So I think it might be looking from a wrong location?
UPDATE:
I've been able to pinpoint where the cli launch goes wrong:
https://github.com/react-native-community/cli/blob/ba298d9c47af522f0377325bebc6c2075d41790a/packages/platform-ios/src/commands/runIOS/index.ts#L378
If I change that line let buildPath = build/${scheme}/Build/Products/${configuration}-${device}/${appName}.app
to -> build/${scheme}/Build/Products/${configuration}-${device}/MyAppRealName.app;
Then the dev launch works nicely, there's no problem. So it seems that getting the appName goes wrong. The appName is resolved here: https://github.com/react-native-community/cli/blob/ba298d9c47af522f0377325bebc6c2075d41790a/packages/platform-ios/src/commands/runIOS/index.ts#L387
const productNameMatch = /export FULL_PRODUCT_NAME="?(.+).app"?$/m.exec(buildOutput);
I could do a post install npm script that just sets the name of the app correct and call it a day. But that's pretty hacky way. I wonder if there's an alternative that works better? I see that the runIOS file has been updated from the version that I have quite much, but the function getProductName still remains the same. So Im not sure if updating just the cli would work, or if it would even be possible, because it might require a newer react-native version, which is not an option for me right now.
newer version of #react-native-community/cli is not working on older version react-native because in newer version they have change getProductName to getPlatformName. for more detail you can read summary of this PR
Solution
As a local workaround, patch the package by patch-package node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js and edited getProductName (lines 362–365) to read:
function getProductName(buildOutput) {
const productNameMatch = /export FULL_PRODUCT_NAME\\?="?(.+).app"?$/m.exec(buildOutput);
return productNameMatch ? productNameMatch[1].replace(/(?:\\(.))/g, '$1') : null;
}
The result from react-native run-ios is:
DerivedData/Build/Products/Debug-iphonesimulator/MyAppName.app/Info.plist
The correct should be:
DerivedData/Build/Products/Debug-iphonesimulator/MyAppRealName.app/Info.plist
Then you could fix it by edit Xcode project as:
Open Product menu (status bar)
Scheme -> Edit Scheme
Under build section, add a post-action
In provide build settings from: choose target of your app
Use the script to copy wrongname.app to realname.app: cp ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app ${BUILT_PRODUCTS_DIR}/real_name.app
Or you can use symlinks instead of copying.

After installing go and setting my path, I am still getting an error

After installing golang according to the instructions on the golang website, I set the path as it said to by using export PATH=$PATH:/usr/local/go/bin and whenever I use the command $HOME/go it says bash: /home/ken/go: No such file or directory
I can verify go is installed and I even reset my computer to make sure the changes took place. Does anybody know what I can do to resolve this issue? Am I missing something?
As per the instructions on the Go installation page, you do need to manually create the go folder:
cd $HOME
mkdir go
cd go
Then create your first go program: https://gobyexample.com/hello-world
And run with go run hello-world.go. Should be good ;)

How to automatically confirm all fastlane commands with "Yes"

I want to execute fastlane command to update project signing.
fastlane run update_project_codesigning path:"PROJECT.xcodeproj"
For the first time it always asks for confirmation "Yes" or "No" to update xcode xcode format:
[18:50:33]: Updating the Automatic Codesigning flag to disabled for the given project '/Users/user/.jenkins/workspace/PROJECT-IOS/platforms/ios/PROJECT.xcodeproj/project.pbxproj'
[18:50:33]: Seems to be a very old project file format
[18:50:33]: PLEASE BACKUP ALL FILES before doing this.
Proceed with upgrade to xcode8 format? (y/n)
In terminal I can do
yes | fastlane run update_project_codesigning path:"PROJECT.xcodeproj"
and it works.
But on Jenkins it doesn't work. As far as I understood, Jenkins doesn't support interactive commands.
How can I automatically set "YES" confirmation for all fastlane commands?
I found out how to automatically confirm changing the xcode format.
Just set the FL_PROJECT_SIGNING_FORCE_UPGRADE environment variable to 1 or true.
I did:
export FL_PROJECT_SIGNING_FORCE_UPGRADE=1
fastlane run update_project_codesigning path:"PROJECT.xcodeproj"
and it works

p4 command not found

I'm trying to use p4 commands in my batch files on Mac like p4 login etc.
I keep getting the error "-bash p4: command not found".
I followed the top 7 steps here and got the same error:
http://www.endlesslycurious.com/2008/11/11/configuring-p4-command-line-client-on-mac-os-x/
I couldn't find anything else useful when searching.
Has anyone else encountered a similar issue and resolved it?
Just drop the "p4" executable in /usr/local/bin or even /usr/bin if you prefer. ;-)
How-To steps:
(1) Download p4 file for macOS from:
https://www.perforce.com/downloads/helix-command-line-client-p4
(2) Copy the item to any local folder under any custom folder. For ex: '/Users//perforce'
(3) Run the following commands in terminal.
chmod +x /Users/<yourname>/perforce/p4
export PATH=/Users/<yourname>/perforce:$PATH
(4) Now run 'p4' in terminal.
This should not fail!
To add to the existing answers, on my macOS Mojave, downloading Perforce 2019.1/1796703 for OSX 10.10+ using Safari gives me a p4.dms file.
You must rename it to p4 first before using it. Any attempt to unarchive the .dms file will fail. It is not a valid DMS archive.

Resources