Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ node("docker-ubuntu20-xlarge") {
repo = 'jfrog-cli'
sh 'rm -rf temp'
sh 'mkdir temp'
def goRoot = tool 'go-1.24.6'
def goRoot = tool 'go-1.25.4'
env.GOROOT="$goRoot"
env.PATH+=":${goRoot}/bin:/tmp/node-${nodeVersion}-linux-x64/bin"
env.GO111MODULE="on"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![Scanned by Frogbot](https://raw.github.com/jfrog/frogbot/master/images/frogbot-badge.svg)](https://github.com/jfrog/frogbot#readme)
[![Go Report Card](https://goreportcard.com/badge/github.com/jfrog/jfrog-cli)](https://goreportcard.com/report/github.com/jfrog/jfrog-cli)
[![license](https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=flat)](https://raw.githubusercontent.com/jfrog/jfrog-cli/master/LICENSE) [![](https://img.shields.io/badge/Docs-%F0%9F%93%96-blue)](https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli)
[![Go version](https://img.shields.io/github/go-mod/go-version/jfrog/jfrog-cli)](https://tip.golang.org/doc/go1.24)
[![Go version](https://img.shields.io/github/go-mod/go-version/jfrog/jfrog-cli)](https://tip.golang.org/doc/go1.25)

</div>

Expand Down
19 changes: 9 additions & 10 deletions artifactory/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import (
"github.com/jfrog/jfrog-cli/utils/cliutils"
"github.com/jfrog/jfrog-client-go/artifactory/services"
clientutils "github.com/jfrog/jfrog-client-go/utils"
utilsForLC "github.com/jfrog/jfrog-client-go/utils"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jszwec/csvutil"
Expand Down Expand Up @@ -561,7 +560,7 @@ func prepareDownloadCommand(c *cli.Context) (*spec.SpecFiles, error) {
if c.NArg() > 0 && c.IsSet("spec") {
return nil, cliutils.PrintHelpAndReturnError("No arguments should be sent when the spec option is used.", c)
}
if !(c.NArg() == 1 || c.NArg() == 2 || (c.NArg() == 0 && (c.IsSet("spec") || c.IsSet("build") || c.IsSet("bundle")))) {
if c.NArg() != 1 && c.NArg() != 2 && (c.NArg() != 0 || (!c.IsSet("spec") && !c.IsSet("build") && !c.IsSet("bundle"))) {
return nil, cliutils.WrongNumberOfArgumentsHandler(c)
}

Expand Down Expand Up @@ -620,16 +619,16 @@ func createLifecycleDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails, e
func PlatformToLifecycleUrls(lcDetails *coreConfig.ServerDetails) {
// For tests only. in prod - this "if" will always return false
if strings.Contains(lcDetails.Url, "artifactory/") {
lcDetails.ArtifactoryUrl = utilsForLC.AddTrailingSlashIfNeeded(lcDetails.Url)
lcDetails.ArtifactoryUrl = clientutils.AddTrailingSlashIfNeeded(lcDetails.Url)
lcDetails.LifecycleUrl = strings.Replace(
utilsForLC.AddTrailingSlashIfNeeded(lcDetails.Url),
clientutils.AddTrailingSlashIfNeeded(lcDetails.Url),
"artifactory/",
"lifecycle/",
1,
)
} else {
lcDetails.ArtifactoryUrl = utilsForLC.AddTrailingSlashIfNeeded(lcDetails.Url) + "artifactory/"
lcDetails.LifecycleUrl = utilsForLC.AddTrailingSlashIfNeeded(lcDetails.Url) + "lifecycle/"
lcDetails.ArtifactoryUrl = clientutils.AddTrailingSlashIfNeeded(lcDetails.Url) + "artifactory/"
lcDetails.LifecycleUrl = clientutils.AddTrailingSlashIfNeeded(lcDetails.Url) + "lifecycle/"
}
lcDetails.Url = ""
}
Expand All @@ -638,7 +637,7 @@ func prepareCopyMoveCommand(c *cli.Context) (*spec.SpecFiles, error) {
if c.NArg() > 0 && c.IsSet("spec") {
return nil, cliutils.PrintHelpAndReturnError("No arguments should be sent when the spec option is used.", c)
}
if !(c.NArg() == 2 || (c.NArg() == 0 && (c.IsSet("spec")))) {
if c.NArg() != 2 && (c.NArg() != 0 || !c.IsSet("spec")) {
return nil, cliutils.WrongNumberOfArgumentsHandler(c)
}

Expand All @@ -663,7 +662,7 @@ func prepareDeleteCommand(c *cli.Context) (*spec.SpecFiles, error) {
if c.NArg() > 0 && c.IsSet("spec") {
return nil, cliutils.PrintHelpAndReturnError("No arguments should be sent when the spec option is used.", c)
}
if !(c.NArg() == 1 || (c.NArg() == 0 && (c.IsSet("spec") || c.IsSet("build") || c.IsSet("bundle")))) {
if c.NArg() != 1 && (c.NArg() != 0 || (!c.IsSet("spec") && !c.IsSet("build") && !c.IsSet("bundle"))) {
return nil, cliutils.WrongNumberOfArgumentsHandler(c)
}

Expand All @@ -688,7 +687,7 @@ func prepareSearchCommand(c *cli.Context) (*spec.SpecFiles, error) {
if c.NArg() > 0 && c.IsSet("spec") {
return nil, cliutils.PrintHelpAndReturnError("No arguments should be sent when the spec option is used.", c)
}
if !(c.NArg() == 1 || (c.NArg() == 0 && (c.IsSet("spec") || c.IsSet("build") || c.IsSet("bundle")))) {
if c.NArg() != 1 && (c.NArg() != 0 || (!c.IsSet("spec") && !c.IsSet("build") && !c.IsSet("bundle"))) {
return nil, cliutils.WrongNumberOfArgumentsHandler(c)
}

Expand All @@ -713,7 +712,7 @@ func preparePropsCmd(c *cli.Context) (*generic.PropsCommand, error) {
if c.NArg() > 1 && c.IsSet("spec") {
return nil, cliutils.PrintHelpAndReturnError("Only the 'artifact properties' argument should be sent when the spec option is used.", c)
}
if !(c.NArg() == 2 || (c.NArg() == 1 && (c.IsSet("spec") || c.IsSet("build") || c.IsSet("bundle")))) {
if c.NArg() != 2 && (c.NArg() != 1 || (!c.IsSet("spec") && !c.IsSet("build") && !c.IsSet("bundle"))) {
return nil, cliutils.WrongNumberOfArgumentsHandler(c)
}

Expand Down
7 changes: 6 additions & 1 deletion artifactorybulkrepository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package main

import (
"fmt"
"testing"

"github.com/jfrog/jfrog-cli/utils/tests"
"github.com/stretchr/testify/assert"
"testing"
)

func TestRepositoryCreateAndUpdateIntegration(t *testing.T) {
Expand Down Expand Up @@ -100,6 +101,8 @@ func testMultipleRepositoryUpdate(t *testing.T) {
}

func testCreateWithDifferentRclass(t *testing.T) {
t.Skip("RTECO-525 - Skipping testCreateWithDifferentRclass")

mvnRepoName := "test-mvn-local1"
dockerLocalRepoName := "test-docker-local1"
npmRepoName := "test-npm-local"
Expand Down Expand Up @@ -131,6 +134,8 @@ func testCreateWithDifferentRclass(t *testing.T) {
}

func testUpdateWithDifferentRclass(t *testing.T) {
t.Skip("RTECO-525 - Skipping testUpdateWithDifferentRclass")

mvnRepoName := "test-mvn-local-1"
dockerLocalRepoName := "test-docker-local-1"
npmRepoName := "test-npm-local"
Expand Down
2 changes: 1 addition & 1 deletion build/docker/full/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG repo_name_21
# Remove ${repo_name_21} to pull from Docker Hub.
FROM ${repo_name_21}/jfrog-docker/golang:1.24 as builder
FROM ${repo_name_21}/jfrog-docker/golang:1.25 as builder
ARG image_name=jfrog-cli-full
ARG cli_executable_name
WORKDIR /${image_name}
Expand Down
2 changes: 1 addition & 1 deletion build/docker/slim/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG repo_name_21
# Remove ${repo_name_21} to pull from Docker Hub.
FROM ${repo_name_21}/jfrog-docker/golang:1.24.6-alpine as builder
FROM ${repo_name_21}/jfrog-docker/golang:1.25.4-alpine as builder
ARG image_name=jfrog-cli
ARG cli_executable_name
WORKDIR /${image_name}
Expand Down
4 changes: 2 additions & 2 deletions buildinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ func TestBuildAppend(t *testing.T) {
assert.Equal(t, buildinfo.Build, partials[0].ModuleType)
assert.NotZero(t, partials[0].Timestamp)
assert.NotNil(t, partials[0].Checksum)
assert.NotZero(t, partials[0].Checksum.Md5)
assert.NotZero(t, partials[0].Checksum.Sha1)
assert.NotZero(t, partials[0].Md5)
assert.NotZero(t, partials[0].Sha1)

// Publish build RtBuildName2/buildNumber2
runRt(t, "bp", tests.RtBuildName2, buildNumber2)
Expand Down
2 changes: 1 addition & 1 deletion buildtools/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ func npmGenericCmd(c *cli.Context, cmdName string, collectBuildInfoIfRequested b
if err != nil {
return err
}
npmCmd.SetConfigFilePath(configFilePath).CommonArgs.SetNpmArgs(args)
npmCmd.SetConfigFilePath(configFilePath).SetNpmArgs(args)
if err = npmCmd.Init(); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/jfrog/jfrog-cli

go 1.24.6
Comment thread
ehl-jf marked this conversation as resolved.
Resolved
go 1.25.4

replace (
// Should not be updated to 0.2.6 due to a bug (https://github.com/jfrog/jfrog-cli-core/pull/372)
Expand Down
4 changes: 3 additions & 1 deletion ide_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ func TestVscodeAutoDetection(t *testing.T) {

// Set environment to point to our mock installation
originalPATH := os.Getenv("PATH")
defer os.Setenv("PATH", originalPATH)
defer func() {
_ = os.Setenv("PATH", originalPATH)
}()

// Note: This is a simplified test - real auto-detection would need more complex mocking
// The actual command would attempt auto-detection, but we're testing with an explicit path
Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func prepareHomeDir(t *testing.T) (string, string) {
}

func cleanTestsHomeEnv() {
os.Unsetenv(coreutils.HomeDir)
_ = os.Unsetenv(coreutils.HomeDir)
tests.CleanFileSystem()
}

Expand Down
2 changes: 1 addition & 1 deletion maven_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestMavenBuildWithFlexPackBuildInfo(t *testing.T) {
assert.NotEmpty(t, dep.Type, "Dependency should have type")
assert.NotEmpty(t, dep.Scopes, "Dependency should have scopes")
// FlexPack should provide checksums
hasChecksum := dep.Checksum.Sha1 != "" || dep.Checksum.Sha256 != "" || dep.Checksum.Md5 != ""
hasChecksum := dep.Sha1 != "" || dep.Sha256 != "" || dep.Md5 != ""
assert.True(t, hasChecksum, "Dependency %s should have at least one checksum", dep.Id)
}

Expand Down
8 changes: 6 additions & 2 deletions metrics_visibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ func startMockServer(t *testing.T) (*httptest.Server, chan capturedRequest) {
_, _ = w.Write([]byte("OK"))
})
handler.HandleFunc("/jfconnect/api/v1/backoffice/metrics/log", func(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
defer func() {
_ = r.Body.Close()
}()
body, _ := io.ReadAll(r.Body)
ch <- capturedRequest{Method: r.Method, Path: r.URL.Path, Body: body}
w.WriteHeader(http.StatusCreated)
Expand All @@ -67,7 +69,9 @@ func startVisMockServer(t *testing.T) (*httptest.Server, chan visReq) {
_, _ = w.Write([]byte("OK"))
})
mux.HandleFunc("/jfconnect/api/v1/backoffice/metrics/log", func(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
defer func() {
_ = r.Body.Close()
}()
b, _ := io.ReadAll(r.Body)
ch <- visReq{Method: r.Method, Path: r.URL.Path, Body: b}
w.WriteHeader(http.StatusCreated)
Expand Down
4 changes: 3 additions & 1 deletion npm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ func addNpmScopeRegistryToNpmRc(t *testing.T, projectPath string, packageJsonPat
npmrcFilePath := filepath.Join(projectPath, ".npmrc")
npmrcFile, err := os.OpenFile(npmrcFilePath, os.O_APPEND|os.O_WRONLY, 0644)
assert.NoError(t, err)
defer npmrcFile.Close()
defer func() {
_ = npmrcFile.Close()
}()
_, err = npmrcFile.WriteString(scopedRegistry)
assert.NoError(t, err)
}
Expand Down
6 changes: 3 additions & 3 deletions pip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ func TestPipDepsCacheOutput(t *testing.T) {
pkgName, expectedDep.Id, generatedDep.Id)

// Compare checksums
assert.Equal(t, expectedDep.Checksum.Sha1, generatedDep.Checksum.Sha1,
assert.Equal(t, expectedDep.Sha1, generatedDep.Sha1,
"Package %s SHA1 mismatch", pkgName)
assert.Equal(t, expectedDep.Checksum.Sha256, generatedDep.Checksum.Sha256,
assert.Equal(t, expectedDep.Sha256, generatedDep.Sha256,
"Package %s SHA256 mismatch", pkgName)
assert.Equal(t, expectedDep.Checksum.Md5, generatedDep.Checksum.Md5,
assert.Equal(t, expectedDep.Md5, generatedDep.Md5,
"Package %s MD5 mismatch", pkgName)
}

Expand Down
30 changes: 22 additions & 8 deletions poetry_buildinfo_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ func TestPoetryBuildInfoCLIIntegration(t *testing.T) {

// Setup test environment
tempDir := setupPoetryTestProject(t)
defer os.RemoveAll(tempDir)
defer func() {
_ = os.RemoveAll(tempDir)
}()

// Change to test directory
originalDir, err := os.Getwd()
Expand Down Expand Up @@ -61,7 +63,9 @@ func TestPoetryBuildInfoCLIIntegration(t *testing.T) {
// Set environment for native implementation
err := os.Setenv("JFROG_RUN_NATIVE", "true")
require.NoError(t, err)
defer os.Unsetenv("JFROG_RUN_NATIVE")
defer func() {
_ = os.Unsetenv("JFROG_RUN_NATIVE")
}()

// Test build info collection (simulating jf poetry publish --build-name --build-number)
buildInfo := collectPoetryBuildInfoForTest(t, tc.buildName, tc.buildNumber)
Expand All @@ -85,7 +89,9 @@ func TestPoetryBuildInfoWithoutNativeFlag(t *testing.T) {
}

tempDir := setupPoetryTestProject(t)
defer os.RemoveAll(tempDir)
defer func() {
_ = os.RemoveAll(tempDir)
}()

originalDir, err := os.Getwd()
require.NoError(t, err)
Expand All @@ -99,7 +105,7 @@ func TestPoetryBuildInfoWithoutNativeFlag(t *testing.T) {
require.NoError(t, err)

// Ensure JFROG_RUN_NATIVE is not set
os.Unsetenv("JFROG_RUN_NATIVE")
_ = os.Unsetenv("JFROG_RUN_NATIVE")

// Test that Poetry commands still work (fallback to existing implementation)
// This ensures we don't break existing functionality
Expand All @@ -118,7 +124,9 @@ func TestPoetryTreeParsingRobustness(t *testing.T) {
}

tempDir := setupPoetryTestProject(t)
defer os.RemoveAll(tempDir)
defer func() {
_ = os.RemoveAll(tempDir)
}()

originalDir, err := os.Getwd()
require.NoError(t, err)
Expand All @@ -133,7 +141,9 @@ func TestPoetryTreeParsingRobustness(t *testing.T) {

err = os.Setenv("JFROG_RUN_NATIVE", "true")
require.NoError(t, err)
defer os.Unsetenv("JFROG_RUN_NATIVE")
defer func() {
_ = os.Unsetenv("JFROG_RUN_NATIVE")
}()

buildInfo := collectPoetryBuildInfoForTest(t, "tree-parsing-test", "1")

Expand All @@ -154,7 +164,9 @@ func TestPoetryRequestedByRelationships(t *testing.T) {
}

tempDir := setupPoetryTestProject(t)
defer os.RemoveAll(tempDir)
defer func() {
_ = os.RemoveAll(tempDir)
}()

originalDir, err := os.Getwd()
require.NoError(t, err)
Expand All @@ -169,7 +181,9 @@ func TestPoetryRequestedByRelationships(t *testing.T) {

err = os.Setenv("JFROG_RUN_NATIVE", "true")
require.NoError(t, err)
defer os.Unsetenv("JFROG_RUN_NATIVE")
defer func() {
_ = os.Unsetenv("JFROG_RUN_NATIVE")
}()

buildInfo := collectPoetryBuildInfoForTest(t, "requested-by-test", "1")

Expand Down
12 changes: 6 additions & 6 deletions poetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func testPoetryCmd(t *testing.T, projectPath, buildNumber, module string, expect
for _, dep := range buildInfoModules[0].Dependencies {
if dep.Type == "pypi" {
// Main dependencies should have checksums
assert.NotEmpty(t, dep.Checksum.Sha1, "SHA1 checksum should be present for %s", dep.Id)
assert.NotEmpty(t, dep.Sha1, "SHA1 checksum should be present for %s", dep.Id)
}
}
}
Expand Down Expand Up @@ -224,8 +224,8 @@ func testPoetryPublishCmd(t *testing.T, projectPath, buildNumber, expectedModule

// Validate artifacts have checksums
for _, artifact := range buildInfoModules[0].Artifacts {
assert.NotEmpty(t, artifact.Checksum.Sha1, "SHA1 checksum should be present for artifact %s", artifact.Name)
assert.NotEmpty(t, artifact.Checksum.Sha256, "SHA256 checksum should be present for artifact %s", artifact.Name)
assert.NotEmpty(t, artifact.Sha1, "SHA1 checksum should be present for artifact %s", artifact.Name)
assert.NotEmpty(t, artifact.Sha256, "SHA256 checksum should be present for artifact %s", artifact.Name)
}
}

Expand Down Expand Up @@ -288,7 +288,7 @@ func TestPoetryBuildInfoCollection(t *testing.T) {
// Validate FlexPack-specific features
for _, dep := range module.Dependencies {
if dep.Type == "pypi" {
t.Logf("Dependency: %s (SHA1: %s)", dep.Id, dep.Checksum.Sha1)
t.Logf("Dependency: %s (SHA1: %s)", dep.Id, dep.Sha1)
}
}
}
Expand Down Expand Up @@ -408,9 +408,9 @@ func TestPoetryFlexPackFeatures(t *testing.T) {
if found && len(publishedBuildInfo.BuildInfo.Modules) > 0 {
checksumCount := 0
for _, dep := range publishedBuildInfo.BuildInfo.Modules[0].Dependencies {
if dep.Checksum.Sha1 != "" {
if dep.Sha1 != "" {
checksumCount++
t.Logf("Dependency %s has checksum: %s", dep.Id, dep.Checksum.Sha1)
t.Logf("Dependency %s has checksum: %s", dep.Id, dep.Sha1)
}
}
assert.Greater(t, checksumCount, 0, "At least some dependencies should have checksums")
Expand Down
13 changes: 3 additions & 10 deletions transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,8 @@ func TestTransferConfigMerge(t *testing.T) {

rtVersion, err := getArtifactoryVersion()
assert.NoError(t, err)
projectsSupported := false
if rtVersion.AtLeast("7.0.0") {
// The module type only exist in Artifactory 7
projectsSupported = true
}

projectsSupported := rtVersion.AtLeast("7.0.0")
// The module type only exist in Artifactory 7
if projectsSupported {
// Create project on Source server
deleteProject := createTestProject(t)
Expand Down Expand Up @@ -508,10 +504,7 @@ func updateDockerRepoParams(t *testing.T, targetServicesManager artifactory.Arti
}

func inverseBooleanPointer(boolPtr *bool) *bool {
boolValue := true
if boolPtr != nil && *boolPtr {
boolValue = false
}
boolValue := boolPtr == nil || !*boolPtr
return &boolValue
}

Expand Down
Loading
Loading