Skip to content
Draft
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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
)

replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20250619121353-6ff3439c999d
replace github.com/jfrog/jfrog-client-go => github.com/eranturgeman/jfrog-client-go v0.0.0-20250702124746-524e5e2eec7f

replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250619122826-54ff6f65b128
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/eranturgeman/jfrog-cli-core/v2 v2.0.0-20250702130655-9799dfaf931c

replace github.com/jfrog/jfrog-cli-artifactory => github.com/jfrog/jfrog-cli-artifactory v0.3.3-0.20250619124342-b7fdc5494ce6

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o
github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com/eranturgeman/jfrog-cli-core/v2 v2.0.0-20250702130655-9799dfaf931c h1:IomGo8cqcZw0WBA+sL+1bnFAI6/lXLplnixO4G24XTI=
github.com/eranturgeman/jfrog-cli-core/v2 v2.0.0-20250702130655-9799dfaf931c/go.mod h1:Os+FBzbs7k1NCI6K5ewzIwD+nluk1WQvAnIbWrPlwmo=
github.com/eranturgeman/jfrog-client-go v0.0.0-20250702124746-524e5e2eec7f h1:iDmYR8j+b8xmcLGYXjmD3O6EZGJhhMLtCzVywa+bIWM=
github.com/eranturgeman/jfrog-client-go v0.0.0-20250702124746-524e5e2eec7f/go.mod h1:1v0eih4thdPA4clBo9TuvAMT25sGDr1IQJ81DXQ/lBY=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/forPelevin/gomoji v1.3.0 h1:WPIOLWB1bvRYlKZnSSEevLt3IfKlLs+tK+YA9fFYlkE=
Expand Down Expand Up @@ -126,10 +130,6 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
github.com/jfrog/jfrog-cli-artifactory v0.3.3-0.20250619124342-b7fdc5494ce6 h1:0hTNoMFqzN8rhxWLZ5EIvxM1KRg1wynVA1tGu0BJbtI=
github.com/jfrog/jfrog-cli-artifactory v0.3.3-0.20250619124342-b7fdc5494ce6/go.mod h1:WRA+JW1jaESrUaGhHgTl3tFKx0EVHe1qNuN86QC6ma0=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250619122826-54ff6f65b128 h1:SdNS8Z1H1c1wgtHxZJNjLf9cWx+zdfXDQPmjUwQ55Bo=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250619122826-54ff6f65b128/go.mod h1:JDMYJHxU3W0/jaiiSljHLAcd0QeEGwpAwsnOqVR8c/0=
github.com/jfrog/jfrog-client-go v1.28.1-0.20250619121353-6ff3439c999d h1:0TNgRnYr92lmxC4my2P07MqaWmYBuLP/sgoCD5k/fhA=
github.com/jfrog/jfrog-client-go v1.28.1-0.20250619121353-6ff3439c999d/go.mod h1:1v0eih4thdPA4clBo9TuvAMT25sGDr1IQJ81DXQ/lBY=
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
Expand Down
30 changes: 30 additions & 0 deletions utils/apptrust/apptrustmanager.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package apptrust

import (
"github.com/jfrog/jfrog-cli-core/v2/utils/config"
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
"github.com/jfrog/jfrog-client-go/apptrust"
clientconfig "github.com/jfrog/jfrog-client-go/config"
)

func CreateApptrustServiceManager(serviceDetails *config.ServerDetails) (*apptrust.ApptrustServicesManager, error) {
certsPath, err := coreutils.GetJfrogCertsDir()
if err != nil {
return nil, err
}

apptrustDetails, err := serviceDetails.CreateApptrustAuthConfig()
if err != nil {
return nil, err
}

serviceConfig, err := clientconfig.NewConfigBuilder().
SetServiceDetails(apptrustDetails).
SetCertificatesPath(certsPath).
SetInsecureTls(serviceDetails.InsecureTls).
Build()
if err != nil {
return nil, err
}
return apptrust.New(serviceConfig)
}
38 changes: 38 additions & 0 deletions utils/apptrust/evaluate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package apptrust

import (
"fmt"
"github.com/jfrog/jfrog-cli-core/v2/utils/config"
"github.com/jfrog/jfrog-client-go/apptrust/services"
)

const (
evaluationPrAction = "application:pr"
evaluationDevelopmentStage = "development"
evaluationPrResourceType = "pr"
)

func GetEvaluation(serverDetails *config.ServerDetails, applicationKey, msi, gitRepoUrl string) (*services.EvaluateResponse, error) {
apptrustService, err := CreateApptrustServiceManager(serverDetails)
if err != nil {
return nil, err
}

// TODO eran: the parameters here got changed, revisit implementation
requestParams := services.EvaluateRequest{
Action: evaluationPrAction, // TODO eran: are there other options here?
Context: services.EvaluateContext{Stage: evaluationDevelopmentStage}, // TODO eran: are there other options here?
Resource: services.EvaluateResource{
ApplicationKey: applicationKey,
Type: evaluationPrResourceType, // TODO eran: are there other options here?
MultiScanId: msi,
GitRepoUrl: gitRepoUrl,
},
}

evaluation, err := apptrustService.Evaluate(requestParams)
if err != nil {
return nil, fmt.Errorf("failed to get evaluation for '%s' application with msi '%s' and git repo '%s': %w", applicationKey, msi, err)

Check failure on line 35 in utils/apptrust/evaluate.go

View workflow job for this annotation

GitHub Actions / Static-Check

fmt.Errorf format %w reads arg #4, but call has 3 args

Check failure on line 35 in utils/apptrust/evaluate.go

View workflow job for this annotation

GitHub Actions / Lint macos

fmt.Errorf format %w reads arg #4, but call has 3 args

Check failure on line 35 in utils/apptrust/evaluate.go

View workflow job for this annotation

GitHub Actions / Lint windows

fmt.Errorf format %w reads arg #4, but call has 3 args

Check failure on line 35 in utils/apptrust/evaluate.go

View workflow job for this annotation

GitHub Actions / Lint ubuntu

fmt.Errorf format %w reads arg #4, but call has 3 args
}
return &evaluation, nil
}
10 changes: 10 additions & 0 deletions utils/apptrust/evaluate_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package apptrust

import (
"testing"
)

// TODO eran: complete after figuring out the final input and output of the evaluation
func TestGetEvaluation(t *testing.T) {

}
Loading