jenkins-artifactory-plugin
jenkins-artifactory-plugin copied to clipboard
Jenkins Scripted pipeline step rtNpm.publish failing if the npm script 'prepare' is in use in package.json
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.
To Reproduce
- Add prepare script to package.json "prepare": "echo 'nothing'"
- 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.