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

Jenkins Scripted pipeline step rtNpm.publish failing if the npm script 'prepare' is in use in package.json #931

Open
arumugamsubramanian opened this issue May 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@arumugamsubramanian
Copy link

Describe the bug
After upgrading the nodejs v20.12.0 and npm 10.5.0, the npm pack and publish step has default foreground-scripts to true. Reference - https://docs.npmjs.com/cli/v10/using-npm/changelog#1050-2024-02-28. (818957c #7158 pack, publish: default foreground-scripts to true (#7158) (@ljharb))

if package.json has prepare npm script, rtNpm.publish step will try to run npm pack and the prepare script. Since rtNpm.publish does not have option to pass args, we are not able to fix this problem. We can pass extra args --ignore-scripts

def buildInfo = rtNpm.publish path: 'npm-example', args: '--ignore-scripts'

it looks like --ignore-scripts is also not ignoring the prepare scripts. Any help would be appreciated.

Error:
16:14:00 May 01, 2024 10:44:00 AM org.jfrog.build.extractor.packageManager.PackageManagerLogger error
16:14:00 SEVERE: ./> [email protected] prepare
16:14:00 > echo 'nothing'
16:14:00
16:14:00 nothing
16:14:00 web-ui-2.6.1-SNAPSHOT.tgz (No such file or directory)
16:14:00 java.io.FileNotFoundException: ./> [email protected] prepare
16:14:00 > echo 'nothing'
16:14:00
16:14:00 nothing
16:14:00 web-ui-2.6.1-SNAPSHOT.tgz (No such file or directory)
16:14:00 at java.base/java.io.FileInputStream.open0(Native Method)
16:14:00 at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
16:14:00 at java.base/java.io.FileInputStream.(FileInputStream.java:157)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.readPackageInfoFromTarball(NpmPublish.java:119)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.deploy(NpmPublish.java:139)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.execute(NpmPublish.java:93)
16:14:00 at org.jfrog.build.extractor.packageManager.PackageManagerExtractor.executeAndSaveBuildInfo(PackageManagerExtractor.java:33)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.main(NpmPublish.java:78)

To Reproduce

  1. Add prepare script to package.json
    "prepare": "echo 'nothing'"
  2. run rtNpm.publish step in Jenkins

Expected behavior
Success pack and publish to artifactory

Screenshots
If applicable, add screenshots to help explain your problem.

Versions

  • Jenkins Artifactory plugin version: 4.0.6
  • Jenkins operating system: 2.375.3
  • Artifactory Version: 7.41.12

Additional context
Add any other context about the problem here.

@arumugamsubramanian arumugamsubramanian added the bug Something isn't working label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant