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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions buildinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strconv"
"strings"
"testing"
"time"

"github.com/jfrog/jfrog-cli-artifactory/artifactory/formats"
clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests"
Expand Down Expand Up @@ -664,6 +665,37 @@ func TestArtifactoryBuildCollectEnv(t *testing.T) {
cleanArtifactoryTest()
}

func TestArtifactoryBuildPublishRecordsDuration(t *testing.T) {
initArtifactoryTest(t, "")
// Use a unique build number to avoid clashing with other tests that reuse RtBuildName1.
buildNumber := strconv.FormatInt(time.Now().Unix(), 10)
inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails)

// First build command - records the build's start time.
uploadFiles(t, "upload", "--build-name="+tests.RtBuildName1, "--build-number="+buildNumber)
// Collect environment, mirroring the reported scenario (upload -> bce -> bp).
assert.NoError(t, artifactoryCli.WithoutCredentials().Exec("bce", tests.RtBuildName1, buildNumber))
runRt(t, "bp", tests.RtBuildName1, buildNumber)

publishedBuildInfo, found, err := tests.GetBuildInfo(serverDetails, tests.RtBuildName1, buildNumber)
if err != nil {
assert.NoError(t, err)
return
}
if !found {
assert.True(t, found, "build info was expected to be found")
return
}
buildInfo := publishedBuildInfo.BuildInfo

assert.NotEmpty(t, buildInfo.Started, "build info should have a 'started' timestamp")
assert.Greater(t, buildInfo.DurationMillis, int64(0), "build duration should not be published as 0")

// Cleanup
inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails)
cleanArtifactoryTest()
}

func TestBuildAddGit(t *testing.T) {
testBuildAddGit(t, false)
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/buger/jsonparser v1.2.0
github.com/gocarina/gocsv v0.0.0-20260607070740-0735908c6461
github.com/jfrog/archiver/v3 v3.6.3
github.com/jfrog/build-info-go v1.13.1-0.20260615080618-42488b58c305
github.com/jfrog/build-info-go v1.13.1-0.20260709050103-31ba10d22bf8
github.com/jfrog/gofrog v1.7.6
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260707110954-b31a04f5ce6c
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260708065639-7c53c506fbcf
Expand Down Expand Up @@ -242,7 +242,7 @@ require (
sigs.k8s.io/yaml v1.6.0 // indirect
)

// replace github.com/jfrog/jfrog-cli-artifactory => github.com/jfrog/jfrog-cli-artifactory main
// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.13.1-0.20260629061854-cd4824207c01

//replace github.com/gfleury/go-bitbucket-v1 => github.com/gfleury/go-bitbucket-v1 v0.0.0-20230825095122-9bc1711434ab

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ github.com/jellydator/ttlcache/v3 v3.4.0 h1:YS4P125qQS0tNhtL6aeYkheEaB/m8HCqdMMP
github.com/jellydator/ttlcache/v3 v3.4.0/go.mod h1:Hw9EgjymziQD3yGsQdf1FqFdpp7YjFMd4Srg5EJlgD4=
github.com/jfrog/archiver/v3 v3.6.3 h1:hkAmPjBw393tPmQ07JknLNWFNZjXdy2xFEnOW9wwOxI=
github.com/jfrog/archiver/v3 v3.6.3/go.mod h1:5V9l+Fte30Y4qe9dUOAd3yNTf8lmtVNuhKNrvI8PMhg=
github.com/jfrog/build-info-go v1.13.1-0.20260615080618-42488b58c305 h1:q7/hTPm6ibQf45CztScTgPb8cAmKIeQ9im0ClISsq7Y=
github.com/jfrog/build-info-go v1.13.1-0.20260615080618-42488b58c305/go.mod h1:CYRUCvLKfyARjoJXLWAxce1qNUxTEtbRKAARkV42vpE=
github.com/jfrog/build-info-go v1.13.1-0.20260709050103-31ba10d22bf8 h1:/bflW71Q+I+QmTsZ0kn9DBTPihUw8JRyEzuYYADE3Hw=
github.com/jfrog/build-info-go v1.13.1-0.20260709050103-31ba10d22bf8/go.mod h1:CYRUCvLKfyARjoJXLWAxce1qNUxTEtbRKAARkV42vpE=
github.com/jfrog/froggit-go v1.23.0 h1:HGNIP9ZqoXKXHQONazhCENqIrFLfc8J3aX/F0QelQ2s=
github.com/jfrog/froggit-go v1.23.0/go.mod h1:wRDryqyp3oe+eHgME2mpnEQmO8XBECIPagFwj0nHmdI=
github.com/jfrog/go-mockhttp v0.3.1 h1:/wac8v4GMZx62viZmv4wazB5GNKs+GxawuS1u3maJH8=
Expand Down
Loading