Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/npmTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,62 @@ jobs:
env:
YARN_IGNORE_NODE: 1
run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.npm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Just a reminder to remove.

# TODO: Remove this job before merging — temporary pnpm test for RTECO-935
pnpm-Tests:
name: "pnpm 10 tests (${{ matrix.os.name }})"
if: github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
os:
- name: ubuntu
version: 24.04
- name: windows
version: 2022
runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }}
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.ref }}

- name: Setup FastCI
uses: jfrog-fastci/fastci@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}

- name: Install Node.js
uses: actions/setup-node@v5
with:
node-version: "20"

- name: Install pnpm 10
run: npm install -g pnpm@10

- name: Validate pnpm version is 10
shell: bash
run: |
PNPM_VER=$(pnpm --version)
PNPM_MAJOR=$(echo "$PNPM_VER" | cut -d. -f1)
echo "pnpm version: ${PNPM_VER}"
if [ "$PNPM_MAJOR" -ne 10 ]; then
echo "::error::Expected pnpm 10.x but got ${PNPM_VER}"
exit 1
fi
echo "pnpm ${PNPM_VER} OK"

- name: Setup Go with cache
uses: jfrog/.github/actions/install-go-with-cache@main

- name: Install local Artifactory
uses: jfrog/.github/actions/install-local-artifactory@main
with:
RTLIC: ${{ secrets.RTLIC }}
RT_CONNECTION_TIMEOUT_SECONDS: ${{ env.RT_CONNECTION_TIMEOUT_SECONDS || '1200' }}

- name: Run pnpm tests
env:
YARN_IGNORE_NODE: 1
run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.pnpm
89 changes: 89 additions & 0 deletions .github/workflows/pnpmTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: pnpm Tests
on:
workflow_dispatch:
push:
branches:
- "master"
pull_request_target:
types: [labeled]
branches:
- "master"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pnpm-Tests:
name: "pnpm 10 tests (${{ matrix.os.name }})"
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'safe to test')
strategy:
fail-fast: false
matrix:
os:
- name: ubuntu
version: 24.04
- name: windows
version: 2022
- name: macos
version: 14
runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }}
steps:
- name: Skip macOS - JGC-413
if: matrix.os.name == 'macos'
run: |
echo "::warning::JGC-413 - Skip until artifactory bootstrap in osx is fixed"
exit 0

- name: Checkout code
if: matrix.os.name != 'macos'
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- name: Setup FastCI
if: matrix.os.name != 'macos'
uses: jfrog-fastci/fastci@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}

- name: Install Node.js
if: matrix.os.name != 'macos'
uses: actions/setup-node@v5
with:
node-version: "20"

- name: Install pnpm 10
if: matrix.os.name != 'macos'
run: npm install -g pnpm@10

- name: Validate pnpm version is 10
if: matrix.os.name != 'macos'
shell: bash
run: |
PNPM_VER=$(pnpm --version)
PNPM_MAJOR=$(echo "$PNPM_VER" | cut -d. -f1)
echo "pnpm version: ${PNPM_VER}"
if [ "$PNPM_MAJOR" -ne 10 ]; then
echo "::error::Expected pnpm 10.x but got ${PNPM_VER}"
exit 1
fi
echo "pnpm ${PNPM_VER} OK"

- name: Setup Go with cache
if: matrix.os.name != 'macos'
uses: jfrog/.github/actions/install-go-with-cache@main

- name: Install local Artifactory
if: matrix.os.name != 'macos'
uses: jfrog/.github/actions/install-local-artifactory@main
with:
RTLIC: ${{ secrets.RTLIC }}
RT_CONNECTION_TIMEOUT_SECONDS: ${{ env.RT_CONNECTION_TIMEOUT_SECONDS || '1200' }}

- name: Run pnpm tests
if: matrix.os.name != 'macos'
env:
YARN_IGNORE_NODE: 1
run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.pnpm
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ node_modules

# Class files
*.class
**/testdata/**/bin
**/testdata/**/bin
testdata/**/.gradle

.cursor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exactly you want me to remove?

