jfrog / jfrog-cli-core

Apache License 2.0
32 stars 55 forks source link

Deploying Npm Package - (jf-cli 2.55.0) Extracting info from npm package fails due to wrong path supplied #1170

Closed mthidell closed 2 months ago

mthidell commented 3 months ago

Describe the bug

Summary

Currently experience some issues with the "Extracting info" steps in the NPM publish use-case.

At the step where "Extracting info from npm package" debug messages occurs. The file-path to the npm tarball is supplied is in a strange format (not the path to the tarball), which results in the whole npm publish operation failing.

jf-cli 2.37.3: (Last known working state) 12:49:30 [Debug] Extracting info from npm package: /home/vsts/work/1/s/my-scope-my-package-1.0.1.tgz

jf-cli 2.55.0: (Tested with latest available) 12:43:32 [Debug] Extracting info from npm package: /home/vsts/work/1/s/> @my-scope/my-package@1.0.1 prepack

Just downgrading the Jfrog CLI tool 2.37.3 temporarily addressed our issue, no other adjustment where made in our build environment.

Background:

The repository/project is based on a common CLI framework called *oclif https://oclif.io/

Additional info:

Node: /opt/hostedtoolcache/node/20.12.1/x64/bin

package.json

"scripts": {
...
  "prepack": "oclif manifest && oclif readme",
  "postpack": "shx rm -f oclif.manifest.json",
...
},

Let me know if you need any further details to narrow down the root cause.

Current behavior

Environment

CI/CD: Azure DevOps Build Agent: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md

Logs (Using jf-cli 2.55.0)

Starting: Pack and Publish
==============================================================================
Task         : JFrog npm
Description  : Install, pack and publish npm packages from and to Artifactory while allowing to collect build-info. The collected build-info can be later published to Artifactory by the "JFrog Publish Build Info" task.
Version      : 1.9.4
Author       : JFrog
Help         : [More Information](https://github.com/jfrog/jfrog-azure-devops-extension#JFrog-npm-Task)
==============================================================================
Found tool in cache: jf 2.55.0 x64
Running jfrog-cli from /opt/hostedtoolcache/jf/2.55.0/x64/jf
JFrog CLI version: 2.55.0
Executing JFrog CLI Command:

/opt/hostedtoolcache/jf/2.55.0/x64/jf c add "my-package_20240410.10_npmpack and publish_deployer_1712753009208" --artifactory-url="https://myinstance.jfrog.io/artifactory" --interactive=false --access-token-stdi
12:43:29 [Debug] JFrog CLI version: 2.55.0
12:43:29 [Debug] OS/Arch: linux/amd64
12:43:29 [Debug] Using access-token provided via Stdin
12:43:29 [Debug] Locking config file to run config AddOrEdit command.
12:43:29 [Debug] Creating lock in: /home/vsts/.jfrog/locks/config
12:43:29 [Debug] Releasing lock: /home/vsts/.jfrog/locks/config/jfrog-cli.conf.lck.2771.1712753009219756408
12:43:29 [Debug] Config AddOrEdit command completed successfully. config file is released.
Executing JFrog CLI Command:
/opt/hostedtoolcache/jf/2.55.0/x64/jf c use "my-package_20240410.10_npmpack and publish_deployer_1712753009208"
12:43:29 [Debug] JFrog CLI version: 2.55.0
12:43:29 [Debug] OS/Arch: linux/amd64
12:43:29 [Debug] Locking config file to run config Use command.
12:43:29 [Debug] Creating lock in: /home/vsts/.jfrog/locks/config
12:43:29 [Info] Using server ID 'my-package_20240410.10_npmpack and publish_deployer_1712753009208' (https://myinstance.jfrog.io/artifactory/)
12:43:29 [Debug] Releasing lock: /home/vsts/.jfrog/locks/config/jfrog-cli.conf.lck.2778.1712753009233109224
12:43:29 [Debug] Config Use command completed successfully. config file is released.
Executing JFrog CLI Command:
/opt/hostedtoolcache/jf/2.55.0/x64/jf npmc --server-id-deploy="my-package_20240410.10_npmpack and publish_deployer_1712753009208" --repo-deploy="npm-local"
12:43:29 [Debug] JFrog CLI version: 2.55.0
12:43:29 [Debug] OS/Arch: linux/amd64
12:43:29 [Info] npm build config successfully created.
Executing JFrog CLI Command:
/opt/hostedtoolcache/jf/2.55.0/x64/jf npm p
12:43:29 [Debug] JFrog CLI version: 2.55.0
12:43:29 [Debug] OS/Arch: linux/amd64
12:43:29 [Debug] Using npm executable: /opt/hostedtoolcache/node/20.12.1/x64/bin/npm
12:43:29 [Debug] Running 'npm --version' command.
12:43:29 [Debug] npm '--version' standard output is:
10.5.0
12:43:29 [Debug] Preparing to read the config file /home/vsts/work/1/s/.jfrog/projects/npm.yaml
12:43:29 [Debug] Found deployer in the config file /home/vsts/work/1/s/.jfrog/projects/npm.yaml
12:43:29 [Info] Running npm Publish
12:43:29 [Debug] Working directory set to: /home/vsts/work/1/s
12:43:29 [Debug] Reading Package Json.
12:43:29 [Debug] Usage Report: Sending info...
12:43:29 [Debug] Sending HTTP GET request to: https://myinstance.jfrog.io/artifactory/api/repositories/npm-local
12:43:29 [Debug] Sending HTTP GET request to: https://myinstance.jfrog.io/artifactory/api/system/version
12:43:29 [Debug] Setting Package Info.
12:43:29 [Debug] Creating npm package.
12:43:29 [Debug] Artifactory response: 200
12:43:29 [Debug] JFrog Artifactory version is: 7.83.1
12:43:29 [Debug] Sending HTTP POST request to: https://myinstance.jfrog.io/artifactory/api/system/usage
npm notice
npm notice 📦  @my-scope/my-package@1.0.1
npm notice === Tarball Contents ===
...
npm notice 1.9kB package.json
npm notice === Tarball Details ===
npm notice name:          @my-scope/my-package
npm notice version:       1.0.1
npm notice filename:      my-scope-my-package-1.0.1.tgz
npm notice package size:  4.1 kB
npm notice unpacked size: 13.5 kB
npm notice shasum:        a191d3bbade3dc56b8127c44afdfa7a1a4748241
npm notice integrity:     sha512-R/CLREn4N9nnJ[...]0WQdnFc1pDrcA==
npm notice total files:   26
npm notice
12:43:32 [Debug] Deploying npm package.
12:43:32 [Debug] Extracting info from npm package: /home/vsts/work/1/s/> @my-scope/my-package@1.0.1 prepack
12:43:32 [Error] open /home/vsts/work/1/s/> @my-scope/my-package@1.0.1 prepack: no such file or directory
{
  "status": "failure",
  "totals": {
    "success": 0,
    "failure": 0
  }
}
remove /home/vsts/work/1/s/> @my-scope/my-package@1.0.1 prepack: no such file or directory
##[error]Error: Command failed: /opt/hostedtoolcache/jf/2.55.0/x64/jf npm p
Executing JFrog CLI Command:
/opt/hostedtoolcache/jf/2.55.0/x64/jf c remove "my-package_20240410.10_npmpack and publish_deployer_1712753009208" --quiet
12:43:32 [Debug] JFrog CLI version: 2.55.0
12:43:32 [Debug] OS/Arch: linux/amd64
12:43:32 [Debug] Locking config file to run config Delete command.
12:43:32 [Debug] Creating lock in: /home/vsts/.jfrog/locks/config
12:43:32 [Debug] Releasing lock: /home/vsts/.jfrog/locks/config/jfrog-cli.conf.lck.2867.1712753012030718308
12:43:32 [Debug] Config Delete command completed successfully. config file is released.

Reproduction steps

No response

Expected behavior

No response

JFrog CLI-Core version

2.50.0

JFrog CLI version (if applicable)

2.55.0

Operating system type and version

linux/amd64

JFrog Artifactory version

7.83.1

JFrog Xray version

No response

RobiNino commented 3 months ago

Hi @mthidell , Thank you for reporting this issue. Looks like the regression is in JFrog CLI 2.54.0. You may downgrade to version 2.53.2 while we prepare a fix. Thanks!

EyalDelarea commented 3 months ago

Hi @mthidell,

I'm pleased to inform you that JFrog-CLI has been updated to v2.56.0,which includes a fix for the reported issue. Please confirm if this resolves the problem and feel free to reach out if you need further assistance.

Thank you!

mthidell commented 2 months ago

Hi @EyalDelarea,

Please confirm if this resolves the problem and feel free to reach out if you need further assistance.

It works as expected, thanks! Closing issue.