diff --git a/.github/workflows/accessTests.yml b/.github/workflows/accessTests.yml index 16f290757..4d443ac37 100644 --- a/.github/workflows/accessTests.yml +++ b/.github/workflows/accessTests.yml @@ -37,6 +37,7 @@ jobs: uses: jfrog/.github/actions/install-local-artifactory@main with: RTLIC: ${{ secrets.RTLIC }} + VERSION: 7.104.15 - name: Get ID Token and Exchange Token shell: bash diff --git a/.github/workflows/artifactoryTests.yml b/.github/workflows/artifactoryTests.yml index c4e380e3e..bc833c3f0 100644 --- a/.github/workflows/artifactoryTests.yml +++ b/.github/workflows/artifactoryTests.yml @@ -37,6 +37,7 @@ jobs: uses: jfrog/.github/actions/install-local-artifactory@main with: RTLIC: ${{ secrets.RTLIC }} + VERSION: 7.104.15 - name: Run Artifactory tests run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.artifactory --jfrog.url=http://127.0.0.1:8082 --jfrog.adminToken=${{ env.JFROG_TESTS_LOCAL_ACCESS_TOKEN }} diff --git a/.github/workflows/gradleTests.yml b/.github/workflows/gradleTests.yml index 3f5d6a21a..05b42eff3 100644 --- a/.github/workflows/gradleTests.yml +++ b/.github/workflows/gradleTests.yml @@ -48,6 +48,7 @@ jobs: uses: jfrog/.github/actions/install-local-artifactory@main with: RTLIC: ${{ secrets.RTLIC }} + VERSION: 7.104.15 - name: Run Gradle tests run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.gradle diff --git a/.github/workflows/mavenTests.yml b/.github/workflows/mavenTests.yml index 88b438b19..67c7da938 100644 --- a/.github/workflows/mavenTests.yml +++ b/.github/workflows/mavenTests.yml @@ -40,6 +40,7 @@ jobs: uses: jfrog/.github/actions/install-local-artifactory@main with: RTLIC: ${{ secrets.RTLIC }} + VERSION: 7.104.15 - name: Run Maven tests run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.maven diff --git a/.github/workflows/npmTests.yml b/.github/workflows/npmTests.yml index 792e26def..70794b2fa 100644 --- a/.github/workflows/npmTests.yml +++ b/.github/workflows/npmTests.yml @@ -39,6 +39,7 @@ jobs: uses: jfrog/.github/actions/install-local-artifactory@main with: RTLIC: ${{ secrets.RTLIC }} + VERSION: 7.104.15 - name: Run npm tests env: diff --git a/.github/workflows/nugetTests.yml b/.github/workflows/nugetTests.yml index fd8ee9ca1..29e1d1720 100644 --- a/.github/workflows/nugetTests.yml +++ b/.github/workflows/nugetTests.yml @@ -63,6 +63,7 @@ jobs: uses: jfrog/.github/actions/install-local-artifactory@main with: RTLIC: ${{ secrets.RTLIC }} + VERSION: 7.104.15 - name: Run NuGet tests run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.nuget diff --git a/.github/workflows/pluginsTests.yml b/.github/workflows/pluginsTests.yml index e3c1fcca6..c92150dad 100644 --- a/.github/workflows/pluginsTests.yml +++ b/.github/workflows/pluginsTests.yml @@ -34,6 +34,7 @@ jobs: uses: jfrog/.github/actions/install-local-artifactory@main with: RTLIC: ${{ secrets.RTLIC }} + VERSION: 7.104.15 - name: Run plugins tests run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.plugins diff --git a/.github/workflows/pythonTests.yml b/.github/workflows/pythonTests.yml index 926dc4444..cbeff536e 100644 --- a/.github/workflows/pythonTests.yml +++ b/.github/workflows/pythonTests.yml @@ -49,6 +49,7 @@ jobs: uses: jfrog/.github/actions/install-local-artifactory@main with: RTLIC: ${{ secrets.RTLIC }} + VERSION: 7.104.15 - name: Run Python tests run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.${{ matrix.suite }} diff --git a/.github/workflows/transferTests.yml b/.github/workflows/transferTests.yml index e2326897b..70b8c2d59 100644 --- a/.github/workflows/transferTests.yml +++ b/.github/workflows/transferTests.yml @@ -58,7 +58,7 @@ jobs: with: RTLIC: ${{ secrets.RTLIC_V6 }} JFROG_HOME: ${{ runner.temp }} - VERSION: 6.23.21 + VERSION: 7.104.15 - name: Run transfer tests run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.transfer --test.installDataTransferPlugin --jfrog.targetUrl=${{ secrets.PLATFORM_URL }} --jfrog.targetAdminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --jfrog.home=${{ runner.temp }} --ci.runId=${{ runner.os }}-transfer-6 diff --git a/buildtools/cli.go b/buildtools/cli.go index cb38e74ce..44e4182d2 100644 --- a/buildtools/cli.go +++ b/buildtools/cli.go @@ -934,9 +934,17 @@ func NpmPublishCmd(c *cli.Context) (err error) { if npmCmd.GetXrayScan() { commandsUtils.ConditionalUploadScanFunc = scan.ConditionalUploadDefaultScanFunc } - printDeploymentView, detailedSummary := log.IsStdErrTerminal(), npmCmd.IsDetailedSummary() - if !detailedSummary { - npmCmd.SetDetailedSummary(printDeploymentView) + + var printDeploymentView, detailedSummary bool + + // Deployment view and Detailed summary is not supported when using npmrc for publishing since transfer details are not available. + if npmCmd.UseNative() { + printDeploymentView, detailedSummary = false, false + } else { + printDeploymentView, detailedSummary = log.IsStdErrTerminal(), npmCmd.IsDetailedSummary() + if !detailedSummary { + npmCmd.SetDetailedSummary(printDeploymentView) + } } err = commands.Exec(npmCmd) result := npmCmd.Result() diff --git a/go.mod b/go.mod index 535e94a4e..f9517d612 100644 --- a/go.mod +++ b/go.mod @@ -189,10 +189,10 @@ require ( sigs.k8s.io/yaml v1.4.0 // indirect ) -replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250508140039-bfb5e9a50dfe +replace github.com/jfrog/jfrog-cli-artifactory => github.com/jfrog/jfrog-cli-artifactory v0.2.5-0.20250514065555-2ad0e403ae04 -replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20250508130334-f159cff9b11a +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250514055103-d3d0d25f7c85 -replace github.com/jfrog/jfrog-cli-artifactory => github.com/jfrog/jfrog-cli-artifactory v0.2.5-0.20250509052840-40acf11c6080 +replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20250508130334-f159cff9b11a replace github.com/jfrog/jfrog-cli-security => github.com/jfrog/jfrog-cli-security v1.17.2-0.20250511132918-d9cc4cd50020 diff --git a/go.sum b/go.sum index 80b63068f..464f6498a 100644 --- a/go.sum +++ b/go.sum @@ -186,10 +186,10 @@ github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s= github.com/jfrog/gofrog v1.7.6/go.mod h1:ntr1txqNOZtHplmaNd7rS4f8jpA5Apx8em70oYEe7+4= github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY= github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w= -github.com/jfrog/jfrog-cli-artifactory v0.2.5-0.20250509052840-40acf11c6080 h1:UWqfVXAvKdfru1k7PwNjZXuufcJR6HukzfThz+J2nFw= -github.com/jfrog/jfrog-cli-artifactory v0.2.5-0.20250509052840-40acf11c6080/go.mod h1:MVap+qb0Gft98yJdPe2si2GqtxQczDVEuC8oxbUTDLk= -github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250508140039-bfb5e9a50dfe h1:17ZlsX/X4orRHqFoyGnEBHIfKFu49AVvyVoRqk7635E= -github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250508140039-bfb5e9a50dfe/go.mod h1:8ODu50AZkrP5xXvUGLizFTL1+qJknSShHNGhGl7OtFQ= +github.com/jfrog/jfrog-cli-artifactory v0.2.5-0.20250514065555-2ad0e403ae04 h1:TtRvALfZVzm0PRyEg816TbuPU4pbFITEnSOQRgqNScg= +github.com/jfrog/jfrog-cli-artifactory v0.2.5-0.20250514065555-2ad0e403ae04/go.mod h1:A2HKG/6ICMzgUrhO0N1cl8x6rces0JP2GcaiQP2dpbI= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250514055103-d3d0d25f7c85 h1:8MP9xgYm9bT6LeznzhyrecjpfTZQr2pBa4hxXEV36CI= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250514055103-d3d0d25f7c85/go.mod h1:8ODu50AZkrP5xXvUGLizFTL1+qJknSShHNGhGl7OtFQ= github.com/jfrog/jfrog-cli-platform-services v1.9.0 h1:r/ETgJuMUOUu12w20ydsF6paqEaj0khH6bxMRsdNz1Y= github.com/jfrog/jfrog-cli-platform-services v1.9.0/go.mod h1:pMZMSwhj7yA4VKyj0Skr2lObIyGpZUxNJ40DSLKXU38= github.com/jfrog/jfrog-cli-security v1.17.2-0.20250511132918-d9cc4cd50020 h1:CoWRc7ZLXfHojcyzifFG8fwaTniOLg/cDTPhAqQh/dc= diff --git a/npm_test.go b/npm_test.go index 38a74038c..f980af23a 100644 --- a/npm_test.go +++ b/npm_test.go @@ -3,6 +3,7 @@ package main import ( "fmt" "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/generic" + utils2 "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils" "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" "github.com/jfrog/jfrog-client-go/http/httpclient" "github.com/stretchr/testify/require" @@ -148,12 +149,162 @@ func testNpm(t *testing.T, isLegacy bool) { inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.NpmBuildName, artHttpDetails) } +func TestNpmPublishWithNpmrc(t *testing.T) { + testNpmPublishWithNpmrc(t, validateNpmPublish, "npmpublishrcproject", tests.NpmRepo, false) +} + +func TestNpmPublishWithNpmrcScoped(t *testing.T) { + testNpmPublishWithNpmrc(t, validateNpmScopedPublish, "npmpublishrcscopedproject", tests.NpmScopedRepo, true) +} + +func testNpmPublishWithNpmrc(t *testing.T, validationFunc func(t *testing.T, npmTest npmTestParams, isNpm7 bool), projectName string, repoName string, isScoped bool) { + initNpmTest(t) + defer cleanNpmTest(t) + wd, err := os.Getwd() + assert.NoError(t, err, "Failed to get current dir") + defer clientTestUtils.ChangeDirAndAssert(t, wd) + buildNumber := "1" + npmVersion, _, err := buildutils.GetNpmVersionAndExecPath(log.Logger) + if err != nil { + assert.NoError(t, err) + return + } + + // Init npm project & npmp command for testing + npmProjectPath := initNpmPublishRcProjectTest(t, projectName) + configFilePath := filepath.Join(npmProjectPath, ".jfrog", "projects", "npm.yaml") + + // fetch module id + packageJsonPath := npmProjectPath + "/package.json" + moduleName := readModuleId(t, packageJsonPath, npmVersion) + + err = createNpmrcForTesting(t, configFilePath) + assert.NoError(t, err) + + if isScoped { + addNpmScopeRegistryToNpmRc(t, npmProjectPath, packageJsonPath, npmVersion) + } + + npmpCmd, err := publishUsingNpmrc(configFilePath, buildNumber) + assert.NoError(t, err) + + result := npmpCmd.Result() + assert.NotNil(t, result) + + validateNpmLocalBuildInfo(t, tests.NpmBuildName, buildNumber, moduleName) + assert.NoError(t, artifactoryCli.Exec("bp", tests.NpmBuildName, buildNumber)) + + // validation + testParams := npmTestParams{testName: "npm p", + nativeCommand: "npm publish", + legacyCommand: "rt npm-publish", + repo: repoName, + wd: npmProjectPath, + validationFunc: validateNpmPublish, + buildNumber: buildNumber, + moduleName: moduleName, + } + validationFunc(t, testParams, false) +} + +func TestNpmInstallClientNative(t *testing.T) { + initNpmTest(t) + defer cleanNpmTest(t) + wd, err := os.Getwd() + assert.NoError(t, err, "Failed to get current dir") + defer clientTestUtils.ChangeDirAndAssert(t, wd) + + npmVersion, _, err := buildutils.GetNpmVersionAndExecPath(log.Logger) + if err != nil { + assert.NoError(t, err) + return + } + buildNumber := "1" + + npmProjectDirectory := initNpmProjectTest(t) + configFilePath := filepath.Join(npmProjectDirectory, ".jfrog", "projects", "npm.yaml") + err = createNpmrcForTesting(t, configFilePath) + assert.NoError(t, err) + + clientTestUtils.ChangeDirAndAssert(t, npmProjectDirectory) + npmrcFileInfo, err := os.Stat(".npmrc") + if err != nil && os.IsNotExist(err) { + assert.Fail(t, err.Error()) + } + + packageJsonPath := npmProjectDirectory + "/package.json" + moduleName := readModuleId(t, packageJsonPath, npmVersion) + runJfrogCli(t, "npm", "i", "--run-native=true", "--build-name="+tests.NpmBuildName, "--build-number="+buildNumber) + validateNpmLocalBuildInfo(t, tests.NpmBuildName, buildNumber, moduleName) + assert.NoError(t, artifactoryCli.Exec("bp", tests.NpmBuildName, buildNumber)) + + npmTest := npmTestParams{ + testName: "npm with run-native", + buildNumber: buildNumber, + npmArgs: "--run-native=true", + } + + validateNpmInstall(t, npmTest, isNpm7(npmVersion)) + postTestFileInfo, postTestFileInfoErr := os.Stat(".npmrc") + validateNpmrcFileInfo(t, npmTest, npmrcFileInfo, postTestFileInfo, err, postTestFileInfoErr) + validateIfFileWasEverModified(t, npmrcFileInfo, postTestFileInfo) +} + +func createNpmrcForTesting(t *testing.T, configFilePath string) (err error) { + // Creation of npmrc - npmCommand.CreateTempNpmrc() function is used to create a npmrc file + npmCommand := npm.NewNpmCommand("install", true) + npmCommand.SetConfigFilePath(configFilePath) + npmCommand.SetServerDetails(serverDetails) + err = npmCommand.Init() + assert.NoError(t, err) + err = npmCommand.PreparePrerequisites(tests.NpmRepo) + assert.NoError(t, err) + err = npmCommand.CreateTempNpmrc() + return +} + +func publishUsingNpmrc(configFilePath string, buildNumber string) (npm.NpmPublishCommand, error) { + args := []string{"--run-native=true", "--build-name=" + tests.NpmBuildName, "--build-number=" + buildNumber} + npmpCmd := npm.NewNpmPublishCommand() + npmpCmd.SetConfigFilePath(configFilePath).SetArgs(args) + err := npmpCmd.Init() + if err != nil { + return *npmpCmd, err + } + err = commands.Exec(npmpCmd) + if err != nil { + return *npmpCmd, err + } + return *npmpCmd, err +} + func readModuleId(t *testing.T, wd string, npmVersion *version.Version) string { packageInfo, err := buildutils.ReadPackageInfoFromPackageJsonIfExists(filepath.Dir(wd), npmVersion) assert.NoError(t, err) return packageInfo.BuildInfoModuleId() } +func addNpmScopeRegistryToNpmRc(t *testing.T, projectPath string, packageJsonPath string, npmVersion *version.Version) { + scope := getScopeFromPackageJson(t, packageJsonPath, npmVersion) + authConfig, err := serverDetails.CreateArtAuthConfig() + assert.NoError(t, err) + _, registry, err := utils2.GetArtifactoryNpmRepoDetails(tests.NpmScopedRepo, authConfig, false) + assert.NoError(t, err) + scopedRegistry := scope + ":registry=" + registry + npmrcFilePath := filepath.Join(projectPath, ".npmrc") + npmrcFile, err := os.OpenFile(npmrcFilePath, os.O_APPEND|os.O_WRONLY, 0644) + assert.NoError(t, err) + defer npmrcFile.Close() + _, err = npmrcFile.WriteString(scopedRegistry) + assert.NoError(t, err) +} + +func getScopeFromPackageJson(t *testing.T, wd string, npmVersion *version.Version) string { + packageInfo, err := buildutils.ReadPackageInfoFromPackageJsonIfExists(filepath.Dir(wd), npmVersion) + assert.NoError(t, err) + return packageInfo.Scope +} + func TestNpmWithGlobalConfig(t *testing.T) { initNpmTest(t) defer cleanNpmTest(t) @@ -261,6 +412,11 @@ func validateNpmrcFileInfo(t *testing.T, npmTest npmTestParams, npmrcFileInfo, p assert.Nil(t, bcpNpmrc, "The file 'jfrog.npmrc.backup' was supposed to be deleted but it was not when running the configuration:\n%v", npmTest) } +// if file was backed up then it's mod time should be changed +func validateIfFileWasEverModified(t *testing.T, fileInfo, postTestFileInfo os.FileInfo) { + assert.Equal(t, fileInfo.ModTime(), postTestFileInfo.ModTime()) +} + func initNpmFilesTest(t *testing.T) (npmProjectPath, npmScopedProjectPath, npmNpmrcProjectPath, npmProjectCi, npmPostInstallProjectPath string) { npmProjectPath = createNpmProject(t, "npmproject") npmScopedProjectPath = createNpmProject(t, "npmscopedproject") @@ -285,6 +441,14 @@ func initNpmProjectTest(t *testing.T) (npmProjectPath string) { return } +func initNpmPublishRcProjectTest(t *testing.T, projectName string) (npmProjectPath string) { + npmProjectPath = filepath.Dir(createNpmProject(t, projectName)) + err := createConfigFileForTest([]string{npmProjectPath}, tests.NpmRemoteRepo, tests.NpmRepo, t, project.Npm, false) + assert.NoError(t, err) + prepareArtifactoryForNpmBuild(t, npmProjectPath) + return +} + func initNpmWorkspacesProjectTest(t *testing.T) (npmProjectPath string) { npmProjectPath = filepath.Dir(createNpmProject(t, "npmworkspaces")) err := createConfigFileForTest([]string{npmProjectPath}, tests.NpmRemoteRepo, tests.NpmRepo, t, project.Npm, false) @@ -361,8 +525,8 @@ func validateNpmPublish(t *testing.T, npmTestParams npmTestParams, isNpm7 bool) } func validateNpmScopedPublish(t *testing.T, npmTestParams npmTestParams, isNpm7 bool) { - verifyExistInArtifactoryByProps(tests.GetNpmDeployedScopedArtifacts(isNpm7), - tests.NpmRepo+"/*", + verifyExistInArtifactoryByProps(tests.GetNpmDeployedScopedArtifacts(npmTestParams.repo, isNpm7), + npmTestParams.repo+"/*", fmt.Sprintf("build.name=%v;build.number=%v;build.timestamp=*", tests.NpmBuildName, npmTestParams.buildNumber), t) validateNpmCommonPublish(t, npmTestParams, isNpm7, true) } diff --git a/testdata/npm/npmpublishrcproject/package.json b/testdata/npm/npmpublishrcproject/package.json new file mode 100755 index 000000000..7797f3f38 --- /dev/null +++ b/testdata/npm/npmpublishrcproject/package.json @@ -0,0 +1,17 @@ +{ + "name": "jfrog-cli-tests", + "version": "1.0.0", + "description": "test package", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "xml": "1.0.1" + }, + "devDependencies": { + "json": "9.0.6" + } +} \ No newline at end of file diff --git a/testdata/npm/npmpublishrcscopedproject/package.json b/testdata/npm/npmpublishrcscopedproject/package.json new file mode 100755 index 000000000..bc63c2ec0 --- /dev/null +++ b/testdata/npm/npmpublishrcscopedproject/package.json @@ -0,0 +1,17 @@ +{ + "name": "@jscope/jfrog-cli-tests", + "version": "1.0.0", + "description": "test package", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "xml": "1.0.1" + }, + "devDependencies": { + "json": "9.0.6" + } +} \ No newline at end of file diff --git a/testdata/npm_local_scoped_repository_config.json b/testdata/npm_local_scoped_repository_config.json new file mode 100644 index 000000000..e11794546 --- /dev/null +++ b/testdata/npm_local_scoped_repository_config.json @@ -0,0 +1,5 @@ +{ + "key": "${NPM_SCOPED_REPO}", + "rclass": "local", + "packageType": "npm" +} diff --git a/utils/cliutils/commandsflags.go b/utils/cliutils/commandsflags.go index ea6598c43..15b786258 100644 --- a/utils/cliutils/commandsflags.go +++ b/utils/cliutils/commandsflags.go @@ -363,6 +363,7 @@ const ( // Unique npm flags npmPrefix = "npm-" npmDetailedSummary = npmPrefix + detailedSummary + runNative = "run-native" // Unique nuget/dotnet config flags nugetV2 = "nuget-v2" @@ -1704,6 +1705,10 @@ var flagsMap = map[string]cli.Flag{ Name: ApplicationKey, Usage: "[Optional] JFrog ApplicationKey Key` ` ", }, + runNative: cli.BoolFlag{ + Name: runNative, + Usage: "[Default: false] Set to true if you'd like to use the native client configurations. Note: This flag would invoke native client behind the scenes, has performance implications and does not support deployment view and detailed summary` `", + }, } var commandFlags = map[string][]string{ @@ -1850,10 +1855,10 @@ var commandFlags = map[string][]string{ global, serverIdResolve, serverIdDeploy, repoResolve, repoDeploy, }, NpmInstallCi: { - BuildName, BuildNumber, module, Project, + BuildName, BuildNumber, module, Project, runNative, }, NpmPublish: { - BuildName, BuildNumber, module, Project, npmDetailedSummary, xrayScan, xrOutput, + BuildName, BuildNumber, module, Project, npmDetailedSummary, xrayScan, xrOutput, runNative, }, PnpmConfig: { global, serverIdResolve, repoResolve, diff --git a/utils/tests/consts.go b/utils/tests/consts.go index 2efa5b889..5fae5710b 100644 --- a/utils/tests/consts.go +++ b/utils/tests/consts.go @@ -88,6 +88,7 @@ const ( MavenWithoutDeployerConfig = "maven_without_deployer.yaml" MoveCopySpecExclusions = "move_copy_spec_exclusions.json" NpmLocalRepositoryConfig = "npm_local_repository_config.json" + NpmLocalScopedRespositoryConfig = "npm_local_scoped_repository_config.json" NpmRemoteRepositoryConfig = "npm_remote_repository_config.json" NugetRemoteRepositoryConfig = "nuget_remote_repository_config.json" Out = "out" @@ -165,6 +166,7 @@ const ( XrayEndpoint = "xray/" YarnRemoteRepositoryConfig = "yarn_remote_repository_config.json" ReleaseLifecycleImportDependencySpec = "import_bundle_repo_dependency.json" + UseNpmRcFlag = "--use-npmrc" ) var ( @@ -181,6 +183,7 @@ var ( MvnRepo1 = "cli-mvn1" MvnRepo2 = "cli-mvn2" NpmRepo = "cli-npm" + NpmScopedRepo = "cli-npm-scoped" NpmRemoteRepo = "cli-npm-remote" NugetRemoteRepo = "cli-nuget-remote" YarnRemoteRepo = "cli-yarn-remote" @@ -1797,8 +1800,8 @@ func GetGradleDeployedArtifacts() []string { } } -func GetNpmDeployedScopedArtifacts(isNpm7 bool) []string { - path := NpmRepo + "/@jscope/jfrog-cli-tests/-/@jscope/" +func GetNpmDeployedScopedArtifacts(npmRepo string, isNpm7 bool) []string { + path := npmRepo + "/@jscope/jfrog-cli-tests/-/@jscope/" path += GetNpmArtifactName(isNpm7, true) return []string{ path, diff --git a/utils/tests/utils.go b/utils/tests/utils.go index a4b289395..392945692 100644 --- a/utils/tests/utils.go +++ b/utils/tests/utils.go @@ -262,6 +262,7 @@ var reposConfigMap = map[*string]string{ &MvnRemoteRepo: MavenRemoteRepositoryConfig, &GradleRemoteRepo: GradleRemoteRepositoryConfig, &NpmRepo: NpmLocalRepositoryConfig, + &NpmScopedRepo: NpmLocalScopedRespositoryConfig, &NpmRemoteRepo: NpmRemoteRepositoryConfig, &NugetRemoteRepo: NugetRemoteRepositoryConfig, &YarnRemoteRepo: YarnRemoteRepositoryConfig, @@ -325,7 +326,7 @@ func GetNonVirtualRepositories() map[*string]string { TestGo: {&GoRepo, &GoRemoteRepo}, TestGradle: {&GradleRepo, &GradleRemoteRepo}, TestMaven: {&MvnRepo1, &MvnRepo2, &MvnRemoteRepo}, - TestNpm: {&NpmRepo, &NpmRemoteRepo}, + TestNpm: {&NpmRepo, &NpmScopedRepo, &NpmRemoteRepo}, TestNuget: {&NugetRemoteRepo}, TestPip: {&PypiLocalRepo, &PypiRemoteRepo}, TestPipenv: {&PipenvRemoteRepo}, @@ -419,6 +420,7 @@ func getSubstitutionMap() map[string]string { "${GRADLE_REMOTE_REPO}": GradleRemoteRepo, "${GRADLE_REPO}": GradleRepo, "${NPM_REPO}": NpmRepo, + "${NPM_SCOPED_REPO}": NpmScopedRepo, "${NPM_REMOTE_REPO}": NpmRemoteRepo, "${NUGET_REMOTE_REPO}": NugetRemoteRepo, "${YARN_REMOTE_REPO}": YarnRemoteRepo, @@ -488,6 +490,7 @@ func AddTimestampToGlobalVars() { MvnRepo1 += uniqueSuffix MvnRepo2 += uniqueSuffix NpmRepo += uniqueSuffix + NpmScopedRepo += uniqueSuffix NpmRemoteRepo += uniqueSuffix NugetRemoteRepo += uniqueSuffix YarnRemoteRepo += uniqueSuffix