Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cocoapods version check fails on Travis CI #462

Closed
4 of 5 tasks
tsimbalar opened this issue Jul 16, 2020 · 2 comments
Closed
4 of 5 tasks

Cocoapods version check fails on Travis CI #462

tsimbalar opened this issue Jul 16, 2020 · 2 comments
Labels
bug Something isn't working properly build issue An issue related to build process ios relates to iOS platform

Comments

@tsimbalar
Copy link

Bug report

CHECKLIST

  • I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
  • I have checked that no similar issues (open or closed) already exist.

Current behavior:

On travis CI, when using image xcode11.5 which comes with CocoaPods v1.9.2, when running

ionic cordova platform add ios

prints the following at some point :

Failed to install 'cordova-plugin-firebasex': Error: cocoapods version is invalid - please reinstall cocoapods@^1.9.0: Resolving dependencies...

1.9.2

    at checkCocoapodsVersion (/Users/travis/build/Alpha-health/perspectives-app/plugins/cordova-plugin-firebasex/scripts/ios/before_plugin_install.js:19:15)

    at module.exports (/Users/travis/build/Alpha-health/perspectives-app/plugins/cordova-plugin-firebasex/scripts/ios/before_plugin_install.js:7:5)

    at runScriptViaModuleLoader (/Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)

    at runScript (/Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)

    at /Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20

    at processTicksAndRejections (internal/process/task_queues.js:94:5)

Failed to restore plugin "cordova-plugin-firebasex" from config.xml. You might need to try adding it again. Error: Error: cocoapods version is invalid - please reinstall cocoapods@^1.9.0: Resolving dependencies...

1.9.2

cordova-plugin-firebasex: Preparing Firebase on iOS

[ERROR] An error occurred while running subprocess cordova.

        

        cordova platform add ios@5.1.1 exited with exit code 1.

        

        Re-running this command with the --verbose flag may provide more information.


In spite of this error, though, the build carries on.

Expected behavior:

The plugin should be installed properly as 1.9.2 complies with ^1.9.0.

Steps to reproduce:

Not 100% sure if this is related to Cocoapods version or the Travis environment.

In there, running

pod --version

prints out

Resolving dependencies...
1.9.2

Screenshots

image

image

Environment information

  • Cordova CLI version
    • cordova -v
  • Cordova platform version
    • cordova platform ls
  • Plugins & versions installed in project (including this plugin)
    • cordova plugin ls
  • Dev machine OS and version, e.g.
    • OSX
      • sw_vers
    • Windows 10
      • winver

Runtime issue

  • OS details
    • Building on OSX

iOS build issue:

Build language: objective-c

Build id: 175871121

Job id: 361678322

Runtime kernel version: 19.4.0

travis-build version: 01e86bea

Build image provisioning date and time

Tue May 26 19:33:34 GMT 2020

Operating System Details

ProductName:	Mac OS X

ProductVersion:	10.15.4

BuildVersion:	19E287

Git version

git version 2.26.2

bash version

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)

Copyright (C) 2007 Free Software Foundation, Inc.

GCC version

Apple clang version 11.0.3 (clang-1103.0.32.62)

Target: x86_64-apple-darwin19.4.0

Thread model: posix

InstalledDir: /Applications/Xcode-11.5.GM.Seed.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

LLVM version

Apple clang version 11.0.3 (clang-1103.0.32.62)

Target: x86_64-apple-darwin19.4.0

Thread model: posix

InstalledDir: /Applications/Xcode-11.5.GM.Seed.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Pre-installed Ruby versions

ruby-2.6.6

Pre-installed Node.js versions

v10.20.1

v12.16.3

v12.17.0

v13.14.0

v14.3.0

v4.9.1

v6.17.1

v8.17.0

mvn -version

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)

Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec

Java version: 13.0.2, vendor: N/A, runtime: /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home

Default locale: en_US, platform encoding: UTF-8

OS name: "mac os x", version: "10.15.4", arch: "x86_64", family: "mac"


Other information:

I believe the install fails because of the code in

function checkCocoapodsVersion(){
var stdout;
try{
stdout = execSync('pod --version', {encoding: 'utf8'}).trim();
}catch(err){
throw new Error("cocoapods not found - please install cocoapods >="+minCocoapodsVersion);
}
if(!semver.valid(stdout)){
throw new Error("cocoapods version is invalid - please reinstall cocoapods@"+minCocoapodsVersion + ": "+stdout);
}else if(!semver.satisfies(stdout, minCocoapodsVersion)){
throw new Error("cocoapods version is out-of-date - please update to cocoapods@"+minCocoapodsVersion + " - current version: "+stdout);
}
}

That code expects the output of pod --version to be a single-line string with a version number (which seems like a valid assumption) , but it therefore fails to parse this multiline string

Resolving dependencies...
1.9.2

One option might be to be a bit more laxist, and expect the version number to be on the last line of the stdout, and just validate that part.

@tsimbalar tsimbalar changed the title Cocoapods version check fails on Travis with Cocoapods v1.9.2 Cocoapods version check fails on Travis CI Jul 16, 2020
@tsimbalar
Copy link
Author

Update : I could also reproduce it on a different Travis image (XCode12) which comes with Cocoapods v1.9.3 (the latest I believe)

pod --version

also prints

Resolving dependencies...
1.9.3

and therefore the build shows the same message :

Failed to install 'cordova-plugin-firebasex': Error: cocoapods version is invalid - please reinstall cocoapods@^1.9.0: Resolving dependencies...

1.9.3

    at checkCocoapodsVersion (/Users/travis/build/Alpha-health/perspectives-app/plugins/cordova-plugin-firebasex/scripts/ios/before_plugin_install.js:19:15)

    at module.exports (/Users/travis/build/Alpha-health/perspectives-app/plugins/cordova-plugin-firebasex/scripts/ios/before_plugin_install.js:7:5)

    at runScriptViaModuleLoader (/Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)

    at runScript (/Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)

    at /Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20

    at processTicksAndRejections (internal/process/task_queues.js:94:5)

Failed to restore plugin "cordova-plugin-firebasex" from config.xml. You might need to try adding it again. Error: Error: cocoapods version is invalid - please reinstall cocoapods@^1.9.0: Resolving dependencies...

1.9.3

cordova-plugin-firebasex: Preparing Firebase on iOS

[ERROR] An error occurred while running subprocess cordova.

        

        cordova platform add ios@5.1.1 exited with exit code 1.

        

        Re-running this command with the --verbose flag may provide more information.

@dpa99c
Copy link
Owner

dpa99c commented Jul 16, 2020

Maybe the best approach is to use a regex to extract the version number from the stdout before comparing it with semver:
/\d+\.\d+\.\d+/

@dpa99c dpa99c added bug Something isn't working properly build issue An issue related to build process ios relates to iOS platform labels Jul 16, 2020
@dpa99c dpa99c closed this as completed in d02692c Jul 16, 2020
@dpa99c dpa99c added the ready for release Something has been implemented and is awaiting release to npm label Jul 16, 2020
@dpa99c dpa99c removed the ready for release Something has been implemented and is awaiting release to npm label Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly build issue An issue related to build process ios relates to iOS platform
Projects
None yet
Development

No branches or pull requests

2 participants