77 changes: 72 additions & 5 deletions buildtools/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
huggingfaceCommands "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/huggingface"
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/mvn"
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/npm"
pnpmcmd "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/pnpm"
containerutils "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/ocicontainer"
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/terraform"
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/yarn"
Expand Down Expand Up @@ -64,6 +65,7 @@ import (
"github.com/jfrog/jfrog-cli/docs/buildtools/mvnconfig"
"github.com/jfrog/jfrog-cli/docs/buildtools/npmcommand"
"github.com/jfrog/jfrog-cli/docs/buildtools/npmconfig"
"github.com/jfrog/jfrog-cli/docs/buildtools/pnpmcommand"
nugetdocs "github.com/jfrog/jfrog-cli/docs/buildtools/nuget"
"github.com/jfrog/jfrog-cli/docs/buildtools/nugetconfig"
"github.com/jfrog/jfrog-cli/docs/buildtools/pipconfig"
Expand Down Expand Up @@ -431,6 +433,17 @@ func GetCommands() []cli.Command {
return cliutils.CreateConfigCmd(c, project.Pnpm)
},
},
{
Name: "pnpm",
Flags: cliutils.GetCommandFlags(cliutils.Pnpm),
Usage: pnpmcommand.GetDescription(),
HelpName: corecommon.CreateUsage("pnpm", pnpmcommand.GetDescription(), pnpmcommand.Usage),
UsageText: pnpmcommand.GetArguments(),
SkipFlagParsing: true,
BashComplete: corecommon.CreateBashCompletionFunc("install", "i", "publish", "p"),
Category: buildToolsCategory,
Action: pnpmCmd,
},
{
Name: "docker",
Flags: cliutils.GetCommandFlags(cliutils.Docker),
Expand Down Expand Up @@ -771,6 +784,64 @@ func YarnCmd(c *cli.Context) error {
return commands.Exec(yarnCmd)
}

func pnpmCmd(c *cli.Context) error {
if show, err := cliutils.ShowCmdHelpIfNeeded(c, c.Args()); show || err != nil {
return err
}
if c.NArg() < 1 {
return cliutils.WrongNumberOfArgumentsHandler(c)
}
args := cliutils.ExtractCommand(c)
cmdName, filteredArgs := getCommandName(args)

// Extract JFrog-specific flags (--build-name, --build-number, --project, --module, --server-id)
// once, so both supported commands and native pass-through use cleaned args.
serverDetails, cleanArgs, buildConfiguration, err := extractPnpmOptionsFromArgs(filteredArgs)
if err != nil {
return err
}

switch cmdName {
case "install", "i", "publish", "p":
pnpmCommand, err := pnpmcmd.NewCommand(cmdName, cleanArgs, buildConfiguration, serverDetails)
if err != nil {
return err
}
return commands.Exec(pnpmCommand)
default:
return runNativePackageManagerCmd("pnpm", append([]string{cmdName}, cleanArgs...))
}
}

// runNativePackageManagerCmd runs a package manager command directly, passing through stdio.
func runNativePackageManagerCmd(binary string, args []string) error {
cmd := exec.Command(binary, args...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}

// extractPnpmOptionsFromArgs extracts all JFrog CLI options from pnpm command args.
// Returns server details, cleaned args (with JFrog flags removed), and build configuration.
func extractPnpmOptionsFromArgs(args []string) (serverDetails *coreConfig.ServerDetails, cleanArgs []string, buildConfig *build.BuildConfiguration, err error) {
cleanArgs = append([]string(nil), args...)
var serverID string
cleanArgs, serverID, err = coreutils.ExtractServerIdFromCommand(cleanArgs)
if err != nil {
return nil, nil, nil, fmt.Errorf("failed to extract server ID: %w", err)
}
serverDetails, err = coreConfig.GetSpecificConfig(serverID, true, true)
if err != nil {
return nil, nil, nil, fmt.Errorf("failed to get server configuration for ID '%s': %w", serverID, err)
}
cleanArgs, buildConfig, err = build.ExtractBuildDetailsFromArgs(cleanArgs)
if err != nil {
return nil, nil, nil, err
}
return serverDetails, cleanArgs, buildConfig, nil
}

func NugetCmd(c *cli.Context) error {
if show, err := cliutils.ShowCmdHelpIfNeeded(c, c.Args()); show || err != nil {
return err
Expand Down Expand Up @@ -1790,12 +1861,8 @@ func pythonCmd(c *cli.Context, projectType project.ProjectType) error {
log.Info(fmt.Sprintf("Publishing to repository: %s (from --repository flag)", deployerRepo))
}

// Execute native poetry command directly (similar to Maven FlexPack)
log.Info(fmt.Sprintf("Running Poetry %s.", cmdName))
poetryCmd := exec.Command("poetry", append([]string{cmdName}, poetryArgs...)...)
poetryCmd.Stdout = os.Stdout
poetryCmd.Stderr = os.Stderr
if err := poetryCmd.Run(); err != nil {
if err := runNativePackageManagerCmd("poetry", append([]string{cmdName}, poetryArgs...)); err != nil {
return fmt.Errorf("poetry %s failed: %w", cmdName, err)
}

Expand Down
13 changes: 13 additions & 0 deletions docs/buildtools/pnpmcommand/help.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package pnpmcommand

var Usage = []string{"pnpm <pnpm arguments> [command options]"}

func GetDescription() string {
return "Run pnpm command."
}

func GetArguments() string {
return ` install, i Run pnpm install.
publish, p Packs and deploys the pnpm package to the designated npm repository.
help, h`
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ require (

// replace github.com/jfrog/jfrog-cli-artifactory => github.com/reshmifrog/jfrog-cli-artifactory v0.0.0-20260303084642-b208fbba798b

// replace github.com/jfrog/jfrog-cli-artifactory => github.com/fluxxBot/jfrog-cli-artifactory v0.0.0-20260130044429-464a5025d08a
replace github.com/jfrog/jfrog-cli-artifactory => github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260317081831-91e84f2c7c5f

//replace github.com/jfrog/build-info-go => github.com/fluxxBot/build-info-go v1.10.10-0.20260105070825-d3f36f619ba5

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260216085810-1ade6c26b3df h1:raSyae8/h1y8HtzFLf7vZZj91fP/qD94AX+biwBJiqs=
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260216085810-1ade6c26b3df/go.mod h1:xum2HquWO5uExa/A7MQs3TgJJVEeoqTR+6Z4mfBr1Xw=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260313044645-ed6f0a05bb5b h1:XTlhwNidgPYk/91FblSENm5/P9kAUkHSLUc3I7FRBdg=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260313044645-ed6f0a05bb5b/go.mod h1:kgw6gIQvJx9bCcOdtAGSUEiCz7nNQmaFbFvNg6byZ6I=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260317081831-91e84f2c7c5f h1:NuCL7j0cEVqSI+L5XHfDrkwDmZ3nF9i4/Ow284p4GR4=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260317081831-91e84f2c7c5f/go.mod h1:kgw6gIQvJx9bCcOdtAGSUEiCz7nNQmaFbFvNg6byZ6I=
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260225195817-bc599cec3973 h1:awB01Y4m0cWzmXuR3waf5IQnoQxDlbUmqT+FMWOpjbs=
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260225195817-bc599cec3973/go.mod h1:yhi+XpiEx18a3t8CZ6M2VpAf3EGqKpBhTzoPBTFe0dk=
github.com/jfrog/jfrog-cli-evidence v0.8.3-0.20260202100913-d9ee9476845a h1:lTOAhUjKcOmM/0Kbj4V+I/VHPlW7YNAhIEVpGnCM5mI=
Expand Down
4 changes: 2 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func setupIntegrationTests() {
InitArtifactoryTests()
}

if *tests.TestNpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
if *tests.TestNpm || *tests.TestPnpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
InitBuildToolsTests()
}
if *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan {
Expand Down Expand Up @@ -103,7 +103,7 @@ func tearDownIntegrationTests() {
if (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
CleanArtifactoryTests()
}
if *tests.TestNpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
if *tests.TestNpm || *tests.TestPnpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
CleanBuildToolsTests()
}
if *tests.TestDistribution {
Expand Down
Loading