jfrog / jfrog-cli

JFrog CLI is a client that provides a simple interface that automates access to the JFrog products.
https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
Apache License 2.0
529 stars 227 forks source link

JFROG CLI 2.54.0 regression upon npm p execution #2499

Closed Thomas-Boutin closed 5 months ago

Thomas-Boutin commented 6 months ago

Describe the bug

Hey, Since the new version of the JFROG CLI, the command jfrog npm p does not build anymore but leads to a runtime error. Everything's ok in the 2.53.2.

Current behavior

jfrog npm p --build-name=vod-nutflix-front --build-number=0.6.0-0 vod-nutflix-front-0.6.0-0.tgz --registry <artifactory>
16:05:32  panic: runtime error: invalid memory address or nil pointer dereference
16:05:32  [signal SIGSEGV: segmentation violation code=0x1 addr=0x24 pc=0x872aeda]
16:05:32  
16:05:32  goroutine 1 [running]:
16:05:32  github.com/jfrog/jfrog-client-go/utils/io/content.(*ContentReader).NextRecord(0x0, {0x8bac6a0, 0xb87e4e0})
16:05:32    /root/go/pkg/mod/github.com/jfrog/jfrog-client-go@v1.38.0/utils/io/content/contentreader.go:66 +0x6a
16:05:32  github.com/jfrog/jfrog-client-go/artifactory/services/utils.ConvertArtifactsDetailsToBuildInfoArtifacts(0x0)
16:05:32    /root/go/pkg/mod/github.com/jfrog/jfrog-client-go@v1.38.0/artifactory/services/utils/resultutils.go:86 +0x85
16:05:32  github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/npm.(*NpmPublishCommand).Run(0xba87620)
16:05:32    /root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/v2@v2.49.0/artifactory/commands/npm/publish.go:197 +0x40a
16:05:32  github.com/jfrog/jfrog-cli-core/v2/common/commands.Exec({0x8ebdaa8, 0xba87620})
16:05:32    /root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/v2@v2.49.0/common/commands/command.go:26 +0xa6
16:05:32  github.com/jfrog/jfrog-cli/buildtools.NpmPublishCmd(0xb92e420)
16:05:32    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/buildtools/cli.go:868 +0x26b
16:05:32  github.com/jfrog/jfrog-cli/buildtools.npmGenericCmd(0xb92e420, {0xfff397b7, 0x1}, 0x0)
16:05:32    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/buildtools/cli.go:830 +0x138
16:05:32  github.com/jfrog/jfrog-cli/buildtools.GetCommands.func11(0xb92e420)
16:05:32    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/buildtools/cli.go:331 +0x190
16:05:32  github.com/urfave/cli.HandleAction({0x8b475a0, 0x8d46618}, 0xb92e420)
16:05:32    /root/go/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:524 +0x50
16:05:32  github.com/urfave/cli.Command.Run({{0x8c7bb82, 0x3}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x8ca4ce6, 0x10}, {0x8d324f7, ...}, ...}, ...)
16:05:32    /root/go/pkg/mod/github.com/urfave/cli@v1.22.14/command.go:175 +0x63e
16:05:32  github.com/urfave/cli.(*App).Run(0xb925340, {0xb828140, 0x8, 0x8})
16:05:32    /root/go/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:277 +0xb11
16:05:32  main.execMain()
16:05:32    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/main.go:139 +0x4d5
16:05:32  main.main()
16:05:32    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/main.go:78 +0x23

Reproduction steps

Expected behavior

It should build

JFrog CLI version

2.54.0

Operating system type and version

RHEL 8 in docker

JFrog Artifactory version

No response

JFrog Xray version

No response

EyalDelarea commented 6 months ago

Hey @Thomas-Boutin, Thank you for using JFrog CLI!

I was unsuccessful in replicating the problem. Could you kindly offer more detailed instructions on how to reproduce it?

  1. Set CLI debug log level by : export JFROG_CLI_LOG_LEVEL=DEBUG
  2. Share the package.json file.

Providing thorough steps to recreate this issue would greatly assist us in resolving it.

I made an attempt to replicate the issue by installing version v2.54.0 of the CLI within a RHEL 8 Docker image, but the problem did not arise.

image

Thomas-Boutin commented 6 months ago

Hi @EyalDelarea !

Here are the logs and the package.json. I've hidden some internal addresses :

