Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli-core into updep
Browse files Browse the repository at this point in the history
# Conflicts:
#	go.mod
#	go.sum
  • Loading branch information
sverdlov93 committed Jun 2, 2024
2 parents cafbafb + abaa6ae commit 150e5d9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
22 changes: 22 additions & 0 deletions artifactory/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
ioutils "github.com/jfrog/gofrog/io"
"github.com/jfrog/jfrog-client-go/evidence"
"io"
"net/http"
"net/url"
Expand Down Expand Up @@ -214,6 +215,27 @@ func CreateLifecycleServiceManager(serviceDetails *config.ServerDetails, isDryRu
return lifecycle.New(serviceConfig)
}

func CreateEvidenceServiceManager(serviceDetails *config.ServerDetails, isDryRun bool) (*evidence.EvidenceServicesManager, error) {
certsPath, err := coreutils.GetJfrogCertsDir()
if err != nil {
return nil, err
}
evdAuth, err := serviceDetails.CreateEvidenceAuthConfig()
if err != nil {
return nil, err
}
serviceConfig, err := clientConfig.NewConfigBuilder().
SetServiceDetails(evdAuth).
SetCertificatesPath(certsPath).
SetInsecureTls(serviceDetails.InsecureTls).
SetDryRun(isDryRun).
Build()
if err != nil {
return nil, err
}
return evidence.New(serviceConfig)
}

// This error indicates that the build was scanned by Xray, but Xray found issues with the build.
// If Xray failed to scan the build, for example due to a networking issue, a regular error should be returned.
var errBuildScan = errors.New("issues found during xray build scan")
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
)

replace github.com/jfrog/jfrog-client-go => ../jfrog-client-go

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240509093347-62649bc00e43
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240530101935-539b5837ce04

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go dev

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ github.com/jfrog/build-info-go v1.9.27 h1:7RWJcajqtNNbGHuYkgOLUIG7mmRKF0yxC7mvYA
github.com/jfrog/build-info-go v1.9.27/go.mod h1:8T7/ajM9aGshvgpwCtXwIFpyF/R6CEn4W+/FLryNXWw=
github.com/jfrog/gofrog v1.7.2 h1:VkAaA/9tmbw27IqgUOmaZWnO6ATUqL3vRzDnsROKATw=
github.com/jfrog/gofrog v1.7.2/go.mod h1:WJFk88SR9Sr9mKl1bQBig7DmSdXiBGKV3WhL9O6jL9w=
github.com/jfrog/jfrog-client-go v1.28.1-0.20240530101935-539b5837ce04 h1:ERLE/L7YPr6aCUTeAnE8SXU5VOZHd5/XK16rM1TEpts=
github.com/jfrog/jfrog-client-go v1.28.1-0.20240530101935-539b5837ce04/go.mod h1:37RR4pYgXZM4w7tywyfRu8t2wagt0qf5wBtpDILWBsk=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
Expand Down
12 changes: 12 additions & 0 deletions utils/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
artifactoryAuth "github.com/jfrog/jfrog-client-go/artifactory/auth"
"github.com/jfrog/jfrog-client-go/auth"
distributionAuth "github.com/jfrog/jfrog-client-go/distribution/auth"
evidenceAuth "github.com/jfrog/jfrog-client-go/evidence/auth"
lifecycleAuth "github.com/jfrog/jfrog-client-go/lifecycle/auth"
pipelinesAuth "github.com/jfrog/jfrog-client-go/pipelines/auth"
"github.com/jfrog/jfrog-client-go/utils"
Expand Down Expand Up @@ -578,6 +579,7 @@ type ServerDetails struct {
PipelinesUrl string `json:"pipelinesUrl,omitempty"`
AccessUrl string `json:"accessUrl,omitempty"`
LifecycleUrl string `json:"-"`
EvidenceUrl string `json:"-"`
User string `json:"user,omitempty"`
Password string `json:"password,omitempty"`
SshKeyPath string `json:"sshKeyPath,omitempty"`
Expand Down Expand Up @@ -668,6 +670,10 @@ func (serverDetails *ServerDetails) GetLifecycleUrl() string {
return serverDetails.LifecycleUrl
}

func (serverDetails *ServerDetails) GetEvidenceUrl() string {
return serverDetails.EvidenceUrl
}

func (serverDetails *ServerDetails) GetUser() string {
return serverDetails.User
}
Expand Down Expand Up @@ -741,6 +747,12 @@ func (serverDetails *ServerDetails) CreateLifecycleAuthConfig() (auth.ServiceDet
return serverDetails.createAuthConfig(lcAuth)
}

func (serverDetails *ServerDetails) CreateEvidenceAuthConfig() (auth.ServiceDetails, error) {
evdAuth := evidenceAuth.NewEvidenceDetails()
evdAuth.SetUrl(serverDetails.EvidenceUrl)
return serverDetails.createAuthConfig(evdAuth)
}

func (serverDetails *ServerDetails) createAuthConfig(details auth.ServiceDetails) (auth.ServiceDetails, error) {
details.SetSshUrl(serverDetails.SshUrl)
details.SetAccessToken(serverDetails.AccessToken)
Expand Down

0 comments on commit 150e5d9

Please sign in to comment.