diff --git a/artifactory/cli.go b/artifactory/cli.go index 12a639464..bc8a7fded 100644 --- a/artifactory/cli.go +++ b/artifactory/cli.go @@ -30,7 +30,9 @@ import ( "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/usersmanagement" "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" containerutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/container" + "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-cli-core/v2/common/commands" + "github.com/jfrog/jfrog-cli-core/v2/common/project" "github.com/jfrog/jfrog-cli-core/v2/common/spec" corecommon "github.com/jfrog/jfrog-cli-core/v2/docs/common" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" @@ -328,7 +330,7 @@ func GetCommands() []cli.Command { ArgsUsage: common.CreateEnvVars(), BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunConfigCmdWithDeprecationWarning("mvnc", "rt", utils.Maven, c, cliutils.CreateConfigCmd) + return cliutils.RunConfigCmdWithDeprecationWarning("mvnc", "rt", project.Maven, c, cliutils.CreateConfigCmd) }, }, { @@ -341,7 +343,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("mvn", utils.Maven, c, buildtools.MvnCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("mvn", project.Maven, c, buildtools.MvnCmd) }, }, { @@ -353,7 +355,7 @@ func GetCommands() []cli.Command { ArgsUsage: common.CreateEnvVars(), BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunConfigCmdWithDeprecationWarning("gradlec", "rt", utils.Gradle, c, cliutils.CreateConfigCmd) + return cliutils.RunConfigCmdWithDeprecationWarning("gradlec", "rt", project.Gradle, c, cliutils.CreateConfigCmd) }, }, { @@ -366,7 +368,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("gradle", utils.Gradle, c, buildtools.GradleCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("gradle", project.Gradle, c, buildtools.GradleCmd) }, }, { @@ -463,7 +465,7 @@ func GetCommands() []cli.Command { ArgsUsage: common.CreateEnvVars(), BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunConfigCmdWithDeprecationWarning("npmc", "rt", utils.Npm, c, cliutils.CreateConfigCmd) + return cliutils.RunConfigCmdWithDeprecationWarning("npmc", "rt", project.Npm, c, cliutils.CreateConfigCmd) }, }, { @@ -477,7 +479,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("npm install", utils.Npm, c, buildtools.NpmInstallCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("npm install", project.Npm, c, buildtools.NpmInstallCmd) }, }, { @@ -491,7 +493,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("npm ci", utils.Npm, c, buildtools.NpmCiCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("npm ci", project.Npm, c, buildtools.NpmCiCmd) }, }, { @@ -504,7 +506,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("npm p", utils.Npm, c, buildtools.NpmPublishCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("npm p", project.Npm, c, buildtools.NpmPublishCmd) }, }, { @@ -516,7 +518,7 @@ func GetCommands() []cli.Command { ArgsUsage: common.CreateEnvVars(), BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunConfigCmdWithDeprecationWarning("yarnc", "rt", utils.Yarn, c, cliutils.CreateConfigCmd) + return cliutils.RunConfigCmdWithDeprecationWarning("yarnc", "rt", project.Yarn, c, cliutils.CreateConfigCmd) }, }, { @@ -528,7 +530,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("yarn", utils.Yarn, c, buildtools.YarnCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("yarn", project.Yarn, c, buildtools.YarnCmd) }, }, { @@ -540,7 +542,7 @@ func GetCommands() []cli.Command { ArgsUsage: common.CreateEnvVars(), BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunConfigCmdWithDeprecationWarning("nugetc", "rt", utils.Nuget, c, cliutils.CreateConfigCmd) + return cliutils.RunConfigCmdWithDeprecationWarning("nugetc", "rt", project.Nuget, c, cliutils.CreateConfigCmd) }, }, { @@ -553,7 +555,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("nuget", utils.Nuget, c, buildtools.NugetCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("nuget", project.Nuget, c, buildtools.NugetCmd) }, }, { @@ -574,7 +576,7 @@ func GetCommands() []cli.Command { ArgsUsage: common.CreateEnvVars(), BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunConfigCmdWithDeprecationWarning("dotnetc", "rt", utils.Dotnet, c, cliutils.CreateConfigCmd) + return cliutils.RunConfigCmdWithDeprecationWarning("dotnetc", "rt", project.Dotnet, c, cliutils.CreateConfigCmd) }, }, { @@ -587,7 +589,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("dotnet", utils.Dotnet, c, buildtools.DotnetCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("dotnet", project.Dotnet, c, buildtools.DotnetCmd) }, }, { @@ -598,7 +600,7 @@ func GetCommands() []cli.Command { ArgsUsage: common.CreateEnvVars(), BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunConfigCmdWithDeprecationWarning("go-config", "rt", utils.Go, c, cliutils.CreateConfigCmd) + return cliutils.RunConfigCmdWithDeprecationWarning("go-config", "rt", project.Go, c, cliutils.CreateConfigCmd) }, }, { @@ -625,7 +627,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("go", utils.Go, c, buildtools.GoCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("go", project.Go, c, buildtools.GoCmd) }, }, { @@ -659,7 +661,7 @@ func GetCommands() []cli.Command { ArgsUsage: common.CreateEnvVars(), BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunConfigCmdWithDeprecationWarning("pipc", "rt", utils.Pip, c, cliutils.CreateConfigCmd) + return cliutils.RunConfigCmdWithDeprecationWarning("pipc", "rt", project.Pip, c, cliutils.CreateConfigCmd) }, }, { @@ -673,7 +675,7 @@ func GetCommands() []cli.Command { SkipFlagParsing: true, BashComplete: corecommon.CreateBashCompletionFunc(), Action: func(c *cli.Context) error { - return cliutils.RunNativeCmdWithDeprecationWarning("pip install", utils.Pip, c, pipDeprecatedInstallCmd) + return cliutils.RunNativeCmdWithDeprecationWarning("pip install", project.Pip, c, pipDeprecatedInstallCmd) }, }, { @@ -1123,7 +1125,7 @@ func ocStartBuildCmd(c *cli.Context) error { } // Extract build configuration - filteredOcArgs, buildConfiguration, err := utils.ExtractBuildDetailsFromArgs(args) + filteredOcArgs, buildConfiguration, err := build.ExtractBuildDetailsFromArgs(args) if err != nil { return err } @@ -1855,10 +1857,10 @@ func pipDeprecatedInstallCmd(c *cli.Context) error { } // Get python configuration. - pythonConfig, err := utils.GetResolutionOnlyConfiguration(utils.Pip) + pythonConfig, err := project.GetResolutionOnlyConfiguration(project.Pip) if err != nil { return fmt.Errorf("error occurred while attempting to read %[1]s-configuration file: %[2]s\n"+ - "Please run 'jf %[1]s-config' command prior to running 'jf %[1]s'", utils.Pip.String(), err.Error()) + "Please run 'jf %[1]s-config' command prior to running 'jf %[1]s'", project.Pip.String(), err.Error()) } // Set arg values. diff --git a/artifactory_test.go b/artifactory_test.go index 4330130a7..028321b80 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -8,7 +8,6 @@ import ( "encoding/json" "errors" "fmt" - biutils "github.com/jfrog/build-info-go/utils" "io" "net" "net/http" @@ -24,15 +23,19 @@ import ( "testing" "time" + biutils "github.com/jfrog/build-info-go/utils" + "github.com/buger/jsonparser" gofrogio "github.com/jfrog/gofrog/io" "github.com/jfrog/gofrog/version" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/generic" "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" "github.com/jfrog/jfrog-cli-core/v2/common/commands" + "github.com/jfrog/jfrog-cli-core/v2/common/project" "github.com/jfrog/jfrog-cli-core/v2/common/spec" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" + "github.com/jfrog/jfrog-cli-core/v2/utils/dependencies" coretests "github.com/jfrog/jfrog-cli-core/v2/utils/tests" "github.com/jfrog/jfrog-cli/inttestutils" "github.com/jfrog/jfrog-cli/utils/cliutils" @@ -4969,7 +4972,7 @@ func TestGetExtractorsRemoteDetails(t *testing.T) { } func validateExtractorRemoteDetails(t *testing.T, downloadPath, expectedRemotePath string) { - serverDetails, remotePath, err := utils.GetExtractorsRemoteDetails(downloadPath) + serverDetails, remotePath, err := dependencies.GetExtractorsRemoteDetails(downloadPath) assert.NoError(t, err) assert.Equal(t, expectedRemotePath, remotePath) assert.False(t, os.Getenv(coreutils.DeprecatedExtractorsRemoteEnv) != "" && serverDetails == nil, "Expected a server to be returned") @@ -4993,7 +4996,7 @@ func TestGetReleasesRemoteDetails(t *testing.T) { } func validateReleasesRemoteDetails(t *testing.T, downloadPath, expectedRemotePath string) { - serverDetails, remotePath, err := utils.GetExtractorsRemoteDetails(downloadPath) + serverDetails, remotePath, err := dependencies.GetExtractorsRemoteDetails(downloadPath) assert.NoError(t, err) assert.Equal(t, expectedRemotePath, remotePath) assert.False(t, os.Getenv(coreutils.ReleasesRemoteEnv) != "" && serverDetails == nil, "Expected a server to be returned") @@ -5658,7 +5661,7 @@ func testProjectInit(t *testing.T, projectExampleName string, technology coreuti } func validateProjectYamlFile(t *testing.T, projectDir, technology string) { - techConfig, err := utils.ReadConfigFile(filepath.Join(projectDir, ".jfrog", "projects", technology+".yaml"), utils.YAML) + techConfig, err := project.ReadConfigFile(filepath.Join(projectDir, ".jfrog", "projects", technology+".yaml"), project.YAML) if assert.NoError(t, err) { assert.Equal(t, technology, techConfig.GetString("type")) assert.Equal(t, tests.ServerId, techConfig.GetString("resolver.serverId")) @@ -5667,7 +5670,7 @@ func validateProjectYamlFile(t *testing.T, projectDir, technology string) { } func validateBuildYamlFile(t *testing.T, projectDir string) { - techConfig, err := utils.ReadConfigFile(filepath.Join(projectDir, ".jfrog", "projects", "build.yaml"), utils.YAML) + techConfig, err := project.ReadConfigFile(filepath.Join(projectDir, ".jfrog", "projects", "build.yaml"), project.YAML) assert.NoError(t, err) assert.Equal(t, "build", techConfig.GetString("type")) assert.Equal(t, filepath.Base(projectDir+"/"), techConfig.GetString("name")) diff --git a/buildinfo_test.go b/buildinfo_test.go index 82a6b611d..a86de6eb9 100644 --- a/buildinfo_test.go +++ b/buildinfo_test.go @@ -14,6 +14,7 @@ import ( clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests" buildinfo "github.com/jfrog/build-info-go/entities" + "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-cli-core/v2/common/spec" "github.com/jfrog/jfrog-client-go/utils/log" @@ -153,7 +154,7 @@ func validateArtifactsProperties(resultItems []rtutils.ResultItem, t *testing.T, func TestBuildAddDependenciesDryRun(t *testing.T) { initArtifactoryTest(t, "") // Clean old build tests if exists - assert.NoError(t, utils.RemoveBuildDir(tests.RtBuildName1, "1", "")) + assert.NoError(t, build.RemoveBuildDir(tests.RtBuildName1, "1", "")) wd, err := os.Getwd() assert.NoError(t, err, "Failed to get current dir") @@ -163,7 +164,7 @@ func TestBuildAddDependenciesDryRun(t *testing.T) { noCredsCli := tests.NewJfrogCli(execMain, "jfrog rt", "") // Execute the bad command on the local file system assert.NoError(t, noCredsCli.Exec("bad", tests.RtBuildName1, "1", "a/*", "--dry-run=true")) - buildDir, err := utils.GetBuildDir(tests.RtBuildName1, "1", "") + buildDir, err := build.GetBuildDir(tests.RtBuildName1, "1", "") assert.NoError(t, err) files, _ := os.ReadDir(buildDir) @@ -176,7 +177,7 @@ func TestBuildAddDependenciesDryRun(t *testing.T) { assert.NoError(t, err) defer deleteServerConfig(t) assert.NoError(t, noCredsCli.Exec("bad", tests.RtBuildName1, "2", tests.RtRepo1+"/*", "--from-rt", "--server-id="+tests.ServerId, "--dry-run=true")) - buildDir, err = utils.GetBuildDir(tests.RtBuildName1, "2", "") + buildDir, err = build.GetBuildDir(tests.RtBuildName1, "2", "") assert.NoError(t, err) files, _ = os.ReadDir(buildDir) @@ -192,7 +193,7 @@ func TestBuildPublishDetailedSummary(t *testing.T) { // Clean old build tests if exists. inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) - assert.NoError(t, utils.RemoveBuildDir(tests.RtBuildName1, buildNumber, "")) + assert.NoError(t, build.RemoveBuildDir(tests.RtBuildName1, buildNumber, "")) // Upload files with build name & number. specFile, err := tests.CreateSpec(tests.UploadFlatNonRecursive) @@ -217,7 +218,7 @@ func TestBuildPublishDryRun(t *testing.T) { buildNumber := "11" // Clean old build tests if exists. inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) - assert.NoError(t, utils.RemoveBuildDir(tests.RtBuildName1, buildNumber, "")) + assert.NoError(t, build.RemoveBuildDir(tests.RtBuildName1, buildNumber, "")) // Upload files with build name & number. specFile, err := tests.CreateSpec(tests.UploadFlatRecursive) @@ -286,7 +287,7 @@ func verifyBuildPublishOutput(t *testing.T, buffer *bytes.Buffer, dryRun bool) { // //nolint:unparam func getFilesFromBuildDir(t *testing.T, buildName, buildNumber string) []os.DirEntry { - buildDir, err := utils.GetBuildDir(buildName, buildNumber, "") + buildDir, err := build.GetBuildDir(buildName, buildNumber, "") assert.NoError(t, err) files, err := os.ReadDir(buildDir) @@ -312,7 +313,7 @@ func TestBuildAppend(t *testing.T) { runRt(t, "ba", tests.RtBuildName2, buildNumber2, tests.RtBuildName1, buildNumber1) // Assert RtBuildName2/buildNumber2 is appended to RtBuildName1/buildNumber1 locally - partials, err := utils.ReadPartialBuildInfoFiles(tests.RtBuildName2, buildNumber2, "") + partials, err := build.ReadPartialBuildInfoFiles(tests.RtBuildName2, buildNumber2, "") assert.NoError(t, err) assert.Len(t, partials, 1) assert.Equal(t, tests.RtBuildName1+"/"+buildNumber1, partials[0].ModuleId) @@ -473,11 +474,11 @@ func TestBuildAddDependencies(t *testing.T) { collectDepsAndPublishBuild(badTest, true, t) validateBuildAddDepsBuildInfo(t, badTest) - assert.NoError(t, utils.RemoveBuildDir(badTest.buildName, badTest.buildNumber, "")) + assert.NoError(t, build.RemoveBuildDir(badTest.buildName, badTest.buildNumber, "")) collectDepsAndPublishBuild(badTest, false, t) validateBuildAddDepsBuildInfo(t, badTest) - assert.NoError(t, utils.RemoveBuildDir(badTest.buildName, badTest.buildNumber, "")) + assert.NoError(t, build.RemoveBuildDir(badTest.buildName, badTest.buildNumber, "")) } inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) cleanArtifactoryTest() @@ -693,7 +694,7 @@ func testBuildAddGit(t *testing.T, useEnvBuildNameAndNumber bool) { } // Check partials VCS info - partials, err := utils.ReadPartialBuildInfoFiles(tests.RtBuildName1, buildNumber, "") + partials, err := build.ReadPartialBuildInfoFiles(tests.RtBuildName1, buildNumber, "") assert.NoError(t, err) expectedVcsUrl := "https://github.com/jfrog/jfrog-cli-go.git" expectedVcsRevision := "b033a0e508bdb52eee25654c9e12db33ff01b8ff" @@ -844,7 +845,7 @@ func TestModuleName(t *testing.T) { func collectDepsAndPublishBuild(badTest buildAddDepsBuildInfoTestParams, useEnvBuildNameAndNumber bool, t *testing.T) { noCredsCli := tests.NewJfrogCli(execMain, "jfrog rt", "") // Remove old tests data from fs if exists - err := utils.RemoveBuildDir(badTest.buildName, badTest.buildNumber, "") + err := build.RemoveBuildDir(badTest.buildName, badTest.buildNumber, "") assert.NoError(t, err) command := []string{"bad"} diff --git a/buildtools/cli.go b/buildtools/cli.go index 3cea56118..1fbc9ba94 100644 --- a/buildtools/cli.go +++ b/buildtools/cli.go @@ -17,9 +17,10 @@ import ( "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/terraform" commandsUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/yarn" - "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" containerutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/container" + "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-cli-core/v2/common/commands" + "github.com/jfrog/jfrog-cli-core/v2/common/project" corecommon "github.com/jfrog/jfrog-cli-core/v2/docs/common" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" @@ -71,7 +72,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Maven) + return cliutils.CreateConfigCmd(c, project.Maven) }, }, { @@ -96,7 +97,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Gradle) + return cliutils.CreateConfigCmd(c, project.Gradle) }, }, { @@ -121,7 +122,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Yarn) + return cliutils.CreateConfigCmd(c, project.Yarn) }, }, { @@ -145,7 +146,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Nuget) + return cliutils.CreateConfigCmd(c, project.Nuget) }, }, { @@ -170,7 +171,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Dotnet) + return cliutils.CreateConfigCmd(c, project.Dotnet) }, }, { @@ -195,7 +196,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Go) + return cliutils.CreateConfigCmd(c, project.Go) }, }, { @@ -233,7 +234,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Pip) + return cliutils.CreateConfigCmd(c, project.Pip) }, }, { @@ -258,7 +259,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Pipenv) + return cliutils.CreateConfigCmd(c, project.Pipenv) }, }, { @@ -283,7 +284,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Poetry) + return cliutils.CreateConfigCmd(c, project.Poetry) }, }, { @@ -308,7 +309,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Npm) + return cliutils.CreateConfigCmd(c, project.Npm) }, }, { @@ -353,7 +354,7 @@ func GetCommands() []cli.Command { BashComplete: corecommon.CreateBashCompletionFunc(), Category: buildToolsCategory, Action: func(c *cli.Context) error { - return cliutils.CreateConfigCmd(c, utils.Terraform) + return cliutils.CreateConfigCmd(c, project.Terraform) }, }, { @@ -377,7 +378,7 @@ func MvnCmd(c *cli.Context) (err error) { return err } - configFilePath, exists, err := utils.GetProjectConfFilePath(utils.Maven) + configFilePath, exists, err := project.GetProjectConfFilePath(project.Maven) if err != nil { return err } @@ -392,7 +393,7 @@ func MvnCmd(c *cli.Context) (err error) { if err != nil { return err } - filteredMavenArgs, buildConfiguration, err := utils.ExtractBuildDetailsFromArgs(filteredMavenArgs) + filteredMavenArgs, buildConfiguration, err := build.ExtractBuildDetailsFromArgs(filteredMavenArgs) if err != nil { return err } @@ -433,7 +434,7 @@ func GradleCmd(c *cli.Context) (err error) { return err } - configFilePath, exists, err := utils.GetProjectConfFilePath(utils.Gradle) + configFilePath, exists, err := project.GetProjectConfFilePath(project.Gradle) if err != nil { return err } @@ -445,7 +446,7 @@ func GradleCmd(c *cli.Context) (err error) { return cliutils.WrongNumberOfArgumentsHandler(c) } args := cliutils.ExtractCommand(c) - filteredGradleArgs, buildConfiguration, err := utils.ExtractBuildDetailsFromArgs(args) + filteredGradleArgs, buildConfiguration, err := build.ExtractBuildDetailsFromArgs(args) if err != nil { return err } @@ -486,7 +487,7 @@ func YarnCmd(c *cli.Context) error { return err } - configFilePath, exists, err := utils.GetProjectConfFilePath(utils.Yarn) + configFilePath, exists, err := project.GetProjectConfFilePath(project.Yarn) if err != nil { return err } @@ -505,7 +506,7 @@ func NugetCmd(c *cli.Context) error { if c.NArg() < 1 { return cliutils.WrongNumberOfArgumentsHandler(c) } - configFilePath, exists, err := utils.GetProjectConfFilePath(utils.Nuget) + configFilePath, exists, err := project.GetProjectConfFilePath(project.Nuget) if err != nil { return err } @@ -519,7 +520,7 @@ func NugetCmd(c *cli.Context) error { return err } args := cliutils.ExtractCommand(c) - filteredNugetArgs, buildConfiguration, err := utils.ExtractBuildDetailsFromArgs(args) + filteredNugetArgs, buildConfiguration, err := build.ExtractBuildDetailsFromArgs(args) if err != nil { return err } @@ -545,7 +546,7 @@ func DotnetCmd(c *cli.Context) error { } // Get configuration file path. - configFilePath, exists, err := utils.GetProjectConfFilePath(utils.Dotnet) + configFilePath, exists, err := project.GetProjectConfFilePath(project.Dotnet) if err != nil { return err } @@ -560,7 +561,7 @@ func DotnetCmd(c *cli.Context) error { args := cliutils.ExtractCommand(c) - filteredDotnetArgs, buildConfiguration, err := utils.ExtractBuildDetailsFromArgs(args) + filteredDotnetArgs, buildConfiguration, err := build.ExtractBuildDetailsFromArgs(args) if err != nil { return err } @@ -578,11 +579,11 @@ func DotnetCmd(c *cli.Context) error { } func getNugetAndDotnetConfigFields(configFilePath string) (rtDetails *coreConfig.ServerDetails, targetRepo string, useNugetV2 bool, err error) { - vConfig, err := utils.ReadConfigFile(configFilePath, utils.YAML) + vConfig, err := project.ReadConfigFile(configFilePath, project.YAML) if err != nil { return nil, "", false, fmt.Errorf("error occurred while attempting to read nuget-configuration file: %s", err.Error()) } - projectConfig, err := utils.GetRepoConfigByPrefix(configFilePath, utils.ProjectConfigResolverPrefix, vConfig) + projectConfig, err := project.GetRepoConfigByPrefix(configFilePath, project.ProjectConfigResolverPrefix, vConfig) if err != nil { return nil, "", false, err } @@ -591,7 +592,7 @@ func getNugetAndDotnetConfigFields(configFilePath string) (rtDetails *coreConfig return nil, "", false, err } targetRepo = projectConfig.TargetRepo() - useNugetV2 = vConfig.GetBool(utils.ProjectConfigResolverPrefix + "." + "nugetV2") + useNugetV2 = vConfig.GetBool(project.ProjectConfigResolverPrefix + "." + "nugetV2") return } @@ -651,7 +652,7 @@ func goCmdVerification(c *cli.Context) (string, error) { if c.NArg() < 1 { return "", cliutils.WrongNumberOfArgumentsHandler(c) } - configFilePath, exists, err := utils.GetProjectConfFilePath(utils.Go) + configFilePath, exists, err := project.GetProjectConfFilePath(project.Go) if err != nil { return "", err } @@ -836,7 +837,7 @@ func NpmPublishCmd(c *cli.Context) (err error) { } func GetNpmConfigAndArgs(c *cli.Context) (configFilePath string, args []string, err error) { - configFilePath, exists, err := utils.GetProjectConfFilePath(utils.Npm) + configFilePath, exists, err := project.GetProjectConfFilePath(project.Npm) if err != nil { return "", nil, err } @@ -849,18 +850,18 @@ func GetNpmConfigAndArgs(c *cli.Context) (configFilePath string, args []string, } func PipCmd(c *cli.Context) error { - return pythonCmd(c, utils.Pip) + return pythonCmd(c, project.Pip) } func PipenvCmd(c *cli.Context) error { - return pythonCmd(c, utils.Pipenv) + return pythonCmd(c, project.Pipenv) } func PoetryCmd(c *cli.Context) error { - return pythonCmd(c, utils.Poetry) + return pythonCmd(c, project.Poetry) } -func pythonCmd(c *cli.Context, projectType utils.ProjectType) error { +func pythonCmd(c *cli.Context, projectType project.ProjectType) error { if show, err := cliutils.ShowCmdHelpIfNeeded(c, c.Args()); show || err != nil { return err } @@ -869,7 +870,7 @@ func pythonCmd(c *cli.Context, projectType utils.ProjectType) error { } // Get python configuration. - pythonConfig, err := utils.GetResolutionOnlyConfiguration(projectType) + pythonConfig, err := project.GetResolutionOnlyConfiguration(projectType) if err != nil { return fmt.Errorf("error occurred while attempting to read %[1]s-configuration file: %[2]s\n"+ "Please run 'jf %[1]s-config' command prior to running 'jf %[1]s'", projectType.String(), err.Error()) @@ -884,15 +885,15 @@ func pythonCmd(c *cli.Context, projectType utils.ProjectType) error { orgArgs := cliutils.ExtractCommand(c) cmdName, filteredArgs := getCommandName(orgArgs) switch projectType { - case utils.Pip: + case project.Pip: pythonCommand := python.NewPipCommand() pythonCommand.SetServerDetails(rtDetails).SetRepo(pythonConfig.TargetRepo()).SetCommandName(cmdName).SetArgs(filteredArgs) return commands.Exec(pythonCommand) - case utils.Pipenv: + case project.Pipenv: pythonCommand := python.NewPipenvCommand() pythonCommand.SetServerDetails(rtDetails).SetRepo(pythonConfig.TargetRepo()).SetCommandName(cmdName).SetArgs(filteredArgs) return commands.Exec(pythonCommand) - case utils.Poetry: + case project.Poetry: pythonCommand := python.NewPoetryCommand() pythonCommand.SetServerDetails(rtDetails).SetRepo(pythonConfig.TargetRepo()).SetCommandName(cmdName).SetArgs(filteredArgs) return commands.Exec(pythonCommand) @@ -919,7 +920,7 @@ func terraformCmd(c *cli.Context) error { } func getTerraformConfigAndArgs(c *cli.Context) (configFilePath string, args []string, err error) { - configFilePath, exists, err := utils.GetProjectConfFilePath(utils.Terraform) + configFilePath, exists, err := project.GetProjectConfFilePath(project.Terraform) if err != nil { return "", nil, err } diff --git a/docker_test.go b/docker_test.go index 43b59e310..28a9b79e9 100644 --- a/docker_test.go +++ b/docker_test.go @@ -3,19 +3,21 @@ package main import ( "context" "fmt" - biutils "github.com/jfrog/build-info-go/utils" "os" "path" "path/filepath" "testing" "time" + biutils "github.com/jfrog/build-info-go/utils" + "github.com/jfrog/build-info-go/entities" "github.com/jfrog/gofrog/version" coreContainer "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/container" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/generic" "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/container" + "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-cli-core/v2/common/spec" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-cli/inttestutils" @@ -106,7 +108,7 @@ func TestContainerPushWithDetailedSummary(t *testing.T) { defer inttestutils.DeleteTestImage(t, imageTag, containerManager) // Testing detailed summary without build-info pushCommand := coreContainer.NewPushCommand(containerManager) - pushCommand.SetThreads(1).SetDetailedSummary(true).SetCmdParams([]string{"push", imageTag}).SetBuildConfiguration(new(utils.BuildConfiguration)).SetRepo(tests.DockerLocalRepo).SetServerDetails(serverDetails).SetImageTag(imageTag) + pushCommand.SetThreads(1).SetDetailedSummary(true).SetCmdParams([]string{"push", imageTag}).SetBuildConfiguration(new(build.BuildConfiguration)).SetRepo(tests.DockerLocalRepo).SetServerDetails(serverDetails).SetImageTag(imageTag) assert.NoError(t, pushCommand.Run()) result := pushCommand.Result() reader := result.Reader() @@ -116,7 +118,7 @@ func TestContainerPushWithDetailedSummary(t *testing.T) { assert.Equal(t, 64, len(transferDetails.Sha256), "Summary validation failed - invalid sha256 has returned from artifactory") } // Testing detailed summary with build-info - pushCommand.SetBuildConfiguration(utils.NewBuildConfiguration(tests.DockerBuildName, buildNumber, "", "")) + pushCommand.SetBuildConfiguration(build.NewBuildConfiguration(tests.DockerBuildName, buildNumber, "", "")) assert.NoError(t, pushCommand.Run()) anotherResult := pushCommand.Result() anotherReader := anotherResult.Reader() diff --git a/general/cisetup/cisetup.go b/general/cisetup/cisetup.go index 450c04ad5..07af9a7c1 100644 --- a/general/cisetup/cisetup.go +++ b/general/cisetup/cisetup.go @@ -18,7 +18,7 @@ import ( "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/buildinfo" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/permissiontarget" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/usersmanagement" - rtutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" + "github.com/jfrog/jfrog-cli-core/v2/common/build" coreCommonCommands "github.com/jfrog/jfrog-cli-core/v2/common/commands" "github.com/jfrog/jfrog-cli-core/v2/general/cisetup" repoutils "github.com/jfrog/jfrog-cli-core/v2/general/project" @@ -522,7 +522,7 @@ func (cc *CiSetupCommand) publishFirstBuild() (err error) { cc.data.BuildName = fmt.Sprintf("%s-%s", cc.data.RepositoryName, cc.data.GitBranch) // Run BAG Command (in order to publish the first, empty, build info) buildAddGitConfigurationCmd := buildinfo.NewBuildAddGitCommand().SetDotGitPath(cc.data.LocalDirPath).SetServerId(cisetup.ConfigServerId) - buildConfiguration := rtutils.NewBuildConfiguration(cc.data.BuildName, DefaultFirstBuildNumber, "", "") + buildConfiguration := build.NewBuildConfiguration(cc.data.BuildName, DefaultFirstBuildNumber, "", "") buildAddGitConfigurationCmd = buildAddGitConfigurationCmd.SetBuildConfiguration(buildConfiguration) log.Info("Generating an initial build-info...") err = coreCommonCommands.Exec(buildAddGitConfigurationCmd) diff --git a/go.mod b/go.mod index bc3540ed1..3de39f17f 100644 --- a/go.mod +++ b/go.mod @@ -132,7 +132,7 @@ require ( // replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20231130093251-25c79868c10c -// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20231207140254-799876947bac +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/attiasas/jfrog-cli-core/v2 v2.0.0-20231214131551-dc1531890f85 // replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.3.2-0.20231130091721-6d742be8bc7a diff --git a/go.sum b/go.sum index 679481998..229b1d71f 100644 --- a/go.sum +++ b/go.sum @@ -69,6 +69,8 @@ github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkE github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/attiasas/jfrog-cli-core/v2 v2.0.0-20231214131551-dc1531890f85 h1:hwxs4zOuDbM2w1U4bBAyH+bNtWu59FVtGg6m9FuDQ+c= +github.com/attiasas/jfrog-cli-core/v2 v2.0.0-20231214131551-dc1531890f85/go.mod h1:RFQwrZ1qXAQ+X0xfuzxBBDIYuRnDsPy12xlyjuOpUog= github.com/bradleyjkemp/cupaloy/v2 v2.8.0 h1:any4BmKE+jGIaMpnU8YgH/I2LPiLBufr6oMMlVBbn9M= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= @@ -243,8 +245,6 @@ github.com/jfrog/gofrog v1.3.2 h1:TktKP+PdZdxjkYZxWWIq4DkTGSYtr9Slsy+egZpEhUY= github.com/jfrog/gofrog v1.3.2/go.mod h1:AQo5Fq0G9nDEF6icH7MYQK0iohR4HuEAXl8jaxRuT6Q= 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-core/v2 v2.47.3 h1:wh5WuRfgV1bHAHYm+wWyMASZZ/1W4mS0ed46Aa0jiQk= -github.com/jfrog/jfrog-cli-core/v2 v2.47.3/go.mod h1:RFQwrZ1qXAQ+X0xfuzxBBDIYuRnDsPy12xlyjuOpUog= github.com/jfrog/jfrog-client-go v1.35.0 h1:VTyrR/jFlWInRdGYswa2fwFc1Thsh6eGMnHuqhDVh7s= github.com/jfrog/jfrog-client-go v1.35.0/go.mod h1:cG0vdKXbyfupKgSYmwA5FZPco6zSfyJi3eEYOxuqm/k= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= diff --git a/go_test.go b/go_test.go index 0d558121f..153892df6 100644 --- a/go_test.go +++ b/go_test.go @@ -2,18 +2,19 @@ package main import ( "fmt" - biutils "github.com/jfrog/build-info-go/utils" "os" "os/exec" "path/filepath" "testing" + biutils "github.com/jfrog/build-info-go/utils" + coretests "github.com/jfrog/jfrog-cli-core/v2/utils/tests" clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests" buildinfo "github.com/jfrog/build-info-go/entities" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/golang" - "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" + "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-cli-core/v2/common/commands" "github.com/jfrog/jfrog-cli-core/v2/common/spec" "github.com/jfrog/jfrog-cli/inttestutils" @@ -156,12 +157,12 @@ func TestGoPublishWithDetailedSummary(t *testing.T) { // GoPublish with detailed summary without buildinfo. goPublishCmd := golang.NewGoPublishCommand() - goPublishCmd.SetConfigFilePath(filepath.Join(projectPath, ".jfrog", "projects", "go.yaml")).SetBuildConfiguration(new(utils.BuildConfiguration)).SetVersion("v1.0.0").SetDetailedSummary(true) + goPublishCmd.SetConfigFilePath(filepath.Join(projectPath, ".jfrog", "projects", "go.yaml")).SetBuildConfiguration(new(build.BuildConfiguration)).SetVersion("v1.0.0").SetDetailedSummary(true) assert.NoError(t, commands.Exec(goPublishCmd)) tests.VerifySha256DetailedSummaryFromResult(t, goPublishCmd.Result()) // GoPublish with buildinfo configuration - goPublishCmd.SetBuildConfiguration(utils.NewBuildConfiguration(tests.GoBuildName, buildNumber, ModuleNameJFrogTest, "")) + goPublishCmd.SetBuildConfiguration(build.NewBuildConfiguration(tests.GoBuildName, buildNumber, ModuleNameJFrogTest, "")) assert.NoError(t, commands.Exec(goPublishCmd)) tests.VerifySha256DetailedSummaryFromResult(t, goPublishCmd.Result()) diff --git a/gradle_test.go b/gradle_test.go index b629b096b..3167e7c09 100644 --- a/gradle_test.go +++ b/gradle_test.go @@ -10,7 +10,7 @@ import ( buildinfo "github.com/jfrog/build-info-go/entities" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/gradle" - "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" + "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-cli-core/v2/common/commands" "github.com/jfrog/jfrog-cli-core/v2/common/spec" @@ -112,7 +112,7 @@ func TestGradleBuildWithServerIDAndDetailedSummary(t *testing.T) { // Test gradle with detailed summary without buildinfo props. filteredGradleArgs := []string{"clean artifactoryPublish", "-b" + buildGradlePath} - gradleCmd := gradle.NewGradleCommand().SetConfiguration(new(utils.BuildConfiguration)).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true) + gradleCmd := gradle.NewGradleCommand().SetConfiguration(new(build.BuildConfiguration)).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true) assert.NoError(t, commands.Exec(gradleCmd)) // Validate sha256 assert.NotNil(t, gradleCmd.Result()) @@ -121,7 +121,7 @@ func TestGradleBuildWithServerIDAndDetailedSummary(t *testing.T) { } // Test gradle with detailed summary + buildinfo. - gradleCmd = gradle.NewGradleCommand().SetConfiguration(utils.NewBuildConfiguration(tests.GradleBuildName, buildNumber, "", "")).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true) + gradleCmd = gradle.NewGradleCommand().SetConfiguration(build.NewBuildConfiguration(tests.GradleBuildName, buildNumber, "", "")).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true) assert.NoError(t, commands.Exec(gradleCmd)) // Validate sha256 tests.VerifySha256DetailedSummaryFromResult(t, gradleCmd.Result()) diff --git a/inttestutils/buildinfo.go b/inttestutils/buildinfo.go index 3003172bf..bd4ad6a61 100644 --- a/inttestutils/buildinfo.go +++ b/inttestutils/buildinfo.go @@ -9,7 +9,7 @@ import ( buildinfo "github.com/jfrog/build-info-go/entities" "github.com/jfrog/jfrog-client-go/utils/errorutils" - coreutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" + coreutils "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-client-go/http/httpclient" "github.com/jfrog/jfrog-client-go/utils" diff --git a/main_test.go b/main_test.go index 4d42e6107..1a0fe2838 100644 --- a/main_test.go +++ b/main_test.go @@ -4,10 +4,16 @@ import ( "errors" "flag" "fmt" + "os" + "path/filepath" + "strconv" + "strings" + "testing" + buildinfo "github.com/jfrog/build-info-go/entities" commandUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils" - artifactoryUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" "github.com/jfrog/jfrog-cli-core/v2/common/commands" + "github.com/jfrog/jfrog-cli-core/v2/common/project" "github.com/jfrog/jfrog-cli-core/v2/common/spec" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" @@ -23,11 +29,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/urfave/cli" "gopkg.in/yaml.v2" - "os" - "path/filepath" - "strconv" - "strings" - "testing" ) func TestMain(m *testing.M) { @@ -192,17 +193,17 @@ func initArtifactoryCli() { } } -func createConfigFileForTest(dirs []string, resolver, deployer string, t *testing.T, confType artifactoryUtils.ProjectType, global bool) error { +func createConfigFileForTest(dirs []string, resolver, deployer string, t *testing.T, confType project.ProjectType, global bool) error { var filePath string for _, atDir := range dirs { d, err := yaml.Marshal(&commandUtils.ConfigFile{ Version: 1, ConfigType: confType.String(), - Resolver: artifactoryUtils.Repository{ + Resolver: project.Repository{ Repo: resolver, ServerId: "default", }, - Deployer: artifactoryUtils.Repository{ + Deployer: project.Repository{ Repo: deployer, ServerId: "default", }, diff --git a/maven_test.go b/maven_test.go index d8c2cb783..7d3958ca1 100644 --- a/maven_test.go +++ b/maven_test.go @@ -11,7 +11,7 @@ import ( buildinfo "github.com/jfrog/build-info-go/entities" biutils "github.com/jfrog/build-info-go/utils" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/mvn" - "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" + buildUtils "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-cli-core/v2/common/commands" "github.com/jfrog/jfrog-cli-core/v2/common/spec" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" @@ -49,10 +49,10 @@ func TestMavenBuildWithServerID(t *testing.T) { func TestMavenBuildWithNoProxy(t *testing.T) { initMavenTest(t, false) - setEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, utils.HttpProxyEnvKey, "http://login:pass@proxy.mydomain:8888") + setEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, buildUtils.HttpProxyEnvKey, "http://login:pass@proxy.mydomain:8888") defer setEnvCallBack() // Set noProxy to match all to skip http proxy configuration - setNoProxyEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, utils.NoProxyEnvKey, "*") + setNoProxyEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, buildUtils.NoProxyEnvKey, "*") defer setNoProxyEnvCallBack() assert.NoError(t, runMaven(t, createSimpleMavenProject, tests.MavenConfig, "install")) // Validate @@ -64,10 +64,10 @@ func TestMavenBuildWithNoProxy(t *testing.T) { func TestMavenBuildWithNoProxyHttps(t *testing.T) { initMavenTest(t, false) - setHttpsEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, utils.HttpsProxyEnvKey, "https://logins:passw@proxys.mydomains:8889") + setHttpsEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, buildUtils.HttpsProxyEnvKey, "https://logins:passw@proxys.mydomains:8889") defer setHttpsEnvCallBack() // Set noProxy to match all to skip https proxy configuration - setNoProxyEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, utils.NoProxyEnvKey, "*") + setNoProxyEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, buildUtils.NoProxyEnvKey, "*") defer setNoProxyEnvCallBack() assert.NoError(t, runMaven(t, createSimpleMavenProject, tests.MavenConfig, "install")) // Validate @@ -104,7 +104,7 @@ func TestMavenBuildWithServerIDAndDetailedSummary(t *testing.T) { defer clientTestUtils.ChangeDirAndAssert(t, oldHomeDir) repoLocalSystemProp := localRepoSystemProperty + localRepoDir filteredMavenArgs := []string{"clean", "install", "-B", repoLocalSystemProp} - mvnCmd := mvn.NewMvnCommand().SetConfiguration(new(utils.BuildConfiguration)).SetConfigPath(filepath.Join(destPath, tests.MavenConfig)).SetGoals(filteredMavenArgs).SetDetailedSummary(true) + mvnCmd := mvn.NewMvnCommand().SetConfiguration(new(buildUtils.BuildConfiguration)).SetConfigPath(filepath.Join(destPath, tests.MavenConfig)).SetGoals(filteredMavenArgs).SetDetailedSummary(true) assert.NoError(t, commands.Exec(mvnCmd)) // Validate assert.NotNil(t, mvnCmd.Result()) diff --git a/npm_test.go b/npm_test.go index 5222e4e03..55e6bc843 100644 --- a/npm_test.go +++ b/npm_test.go @@ -19,14 +19,15 @@ import ( clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests" buildinfo "github.com/jfrog/build-info-go/entities" + "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-cli-core/v2/common/commands" + "github.com/jfrog/jfrog-cli-core/v2/common/project" "github.com/jfrog/jfrog-cli-core/v2/common/spec" clientutils "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/npm" - "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" "github.com/jfrog/jfrog-cli-core/v2/utils/ioutils" "github.com/jfrog/jfrog-cli/inttestutils" "github.com/jfrog/jfrog-cli/utils/tests" @@ -153,7 +154,7 @@ func TestNpmWithGlobalConfig(t *testing.T) { } func validateNpmLocalBuildInfo(t *testing.T, buildName, buildNumber, moduleName string) { - buildInfoService := utils.CreateBuildInfoService() + buildInfoService := build.CreateBuildInfoService() npmBuild, err := buildInfoService.GetOrCreateBuildWithProject(buildName, buildNumber, "") assert.NoError(t, err) bi, err := npmBuild.ToBuildInfo() @@ -178,7 +179,7 @@ func TestNpmWithoutPackageJson(t *testing.T) { defer chdirCallback() // Run config to allow resolution from Artifactory - err = createConfigFileForTest([]string{tempDirPath}, tests.NpmRemoteRepo, "", t, utils.Npm, false) + err = createConfigFileForTest([]string{tempDirPath}, tests.NpmRemoteRepo, "", t, project.Npm, false) assert.NoError(t, err) // Run npm install and make sure that package.json and package-lock.json were created @@ -232,7 +233,7 @@ func initNpmFilesTest(t *testing.T) (npmProjectPath, npmScopedProjectPath, npmNp npmPostInstallProjectPath = createNpmProject(t, "npmpostinstall") _ = createNpmProject(t, filepath.Join("npmpostinstall", "subdir")) err := createConfigFileForTest([]string{filepath.Dir(npmProjectPath), filepath.Dir(npmScopedProjectPath), - filepath.Dir(npmNpmrcProjectPath), filepath.Dir(npmProjectCi), filepath.Dir(npmPostInstallProjectPath)}, tests.NpmRemoteRepo, tests.NpmRepo, t, utils.Npm, false) + filepath.Dir(npmNpmrcProjectPath), filepath.Dir(npmProjectCi), filepath.Dir(npmPostInstallProjectPath)}, tests.NpmRemoteRepo, tests.NpmRepo, t, project.Npm, false) assert.NoError(t, err) prepareArtifactoryForNpmBuild(t, filepath.Dir(npmProjectPath)) prepareArtifactoryForNpmBuild(t, filepath.Dir(npmProjectCi)) @@ -242,7 +243,7 @@ func initNpmFilesTest(t *testing.T) (npmProjectPath, npmScopedProjectPath, npmNp func initNpmProjectTest(t *testing.T) (npmProjectPath string) { npmProjectPath = filepath.Dir(createNpmProject(t, "npmproject")) - err := createConfigFileForTest([]string{npmProjectPath}, tests.NpmRemoteRepo, tests.NpmRepo, t, utils.Npm, false) + err := createConfigFileForTest([]string{npmProjectPath}, tests.NpmRemoteRepo, tests.NpmRepo, t, project.Npm, false) assert.NoError(t, err) prepareArtifactoryForNpmBuild(t, npmProjectPath) return @@ -252,7 +253,7 @@ func initGlobalNpmFilesTest(t *testing.T) (npmProjectPath string) { npmProjectPath = createNpmProject(t, "npmproject") jfrogHomeDir, err := coreutils.GetJfrogHomeDir() assert.NoError(t, err) - err = createConfigFileForTest([]string{jfrogHomeDir}, tests.NpmRemoteRepo, tests.NpmRepo, t, utils.Npm, true) + err = createConfigFileForTest([]string{jfrogHomeDir}, tests.NpmRemoteRepo, tests.NpmRepo, t, project.Npm, true) assert.NoError(t, err) prepareArtifactoryForNpmBuild(t, filepath.Dir(npmProjectPath)) return @@ -444,7 +445,7 @@ func TestNpmPackInstall(t *testing.T) { command := "npm i" testWorkingDir, err := filepath.Abs(createNpmProject(t, "npmnpmrcproject")) assert.NoError(t, err) - err = createConfigFileForTest([]string{filepath.Dir(testWorkingDir)}, tests.NpmRemoteRepo, tests.NpmRepo, t, utils.Npm, false) + err = createConfigFileForTest([]string{filepath.Dir(testWorkingDir)}, tests.NpmRemoteRepo, tests.NpmRepo, t, project.Npm, false) assert.NoError(t, err) clientTestUtils.ChangeDirAndAssert(t, filepath.Dir(testWorkingDir)) // Temporarily change the cache folder to a temporary folder - to make sure the cache is clean and dependencies will be downloaded from Artifactory @@ -461,7 +462,7 @@ func TestNpmPackInstall(t *testing.T) { runJfrogCli(t, commandArgs...) // Validate that no dependencies were collected - buildInfoService := utils.CreateBuildInfoService() + buildInfoService := build.CreateBuildInfoService() npmBuild, err := buildInfoService.GetOrCreateBuild(tests.NpmBuildName, buildNumber) assert.NoError(t, err) defer func() { @@ -486,7 +487,7 @@ func TestYarn(t *testing.T) { assert.NoError(t, biutils.CopyDir(testDataSource, testDataTarget, true, nil)) yarnProjectPath := filepath.Join(testDataTarget, "yarnproject") - assert.NoError(t, createConfigFileForTest([]string{yarnProjectPath}, tests.NpmRemoteRepo, "", t, utils.Yarn, false)) + assert.NoError(t, createConfigFileForTest([]string{yarnProjectPath}, tests.NpmRemoteRepo, "", t, project.Yarn, false)) wd, err := os.Getwd() assert.NoError(t, err, "Failed to get current dir") diff --git a/nuget_test.go b/nuget_test.go index 1f5f498b1..c8bf733d2 100644 --- a/nuget_test.go +++ b/nuget_test.go @@ -2,11 +2,17 @@ package main import ( "encoding/xml" + "os" + "path/filepath" + "strconv" + "strings" + "testing" + dotnetUtils "github.com/jfrog/build-info-go/build/utils/dotnet" buildInfo "github.com/jfrog/build-info-go/entities" biutils "github.com/jfrog/build-info-go/utils" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/dotnet" - "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" + "github.com/jfrog/jfrog-cli-core/v2/common/project" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" coreTests "github.com/jfrog/jfrog-cli-core/v2/utils/tests" @@ -17,11 +23,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/exp/slices" - "os" - "path/filepath" - "strconv" - "strings" - "testing" ) func initNugetTest(t *testing.T) { @@ -51,7 +52,7 @@ func TestNugetResolve(t *testing.T) { {"multipackagesconfigsingleprojectdir", "multipackagesconfig", []string{dotnetUtils.Nuget.String(), "restore", "./proj2/", "-SolutionDirectory", "."}, []string{"proj2"}, []int{3}}, {"multipackagesconfigsingleprojectconfig", "multipackagesconfig", []string{dotnetUtils.Nuget.String(), "restore", "./proj1/packages.config", "-SolutionDirectory", "."}, []string{"proj1"}, []int{4}}, } - testNativeNugetDotnetResolve(t, uniqueNugetTests, tests.NuGetBuildName, utils.Nuget) + testNativeNugetDotnetResolve(t, uniqueNugetTests, tests.NuGetBuildName, project.Nuget) } func TestDotnetResolve(t *testing.T) { @@ -59,10 +60,10 @@ func TestDotnetResolve(t *testing.T) { {"dotnetargswithspaces", "multireference", []string{dotnetUtils.DotnetCore.String(), "restore", "src/multireference.proj1/", "--packages", "./packages dir with spaces"}, []string{"proj1"}, []int{5}}, {"multireferencesingleprojectdir", "multireference", []string{dotnetUtils.DotnetCore.String(), "restore", "src/multireference.proj1/"}, []string{"proj1"}, []int{5}}, } - testNativeNugetDotnetResolve(t, uniqueDotnetTests, tests.DotnetBuildName, utils.Dotnet) + testNativeNugetDotnetResolve(t, uniqueDotnetTests, tests.DotnetBuildName, project.Dotnet) } -func testNativeNugetDotnetResolve(t *testing.T, uniqueTests []testDescriptor, buildName string, projectType utils.ProjectType) { +func testNativeNugetDotnetResolve(t *testing.T, uniqueTests []testDescriptor, buildName string, projectType project.ProjectType) { initNugetTest(t) testDescriptors := append(slices.Clone(uniqueTests), []testDescriptor{ {"referencewithoutmodulechnage", "reference", []string{projectType.String(), "restore"}, []string{"reference"}, []int{6}}, @@ -104,7 +105,7 @@ func TestNuGetWithGlobalConfig(t *testing.T) { projectPath := createNugetProject(t, "packagesconfig") jfrogHomeDir, err := coreutils.GetJfrogHomeDir() assert.NoError(t, err) - err = createConfigFileForTest([]string{jfrogHomeDir}, tests.NugetRemoteRepo, "", t, utils.Nuget, true) + err = createConfigFileForTest([]string{jfrogHomeDir}, tests.NugetRemoteRepo, "", t, project.Nuget, true) assert.NoError(t, err) testNugetCmd(t, projectPath, tests.NuGetBuildName, "1", []string{"packagesconfig"}, []string{"nuget", "restore"}, []int{6}) diff --git a/utils/cliutils/utils.go b/utils/cliutils/utils.go index 94d888400..b3ad88917 100644 --- a/utils/cliutils/utils.go +++ b/utils/cliutils/utils.go @@ -18,7 +18,9 @@ import ( commandUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils" artifactoryUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" containerutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/container" + buildUtils "github.com/jfrog/jfrog-cli-core/v2/common/build" coreCommonCommands "github.com/jfrog/jfrog-cli-core/v2/common/commands" + "github.com/jfrog/jfrog-cli-core/v2/common/project" speccore "github.com/jfrog/jfrog-cli-core/v2/common/spec" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" @@ -638,14 +640,14 @@ func fixWinPathBySource(path string, fromSpec bool) string { return path } -func CreateConfigCmd(c *cli.Context, confType artifactoryUtils.ProjectType) error { +func CreateConfigCmd(c *cli.Context, confType project.ProjectType) error { if c.NArg() != 0 { return WrongNumberOfArgumentsHandler(c) } return commandUtils.CreateBuildConfig(c, confType) } -func RunNativeCmdWithDeprecationWarning(cmdName string, projectType artifactoryUtils.ProjectType, c *cli.Context, cmd func(c *cli.Context) error) error { +func RunNativeCmdWithDeprecationWarning(cmdName string, projectType project.ProjectType, c *cli.Context, cmd func(c *cli.Context) error) error { if shouldLogWarning() { LogNativeCommandDeprecation(cmdName, projectType.String()) } @@ -683,8 +685,8 @@ func NotSupportedNativeDockerCommand(oldCmdName string) error { %s rt %s `, corecontainercmds.MinRtVersionForRepoFetching, coreutils.GetCliExecutableName(), oldCmdName) } -func RunConfigCmdWithDeprecationWarning(cmdName, oldSubcommand string, confType artifactoryUtils.ProjectType, c *cli.Context, - cmd func(c *cli.Context, confType artifactoryUtils.ProjectType) error) error { +func RunConfigCmdWithDeprecationWarning(cmdName, oldSubcommand string, confType project.ProjectType, c *cli.Context, + cmd func(c *cli.Context, confType project.ProjectType) error) error { logNonNativeCommandDeprecation(cmdName, oldSubcommand) return cmd(c, confType) } @@ -727,8 +729,8 @@ func SetCliExecutableName(executablePath string) { // Returns build configuration struct using the args (build name/number) and options (project) provided by the user. // Any empty configuration could be later overridden by environment variables if set. -func CreateBuildConfiguration(c *cli.Context) *artifactoryUtils.BuildConfiguration { - buildConfiguration := new(artifactoryUtils.BuildConfiguration) +func CreateBuildConfiguration(c *cli.Context) *buildUtils.BuildConfiguration { + buildConfiguration := new(buildUtils.BuildConfiguration) buildNameArg, buildNumberArg := c.Args().Get(0), c.Args().Get(1) if buildNameArg == "" || buildNumberArg == "" { buildNameArg = "" @@ -740,8 +742,8 @@ func CreateBuildConfiguration(c *cli.Context) *artifactoryUtils.BuildConfigurati // Returns build configuration struct using the options provided by the user. // Any empty configuration could be later overridden by environment variables if set. -func CreateBuildConfigurationWithModule(c *cli.Context) (buildConfigConfiguration *artifactoryUtils.BuildConfiguration, err error) { - buildConfigConfiguration = new(artifactoryUtils.BuildConfiguration) +func CreateBuildConfigurationWithModule(c *cli.Context) (buildConfigConfiguration *buildUtils.BuildConfiguration, err error) { + buildConfigConfiguration = new(buildUtils.BuildConfiguration) err = buildConfigConfiguration.SetBuildName(c.String("build-name")).SetBuildNumber(c.String("build-number")). SetProject(c.String("project")).SetModule(c.String("module")).ValidateBuildAndModuleParams() return diff --git a/xray_test.go b/xray_test.go index 05182a09a..5cb5c3831 100644 --- a/xray_test.go +++ b/xray_test.go @@ -5,8 +5,6 @@ import ( "errors" "flag" "fmt" - biutils "github.com/jfrog/build-info-go/utils" - "github.com/jfrog/jfrog-cli-core/v2/xray/scangraph" "net/http" "net/http/httptest" "os" @@ -19,15 +17,20 @@ import ( "testing" "time" + biutils "github.com/jfrog/build-info-go/utils" + "github.com/jfrog/jfrog-cli-core/v2/xray/scangraph" + "github.com/jfrog/gofrog/version" coreContainer "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/container" artCmdUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils" - artUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/container" + "github.com/jfrog/jfrog-cli-core/v2/common/build" coreCmd "github.com/jfrog/jfrog-cli-core/v2/common/commands" + "github.com/jfrog/jfrog-cli-core/v2/common/project" commontests "github.com/jfrog/jfrog-cli-core/v2/common/tests" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" + "github.com/jfrog/jfrog-cli-core/v2/utils/dependencies" coretests "github.com/jfrog/jfrog-cli-core/v2/utils/tests" coreCuration "github.com/jfrog/jfrog-cli-core/v2/xray/commands/curation" "github.com/jfrog/jfrog-cli-core/v2/xray/commands/scan" @@ -515,7 +518,7 @@ func TestDownloadAnalyzerManagerIfNeeded(t *testing.T) { defer setEnvCallBack() // Download - err := artUtils.DownloadAnalyzerManagerIfNeeded() + err := dependencies.DownloadAnalyzerManagerIfNeeded() assert.NoError(t, err) // Validate Analyzer manager app & checksum.sh2 file exist @@ -525,7 +528,7 @@ func TestDownloadAnalyzerManagerIfNeeded(t *testing.T) { exists, err := fileutils.IsFileExists(amPath, false) assert.NoError(t, err) assert.True(t, exists) - checksumPath := filepath.Join(path, artUtils.ChecksumFileName) + checksumPath := filepath.Join(path, dependencies.ChecksumFileName) exists, err = fileutils.IsFileExists(checksumPath, false) assert.NoError(t, err) assert.True(t, exists) @@ -536,7 +539,7 @@ func TestDownloadAnalyzerManagerIfNeeded(t *testing.T) { // Validate no second download occurred firstFileStat, err := os.Stat(amPath) assert.NoError(t, err) - err = artUtils.DownloadAnalyzerManagerIfNeeded() + err = dependencies.DownloadAnalyzerManagerIfNeeded() assert.NoError(t, err) secondFileStat, err := os.Stat(amPath) assert.NoError(t, err) @@ -694,7 +697,7 @@ func runDockerScan(t *testing.T, imageName, watchName string, minViolations, min // Pull image from docker repo imageTag := path.Join(*tests.ContainerRegistry, tests.DockerVirtualRepo, imageName) dockerPullCommand := coreContainer.NewPullCommand(container.DockerClient) - dockerPullCommand.SetCmdParams([]string{"pull", imageTag}).SetImageTag(imageTag).SetRepo(tests.DockerVirtualRepo).SetServerDetails(serverDetails).SetBuildConfiguration(new(artUtils.BuildConfiguration)) + dockerPullCommand.SetCmdParams([]string{"pull", imageTag}).SetImageTag(imageTag).SetRepo(tests.DockerVirtualRepo).SetServerDetails(serverDetails).SetBuildConfiguration(new(build.BuildConfiguration)) if assert.NoError(t, dockerPullCommand.Run()) { defer inttestutils.DeleteTestImage(t, imageTag, container.DockerClient) @@ -861,7 +864,7 @@ func TestCurationAudit(t *testing.T) { resolutionRepo := "repo-resolve" deploymentRepo := "repo-deploy" context := createContext(t, resolutionServerId+"="+config.ServerId, resolutionRepo+"=npms", deploymentServerId+"="+config.ServerId, deploymentRepo+"=npm-local", "global=false") - err = artCmdUtils.CreateBuildConfig(context, artUtils.Npm) + err = artCmdUtils.CreateBuildConfig(context, project.Npm) assert.NoError(t, err) localXrayCli := xrayCli.WithoutCredentials() @@ -968,25 +971,25 @@ func TestDependencyResolutionFromArtifactory(t *testing.T) { testProjectPath []string resolveRepoName string cacheRepoName string - projectType artUtils.ProjectType + projectType project.ProjectType }{ { testProjectPath: []string{"npm", "npmproject"}, resolveRepoName: tests.NpmRemoteRepo, cacheRepoName: tests.NpmRemoteRepo, - projectType: artUtils.Npm, + projectType: project.Npm, }, { testProjectPath: []string{"nuget", "simple-dotnet"}, resolveRepoName: tests.NugetRemoteRepo, cacheRepoName: tests.NugetRemoteRepo, - projectType: artUtils.Dotnet, + projectType: project.Dotnet, }, { testProjectPath: []string{"yarn", "yarnproject"}, resolveRepoName: tests.YarnRemoteRepo, cacheRepoName: tests.YarnRemoteRepo, - projectType: artUtils.Yarn, + projectType: project.Yarn, }, } @@ -997,7 +1000,7 @@ func TestDependencyResolutionFromArtifactory(t *testing.T) { } } -func testSingleTechDependencyResolution(t *testing.T, testProjectPartialPath []string, resolveRepoName string, cacheRepoName string, projectType artUtils.ProjectType) { +func testSingleTechDependencyResolution(t *testing.T, testProjectPartialPath []string, resolveRepoName string, cacheRepoName string, projectType project.ProjectType) { tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t) defer createTempDirCallback() testProjectPath := filepath.Join(append([]string{filepath.FromSlash(tests.GetTestResourcesPath())}, testProjectPartialPath...)...) @@ -1018,7 +1021,7 @@ func testSingleTechDependencyResolution(t *testing.T, testProjectPartialPath []s // Before the resolution from Artifactory, we verify whether the repository's cache is empty. assert.Equal(t, "[]\n", output) - if projectType == artUtils.Dotnet { + if projectType == project.Dotnet { // In Nuget/Dotnet projects we need to clear local caches so we will resolve dependencies from Artifactory _, err = exec.Command("dotnet", "nuget", "locals", "all", "--clear").CombinedOutput() assert.NoError(t, err)