13:48:27  + jfrog rt build-add-git vod-nutflix-front 0.6.0-0
13:48:27  12:48:27 [Debug] JFrog CLI version: 2.54.0
13:48:27  12:48:27 [Debug] OS/Arch: linux/386
13:48:27  12:48:27 [Info] Reading the git branch, revision and remote URL and adding them to the build-info.
13:48:27  12:48:27 [Debug] Usage Report: Sending info...
13:48:27  12:48:27 [Debug] Saving build general details at: /tmp/jfrog/builds/5e17912350ad07bdcae1b09d08d8b111f50e90d187ff3895a8f3637c3bb2dcf7/partials
13:48:27  12:48:27 [Debug] Creating temp build file at: /tmp/jfrog/builds/5e17912350ad07bdcae1b09d08d8b111f50e90d187ff3895a8f3637c3bb2dcf7/partials
13:48:27  12:48:27 [Debug] Collected VCS details for vod-nutflix-front/0.6.0-0.
13:48:27  12:48:27 [Debug] Sending HTTP GET request to: http://<artifactory>/artifactory/api/system/version
13:48:27  12:48:27 [Debug] Artifactory response: 200 
13:48:27  12:48:27 [Debug] JFrog Artifactory version is: 7.55.9
13:48:27  12:48:27 [Debug] Sending HTTP POST request to: http://<artifactory>/artifactory/api/system/usage
13:48:27  + jfrog rt build-collect-env vod-nutflix-front 0.6.0-0
13:48:27  12:48:27 [Debug] JFrog CLI version: 2.54.0
13:48:27  12:48:27 [Debug] OS/Arch: linux/386
13:48:27  12:48:27 [Info] Collecting environment variables...
13:48:27  12:48:27 [Debug] Reading build general details from: /tmp/jfrog/builds/5e17912350ad07bdcae1b09d08d8b111f50e90d187ff3895a8f3637c3bb2dcf7/partials
13:48:27  12:48:27 [Debug] Usage Report: Sending info...
13:48:27  12:48:27 [Debug] Creating temp build file at: /tmp/jfrog/builds/5e17912350ad07bdcae1b09d08d8b111f50e90d187ff3895a8f3637c3bb2dcf7/partials
13:48:27  12:48:27 [Info] Collected environment variables for vod-nutflix-front/0.6.0-0.
13:48:27  12:48:27 [Debug] Sending HTTP GET request to: http://<artifactory>/artifactory/api/system/version
13:48:27  12:48:27 [Debug] Artifactory response: 200 
13:48:27  12:48:27 [Debug] JFrog Artifactory version is: 7.55.9
13:48:27  12:48:27 [Debug] Sending HTTP POST request to: http://<artifactory>/artifactory/api/system/usage
[Pipeline] sh
13:48:27  + jfrog -v
[Pipeline] sh
13:48:27  + jfrog npm p --build-name=vod-nutflix-front --build-number=0.6.0-0 vod-nutflix-front-0.6.0-0.tgz --registry <artifactory>/artifactory/api/npm/<repository>
13:48:27  12:48:27 [Debug] JFrog CLI version: 2.54.0
13:48:27  12:48:27 [Debug] OS/Arch: linux/386
13:48:27  12:48:27 [Debug] Using npm executable: /usr/local/bin/npm
13:48:27  12:48:27 [Debug] Running 'npm --version' command.
13:48:27  12:48:27 [Debug] npm '--version' standard output is:
13:48:27  10.2.4
13:48:27  12:48:27 [Debug] Preparing to read the config file /data/****/workspace/s_feature_verbose_jfrogcli_build_WS_2_u3antu379/.jfrog/projects/npm.yaml
13:48:27  12:48:27 [Debug] Found deployer in the config file /data/****/workspace/s_feature_verbose_jfrogcli_build_WS_2_u3antu379/.jfrog/projects/npm.yaml
13:48:27  12:48:27 [Info] Running npm Publish
13:48:27  12:48:27 [Debug] Working directory set to: /data/****/workspace/s_feature_verbose_jfrogcli_build_WS_2_u3antu379
13:48:27  12:48:27 [Debug] Reading Package Json.
13:48:27  12:48:27 [Debug] Usage Report: Sending info...
13:48:27  12:48:27 [Debug] Sending HTTP GET request to: http://<artifactory>/artifactory/api/repositories/<repository>
13:48:27  12:48:27 [Debug] Sending HTTP GET request to: http://<artifactory>/artifactory/api/system/version
13:48:27  12:48:27 [Debug] Artifactory response: 200 
13:48:27  12:48:27 [Debug] JFrog Artifactory version is: 7.55.9
13:48:27  12:48:27 [Debug] Sending HTTP POST request to: http://<artifactory>/artifactory/api/system/usage
13:48:27  12:48:27 [Debug] Setting Package Info.
13:48:27  12:48:27 [Debug] The provided path is not a directory, we assume this is a compressed npm package
13:48:27  12:48:27 [Debug] Extracting info from npm package: []
13:48:27  12:48:27 [Debug] Reading build general details from: /tmp/jfrog/builds/5e17912350ad07bdcae1b09d08d8b111f50e90d187ff3895a8f3637c3bb2dcf7/partials
13:48:27  12:48:27 [Debug] Using npm executable: /usr/local/bin/npm
13:48:27  12:48:27 [Debug] Running 'npm --version' command.
13:48:28  12:48:28 [Debug] npm '--version' standard output is:
13:48:28  10.2.4
13:48:28  panic: runtime error: invalid memory address or nil pointer dereference
13:48:28  [signal SIGSEGV: segmentation violation code=0x1 addr=0x24 pc=0x872aeda]
13:48:28  
13:48:28  goroutine 1 [running]:
13:48:28  github.com/jfrog/jfrog-client-go/utils/io/content.(*ContentReader).NextRecord(0x0, {0x8bac6a0, 0xb250040})
13:48:28    /root/go/pkg/mod/github.com/jfrog/jfrog-client-go@v1.38.0/utils/io/content/contentreader.go:66 +0x6a
13:48:28  github.com/jfrog/jfrog-client-go/artifactory/services/utils.ConvertArtifactsDetailsToBuildInfoArtifacts(0x0)
13:48:28    /root/go/pkg/mod/github.com/jfrog/jfrog-client-go@v1.38.0/artifactory/services/utils/resultutils.go:86 +0x85
13:48:28  github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/npm.(*NpmPublishCommand).Run(0xb251620)
13:48:28    /root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/v2@v2.49.0/artifactory/commands/npm/publish.go:197 +0x40a
13:48:28  github.com/jfrog/jfrog-cli-core/v2/common/commands.Exec({0x8ebdaa8, 0xb251620})
13:48:28    /root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/v2@v2.49.0/common/commands/command.go:26 +0xa6
13:48:28  github.com/jfrog/jfrog-cli/buildtools.NpmPublishCmd(0xb0da4d0)
13:48:28    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/buildtools/cli.go:868 +0x26b
13:48:28  github.com/jfrog/jfrog-cli/buildtools.npmGenericCmd(0xb0da4d0, {0xff86e80a, 0x1}, 0x0)
13:48:28    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/buildtools/cli.go:830 +0x138
13:48:28  github.com/jfrog/jfrog-cli/buildtools.GetCommands.func11(0xb0da4d0)
13:48:28    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/buildtools/cli.go:331 +0x190
13:48:28  github.com/urfave/cli.HandleAction({0x8b475a0, 0x8d46618}, 0xb0da4d0)
13:48:28    /root/go/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:524 +0x50
13:48:28  github.com/urfave/cli.Command.Run({{0x8c7bb82, 0x3}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x8ca4ce6, 0x10}, {0x8d324f7, ...}, ...}, ...)
13:48:28    /root/go/pkg/mod/github.com/urfave/cli@v1.22.14/command.go:175 +0x63e
13:48:28  github.com/urfave/cli.(*App).Run(0xb0c9340, {0xb0ac0c0, 0x8, 0x8})
13:48:28    /root/go/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:277 +0xb11
13:48:28  main.execMain()
13:48:28    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/main.go:139 +0x4d5
13:48:28  main.main()
13:48:28    /var/****_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/main.go:78 +0x23

package.json

Thomas-Boutin commented 6 months ago

Additional information : the above job is running with npm 10.2.4 and node 20.11.1

EyalDelarea commented 6 months ago

Hey @Thomas-Boutin,

Thank you for this information. I was able to reproduce the issue and fix it, you can track the progress in the following PR

As a temp workaround you could downgrade the cli version or use jf npm p without providing an already packed npm package ( the jf command will pack it for you )

Thank you for the bug report!

Thomas-Boutin commented 6 months ago

@EyalDelarea cheers good job!

Thanks for the fast fix. We've already downgraded the cli version. Looking forward to having this fixed :-)

Have a nice day

EyalDelarea commented 6 months ago

Hey @Thomas-Boutin , A new version of the CLI has been released and the fix is included.

Feel free to reach out if you require further assistance!

Thomas-Boutin commented 5 months ago

Hey @EyalDelarea I'll test this one I'll let you know

Thomas-Boutin commented 5 months ago

Update: this works fine, thanks for the good work :-)

eyalbe4 commented 5 months ago

Thanks for the update @Thomas-Boutin!