eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.2k stars 867 forks source link

Plugin is incompatible with AWS CodeBuild #1102

Closed nkavian closed 11 months ago

nkavian commented 11 months ago

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Maven builds fail on AWS.

If the current behavior is a bug, please provide the steps to reproduce.

Create an AWS CodeBuild project and specify in the buildspec.yml to build your Java 11 maven project.

Configure the build server as Amazon Linux 2 x86_64 standard:corretto11.

The build fails, and with debug logging it's basically complaining about missing system libraries.

[INFO] Running 'npm install' in /codebuild/output/src3170213863/src/git-codecommit.eu-west-1.amazonaws.com/v1/repos/versal/versalpayments-server
[DEBUG] Executing command line [/codebuild/output/src3170213863/src/git-codecommit.eu-west-1.amazonaws.com/v1/repos/versal/versalpayments-server/node/node, /codebuild/output/src3170213863/src/git-codecommit.eu-west-1.amazonaws.com/v1/repos/versal/versalpayments-server/node/node_modules/npm/bin/npm-cli.js, install]
[INFO] /codebuild/output/src3170213863/src/git-codecommit.eu-west-1.amazonaws.com/v1/repos/versal/versalpayments-server/node/node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /codebuild/output/src3170213863/src/git-codecommit.eu-west-1.amazonaws.com/v1/repos/versal/versalpayments-server/node/node)
[INFO] /codebuild/output/src3170213863/src/git-codecommit.eu-west-1.amazonaws.com/v1/repos/versal/versalpayments-server/node/node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /codebuild/output/src3170213863/src/git-codecommit.eu-west-1.amazonaws.com/v1/repos/versal/versalpayments-server/node/node)

What is the expected behavior?

If this plugin insists on controlling the NodeJS version, it should also resolve the dependency issues.

Initially I was trying to install node myself into the build pipeline and found out this plugin is specifically against it.

Additional context / workaround:

https://docs.aws.amazon.com/codebuild/latest/userguide/available-runtimes.html

Please mention your frontend-maven-plugin and operating system version.

1.13.4

eirslett commented 11 months ago

I'm not sure there's anything that can be done 🤷 if using Node 14 is OK then I guess the problem is solved! Or maybe upgrade to Java 17 to get the latest Ubuntu and unlock the newest Node version...

nkavian commented 11 months ago

I was hoping for a different outcome. If this plugin is insisting it doesn't want to use Node/NPM installed by the user, then this plugin should manage and take care of the dependencies. Alternatively, I was really hoping that it would be understood that locking Node/NPM this was actually impractical and that users should be allowed to manage it on their own if they need to.

I can't for example, just upgrade from Java 11 to Java 17, since I have other Java dependencies that require Java 8/11. I'm caught in the middle since others are locking things.

I found the workaround because I understand system library issues, but I don't think others will be as lucky.

thanks for the quick response.

eirslett commented 11 months ago

This plugin might not be the right tool for the job. For use cases where you would like to use system-provided node/npm binaries (and not lock down the versions), the exec-maven-plugin is a much better alternative: https://www.mojohaus.org/exec-maven-plugin/ Another option is to use a Docker image with the newer Ubuntu but with JDK 11? I think you might have stumbled upon an edge case. As far as I know, there are no other reports of this bug.

nkavian commented 11 months ago

Agreed, it is likely an edge case or very limited case.

It requires an enterprise that needs to uses a (CI/CD) deploying a (Java) application with the necessity to bring in (Node modules) that would be deployed on (AWS CodeBuild).

That combination is likely rare.

clementepereyra commented 9 months ago

Hi @nkavian, I am facing pretty much the same issue here. Can you please share the workaround you found? Thanks.

nkavian commented 4 months ago

@clementepereyra sorry for the delayed response

In the AWS build project I use an Environment Image of aws/codebuild/standard:5.0.

In the buildspec.yml I use:

phases:
  install:
    runtime-versions:
      java: corretto11.x
      nodejs: 14.x

If standards:5.0 is ever retired, then we have a major blocker.