Skip to content

Commit 4673286

Browse files
committed
Merge branch 'dev'
2 parents 61ef940 + b5132dc commit 4673286

File tree

7 files changed

+35
-34
lines changed

7 files changed

+35
-34
lines changed

go.mod

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/jfrog/jfrog-client-go
22

3-
go 1.24.4
3+
go 1.24.6
44

55
require (
66
github.com/CycloneDX/cyclonedx-go v0.9.2
@@ -11,7 +11,7 @@ require (
1111
github.com/golang-jwt/jwt/v4 v4.5.2
1212
github.com/gookit/color v1.5.4
1313
github.com/jfrog/archiver/v3 v3.6.1
14-
github.com/jfrog/build-info-go v1.10.15
14+
github.com/jfrog/build-info-go v1.10.16
1515
github.com/jfrog/gofrog v1.7.6
1616
github.com/minio/sha256-simd v1.0.1
1717
github.com/stretchr/testify v1.10.0
@@ -23,9 +23,11 @@ require (
2323

2424
require (
2525
dario.cat/mergo v1.0.1 // indirect
26+
github.com/BurntSushi/toml v1.4.0 // indirect
2627
github.com/Microsoft/go-winio v0.6.2 // indirect
2728
github.com/andybalholm/brotli v1.1.1 // indirect
2829
github.com/cloudflare/circl v1.6.1 // indirect
30+
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
2931
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
3032
github.com/davecgh/go-spew v1.1.1 // indirect
3133
github.com/dsnet/compress v0.0.1 // indirect
@@ -44,11 +46,14 @@ require (
4446
github.com/pjbgf/sha1cd v0.3.2 // indirect
4547
github.com/pmezard/go-difflib v1.0.0 // indirect
4648
github.com/rivo/uniseg v0.4.7 // indirect
49+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
4750
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
4851
github.com/skeema/knownhosts v1.3.1 // indirect
4952
github.com/ulikunitz/xz v0.5.12 // indirect
53+
github.com/urfave/cli/v2 v2.27.4 // indirect
5054
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
5155
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
56+
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
5257
golang.org/x/net v0.38.0 // indirect
5358
golang.org/x/sync v0.12.0 // indirect
5459
golang.org/x/sys v0.31.0 // indirect

go.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
22
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
3+
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
4+
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
35
github.com/CycloneDX/cyclonedx-go v0.9.2 h1:688QHn2X/5nRezKe2ueIVCt+NRqf7fl3AVQk+vaFcIo=
46
github.com/CycloneDX/cyclonedx-go v0.9.2/go.mod h1:vcK6pKgO1WanCdd61qx4bFnSsDJQ6SbM2ZuMIgq86Jg=
57
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
@@ -19,6 +21,8 @@ github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMU
1921
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
2022
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
2123
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
24+
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
25+
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
2226
github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s=
2327
github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
2428
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -59,6 +63,8 @@ github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5
5963
github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw=
6064
github.com/jfrog/build-info-go v1.10.15 h1:y6E87iIBTofNy4mus6Ngv6AtVwg/bN/Rz+oaI3kpN4M=
6165
github.com/jfrog/build-info-go v1.10.15/go.mod h1:+8u1CEGrr8XY5a5U6farFW3EKYk0ge0BMGZE3BAZBcE=
66+
github.com/jfrog/build-info-go v1.10.16 h1:M77OfTXl3Ew9AG9SIIYLAG5ccIIaf6xjIZ5nomc2XAw=
67+
github.com/jfrog/build-info-go v1.10.16/go.mod h1:szdz9+WzB7+7PGnILLUgyY+OF5qD5geBT7UGNIxibyw=
6268
github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s=
6369
github.com/jfrog/gofrog v1.7.6/go.mod h1:ntr1txqNOZtHplmaNd7rS4f8jpA5Apx8em70oYEe7+4=
6470
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
@@ -96,6 +102,8 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
96102
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
97103
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
98104
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
105+
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
106+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
99107
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
100108
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
101109
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
@@ -111,6 +119,8 @@ github.com/terminalstatic/go-xsd-validate v0.1.6/go.mod h1:18lsvYFofBflqCrvo1ump
111119
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
112120
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
113121
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
122+
github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8=
123+
github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ=
114124
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
115125
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
116126
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
@@ -123,6 +133,8 @@ github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofm
123133
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
124134
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
125135
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
136+
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
137+
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
126138
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
127139
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
128140
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=

lifecycle/lifecycle_test.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -219,23 +219,7 @@ func TestRemoteDeleteReleaseBundle(t *testing.T) {
219219
mockServer, rbService := createMockServer(t, handlerFunc)
220220
defer mockServer.Close()
221221

222-
assert.NoError(t, rbService.RemoteDeleteReleaseBundle(testRb, lifecycle.ReleaseBundleRemoteDeleteParams{MaxWaitMinutes: 2}, false))
223-
}
224-
225-
func TestRemoteDeleteReleaseBundleNewApi(t *testing.T) {
226-
lifecycle.SyncSleepInterval = 1 * time.Second
227-
defer func() { lifecycle.SyncSleepInterval = lifecycle.DefaultSyncSleepInterval }()
228-
229-
handlerFunc := func(w http.ResponseWriter, r *http.Request) {
230-
if r.RequestURI == "/"+lifecycle.GetRemoteDeleteReleaseBundleApi(testRb, true) {
231-
w.WriteHeader(http.StatusOK)
232-
}
233-
}
234-
235-
mockServer, rbService := createMockServer(t, handlerFunc)
236-
defer mockServer.Close()
237-
238-
assert.NoError(t, rbService.RemoteDeleteReleaseBundle(testRb, lifecycle.ReleaseBundleRemoteDeleteParams{MaxWaitMinutes: 2}, true))
222+
assert.NoError(t, rbService.RemoteDeleteReleaseBundle(testRb, lifecycle.ReleaseBundleRemoteDeleteParams{MaxWaitMinutes: 2}))
239223
}
240224

241225
func TestGetReleaseBundleVersionPromotions(t *testing.T) {

lifecycle/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ func (lcs *LifecycleServicesManager) DistributeReleaseBundle(rbDetails lifecycle
137137
return distributeBundleService.Distribute()
138138
}
139139

140-
func (lcs *LifecycleServicesManager) RemoteDeleteReleaseBundle(rbDetails lifecycle.ReleaseBundleDetails, params lifecycle.ReleaseBundleRemoteDeleteParams, isNewReleaseBundleApiSupported bool) error {
140+
func (lcs *LifecycleServicesManager) RemoteDeleteReleaseBundle(rbDetails lifecycle.ReleaseBundleDetails, params lifecycle.ReleaseBundleRemoteDeleteParams) error {
141141
rbService := lifecycle.NewReleaseBundlesService(lcs.config.GetServiceDetails(), lcs.client)
142-
return rbService.RemoteDeleteReleaseBundle(rbDetails, params, isNewReleaseBundleApiSupported)
142+
return rbService.RemoteDeleteReleaseBundle(rbDetails, params)
143143
}
144144

145145
func (lcs *LifecycleServicesManager) ExportReleaseBundle(rbDetails lifecycle.ReleaseBundleDetails, modifications lifecycle.Modifications, queryParams lifecycle.CommonOptionalQueryParams) (exportResponse lifecycle.ReleaseBundleExportedStatusResponse, err error) {

lifecycle/services/delete.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ func (rbs *ReleaseBundlesService) deleteReleaseBundle(params CommonOptionalQuery
4646
return errorutils.CheckResponseStatusWithBody(resp, body, http.StatusNoContent)
4747
}
4848

49-
50-
func (rbs *ReleaseBundlesService) RemoteDeleteReleaseBundle(rbDetails ReleaseBundleDetails, params ReleaseBundleRemoteDeleteParams, isNewReleaseBundleApiSupported bool) error {
49+
func (rbs *ReleaseBundlesService) RemoteDeleteReleaseBundle(rbDetails ReleaseBundleDetails, params ReleaseBundleRemoteDeleteParams) error {
5150
dryRunStr := ""
5251
if params.DryRun {
5352
dryRunStr = "[Dry run] "
@@ -59,23 +58,23 @@ func (rbs *ReleaseBundlesService) RemoteDeleteReleaseBundle(rbDetails ReleaseBun
5958
if err != nil {
6059
return errorutils.CheckError(err)
6160
}
61+
hasDistributionRules := len(params.DistributionRules) > 0 && params.DistributionRules[0].GetSiteName() != "*"
6262

63-
64-
restApi := GetRemoteDeleteReleaseBundleApi(rbDetails, isNewReleaseBundleApiSupported)
63+
restApi := GetRemoteDeleteReleaseBundleApi(rbDetails, hasDistributionRules)
6564
requestFullUrl, err := utils.BuildUrl(rbs.GetLifecycleDetails().GetUrl(), restApi, nil)
6665
if err != nil {
6766
return err
6867
}
6968

7069
httpClientDetails := rbs.GetLifecycleDetails().CreateHttpClientDetails()
7170
httpClientDetails.SetContentTypeApplicationJson()
72-
if isNewReleaseBundleApiSupported {
71+
if !hasDistributionRules {
7372
resp, body, err := rbs.client.SendDelete(requestFullUrl, content, &httpClientDetails)
7473
if err != nil {
7574
return err
7675
}
7776
log.Debug("Artifactory response:", resp.Status)
78-
return errorutils.CheckResponseStatusWithBody(resp, body, http.StatusOK)
77+
return errorutils.CheckResponseStatusWithBody(resp, body, http.StatusAccepted)
7978
}
8079

8180
resp, body, err := rbs.client.SendPost(requestFullUrl, content, &httpClientDetails)
@@ -85,19 +84,19 @@ func (rbs *ReleaseBundlesService) RemoteDeleteReleaseBundle(rbDetails ReleaseBun
8584

8685
log.Debug("Artifactory response:", resp.Status)
8786

88-
err = errorutils.CheckResponseStatusWithBody(resp, body, http.StatusAccepted)
87+
err = errorutils.CheckResponseStatusWithBody(resp, body, http.StatusOK)
8988
if err != nil || params.Async || params.DryRun {
9089
return err
9190
}
9291

9392
return rbs.waitForRemoteDeletion(rbDetails, params)
9493
}
9594

96-
func GetRemoteDeleteReleaseBundleApi(rbDetails ReleaseBundleDetails, isNewReleaseBundleApiSupported bool) string {
97-
if isNewReleaseBundleApiSupported {
98-
return path.Join(releaseBundleNewApi, records, rbDetails.ReleaseBundleName, rbDetails.ReleaseBundleVersion)
95+
func GetRemoteDeleteReleaseBundleApi(rbDetails ReleaseBundleDetails, hasDistributionRules bool) string {
96+
if hasDistributionRules {
97+
return path.Join(distributionBaseApi, remoteDeleteEndpoint, rbDetails.ReleaseBundleName, rbDetails.ReleaseBundleVersion)
9998
}
100-
return path.Join(distributionBaseApi, remoteDeleteEndpoint, rbDetails.ReleaseBundleName, rbDetails.ReleaseBundleVersion)
99+
return path.Join(releaseBundleNewApi, records, rbDetails.ReleaseBundleName, rbDetails.ReleaseBundleVersion)
101100
}
102101

103102
func (rbs *ReleaseBundlesService) waitForRemoteDeletion(rbDetails ReleaseBundleDetails, params ReleaseBundleRemoteDeleteParams) error {
@@ -115,7 +114,7 @@ func (rbs *ReleaseBundlesService) waitForRemoteDeletion(rbDetails ReleaseBundleD
115114
switch deletionStatus {
116115
case InProgress:
117116
return false, nil, nil
118-
case Completed:
117+
case Completed, Created:
119118
return true, nil, nil
120119
case Failed:
121120
return true, nil, errorutils.CheckErrorf("remote deletion failed!")

lifecycle/services/status.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const (
3535
Rejected RbStatus = "REJECTED"
3636
Deleting RbStatus = "DELETING"
3737
Started RbStatus = "STARTED"
38+
Created RbStatus = "CREATED"
3839
)
3940

4041
func (rbs *ReleaseBundlesService) GetReleaseBundleCreationStatus(rbDetails ReleaseBundleDetails, projectKey string, sync bool) (ReleaseBundleStatusResponse, error) {

utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
const (
2929
Development = "development"
3030
Agent = "jfrog-client-go"
31-
Version = "1.54.4"
31+
Version = "1.54.6"
3232
)
3333

3434
const xrayDevVersion = "3.x-dev"

0 commit comments

Comments
 (0)