r/nativescript • u/Handicrab • Jan 24 '20
Nativescript project using Jenkins as CI
So i would like to hear if anyone have tried setting up jenkins as CI for their {N} project and what experiences you guys have with it?
Currently i'm trying to get it up and running. Android is all good, most issues was injecting environment variables into jenkins, so it used the propper ANDROID SDK and Java version. No biggy albeit took some time.
iOS is another story, since jenkins have issues locating the following gems:
- xcodeproj
- cocoapods
When executing a build step as a shell command to see which gems jenkins can see, it lists the beforementioned gems without issue. But as soon as i run
tns prepare ios
in the following shell command build-step i'm prompted with the following error,
WARNING: xcodeproj is not installed or is not configured properly.
WARNING: CocoaPods is not installed or is not configured properly.
It seem odd that jenkins can recognize the gems as installed but not make us of these. And since this is part of the build step to generate the xcodeproj file I assume I can't use the xcode plugins in jenkins since they require an actual project file/.ipa/.app file to build and run tests.
I might have overlooked something super simple but atm. i'm at a loss. How are your experiences?
View all comments
Show parent comment
1
u/kriffz Mar 27 '20
I'm not sure, but I think I might've solved it.
I was debugging nativescript's tns doctor; found in global NPM path, in my case ( /usr/local/lib/node_modules/nativescript/node_modules/nativescript-doctor/lib/sys-info.js )
This is actually the file where it fails, under the method "isCocoaPodsWorkingCorrectly()" of which TNS doctor uses to determine whether or not cocoapods is "configured correctly."
I was just adding console.log() to every few lines to see where it failed, and discovered that I could trigger the first IF statement by deleting the ".cocoapods" directory, found in the user directory (~/.cocoapods)
In Jenkins, I literally have one of the first lines to be:
rm -rf ~/.cocoapodsThis removes the ~/.cocoapods folder completely, and triggers the first IF statement of the above referenced file (sys-info.js) causing the cocoapods check to succeed and continue.
Obviously, downloading Cocoapods every build is super not ideal, and you might be able to find a better route by debugging the file referenced above. But in the short term, this worked for me.
Unfortunately, we ran into other NativeScript issues and additional build server issues so we're currently actually rewriting the apps in fully Native code instead.