Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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: 3 additions & 1 deletion common/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ func exchangeOidcTokenAndSetAccessToken(cc *ConfigCommand) error {
SetAudience(cc.oidcSetupParams.Audience).
SetApplicationKey(cc.oidcSetupParams.ApplicationKey).
SetProjectKey(cc.oidcSetupParams.ProjectKey).
SetRepository(cc.oidcSetupParams.Repository).
SetVcsRevision(os.Getenv(coreutils.CIVcsRevision)).
SetVcsUrl(os.Getenv(coreutils.CIVcsUrl)).
SetVcsBranch(os.Getenv(coreutils.CIVcsBranch)).
SetJobId(cc.oidcSetupParams.JobId).
SetRunId(cc.oidcSetupParams.RunId).
SetVcsRevision(cc.oidcSetupParams.VcsRevision).
Expand Down
32 changes: 10 additions & 22 deletions general/token/oidctokenexchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ type OidcParams struct {
ApplicationKey string
JobId string
RunId string
Repository string
VcsRevision string
VcsUrl string
VcsBranch string
VcsRevision string
}

type ExchangeCommandOutputStruct struct {
Expand Down Expand Up @@ -132,23 +131,18 @@ func (otc *OidcTokenExchangeCommand) SetJobId(jobId string) *OidcTokenExchangeCo
return otc
}

func (otc *OidcTokenExchangeCommand) SetRepository(repo string) *OidcTokenExchangeCommand {
otc.Repository = repo
func (otc *OidcTokenExchangeCommand) SetVcsRevision(revision string) *OidcTokenExchangeCommand {
otc.VcsRevision = revision
return otc
}

func (otc *OidcTokenExchangeCommand) SetVcsUrl(vcsUrl string) *OidcTokenExchangeCommand {
otc.VcsUrl = vcsUrl
func (otc *OidcTokenExchangeCommand) SetVcsUrl(url string) *OidcTokenExchangeCommand {
otc.VcsUrl = url
return otc
}

func (otc *OidcTokenExchangeCommand) SetVcsBranch(vcsBranch string) *OidcTokenExchangeCommand {
otc.VcsBranch = vcsBranch
return otc
}

func (otc *OidcTokenExchangeCommand) SetVcsRevision(vcsRevision string) *OidcTokenExchangeCommand {
otc.VcsRevision = vcsRevision
func (otc *OidcTokenExchangeCommand) SetVcsBranch(branch string) *OidcTokenExchangeCommand {
otc.VcsBranch = branch
return otc
}

Expand Down Expand Up @@ -207,17 +201,11 @@ func (otc *OidcTokenExchangeCommand) getOidcTokenParams() services.CreateOidcTok
oidcTokenParams.ApplicationKey = otc.ApplicationKey
oidcTokenParams.RunId = otc.RunId
oidcTokenParams.JobId = otc.JobId
oidcTokenParams.Repo = otc.Repository
oidcTokenParams.Repo = otc.VcsUrl
oidcTokenParams.Revision = otc.VcsRevision
oidcTokenParams.Branch = otc.VcsBranch
oidcTokenParams.Audience = otc.Audience
oidcTokenParams.ProviderName = otc.ProviderName
oidcTokenParams.ProviderType = otc.ProviderType.String()
oidcTokenParams.Context = &services.Context{
VcsCommit: &services.VcsCommit{
VcsUrl: otc.VcsUrl,
Branch: otc.VcsBranch,
Revision: otc.VcsRevision,
},
}

return oidcTokenParams
}
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/BurntSushi/toml v1.5.0 // indirect
github.com/CycloneDX/cyclonedx-go v0.9.2 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.1.6 // indirect
github.com/ProtonMail/go-crypto v1.3.0 // indirect
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
github.com/andybalholm/brotli v1.2.0 // indirect
Expand Down Expand Up @@ -97,7 +97,7 @@ require (
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/sys v0.36.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand All @@ -114,7 +114,7 @@ require (
sigs.k8s.io/yaml v1.6.0 // indirect
)

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go master
replace github.com/jfrog/jfrog-client-go => github.com/EyalDelarea/jfrog-client-go v1.28.4-0.20250925094306-93712e06f44d

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

Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/CycloneDX/cyclonedx-go v0.9.2 h1:688QHn2X/5nRezKe2ueIVCt+NRqf7fl3AVQk+vaFcIo=
github.com/CycloneDX/cyclonedx-go v0.9.2/go.mod h1:vcK6pKgO1WanCdd61qx4bFnSsDJQ6SbM2ZuMIgq86Jg=
github.com/EyalDelarea/jfrog-client-go v1.28.4-0.20250925094306-93712e06f44d h1:/RAdtJZheYwjvMjXqsWWaaIj1sSne+THhqI4F+iDsSM=
github.com/EyalDelarea/jfrog-client-go v1.28.4-0.20250925094306-93712e06f44d/go.mod h1:UYhn61e3VNb7Oo4dWpzI9TaObxTbdFosagEfcPlkvmg=
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw=
github.com/ProtonMail/go-crypto v1.1.6/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw=
github.com/ProtonMail/go-crypto v1.3.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE=
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
Expand Down Expand Up @@ -112,8 +114,6 @@ github.com/jfrog/build-info-go v1.11.0 h1:qEONCgaHKlW3e2y0zIwTZVbgS/ERZrPlBWEbOY
github.com/jfrog/build-info-go v1.11.0/go.mod h1:szdz9+WzB7+7PGnILLUgyY+OF5qD5geBT7UGNIxibyw=
github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s=
github.com/jfrog/gofrog v1.7.6/go.mod h1:ntr1txqNOZtHplmaNd7rS4f8jpA5Apx8em70oYEe7+4=
github.com/jfrog/jfrog-client-go v1.55.1-0.20250922120823-e64346ea079b h1:e26MG4YmrtwUdfmpKPXqrB1i894y6BbS1f4RRHuhprk=
github.com/jfrog/jfrog-client-go v1.55.1-0.20250922120823-e64346ea079b/go.mod h1:tJlcnGoJAqiScMRT2qOUPUzpVUrhpxkGiLg/BWZ7PtE=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
Expand Down Expand Up @@ -266,8 +266,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/exp v0.0.0-20250911091902-df9299821621 h1:2id6c1/gto0kaHYyrixvknJ8tUK/Qs5IsmBtrc+FtgU=
golang.org/x/exp v0.0.0-20250911091902-df9299821621/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand Down
29 changes: 14 additions & 15 deletions utils/coreutils/coreconsts.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,21 @@ const (

// Although these vars are constant, they are defined inside a vars section and not a constants section because the tests modify these values.
var (
HomeDir = "JFROG_CLI_HOME_DIR"
BuildName = "JFROG_CLI_BUILD_NAME"
BuildNumber = "JFROG_CLI_BUILD_NUMBER"
BuildUrl = "JFROG_CLI_BUILD_URL"
EnvExclude = "JFROG_CLI_ENV_EXCLUDE"
Project = "JFROG_CLI_BUILD_PROJECT"
ApplicationKey = "JFROG_CLI_APPLICATION_KEY"
SourceCodeRepository = "JFROG_CLI_SOURCECODE_REPOSITORY"
SigningKey = "JFROG_CLI_SIGNING_KEY"
KeyAlias = "JFROG_CLI_KEY_ALIAS"
HomeDir = "JFROG_CLI_HOME_DIR"
BuildName = "JFROG_CLI_BUILD_NAME"
BuildNumber = "JFROG_CLI_BUILD_NUMBER"
BuildUrl = "JFROG_CLI_BUILD_URL"
EnvExclude = "JFROG_CLI_ENV_EXCLUDE"
Project = "JFROG_CLI_BUILD_PROJECT"
ApplicationKey = "JFROG_CLI_APPLICATION_KEY"
CIVcsRevision = "JFROG_CLI_CI_VCS_REVISION"
CIVcsBranch = "JFROG_CLI_CI_BRANCH"
CIVcsUrl = "JFROG_CLI_CI_VCS_URL"
SigningKey = "JFROG_CLI_SIGNING_KEY"
KeyAlias = "JFROG_CLI_KEY_ALIAS"
//#nosec G101
EncryptionKey = "JFROG_CLI_ENCRYPTION_KEY"
// For CI runs
CIJobID = "JFROG_CLI_CI_JOB_ID"
CIRunID = "JFROG_CLI_CI_RUN_ID"
CIVcsUrl = "JFROG_CLI_CI_VCS_URL"
CIVcsRevision = "JFROG_CLI_CI_VCS_REVISION"
CIVcsBranch = "JFROG_CLI_CI_BRANCH"
CIJobID = "JFROG_CLI_CI_JOB_ID"
CIRunID = "JFROG_CLI_CI_RUN_ID"
)
2 changes: 1 addition & 1 deletion utils/usage/visibility/commands_count_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewCommandsCountMetric(commandName string) services.VisibilityMetric {
ProviderType: os.Getenv(coreutils.OidcProviderType),
JobID: os.Getenv(coreutils.CIJobID),
RunID: os.Getenv(coreutils.CIRunID),
GitRepo: os.Getenv(coreutils.SourceCodeRepository),
GitRepo: os.Getenv(coreutils.CIVcsUrl),
GhTokenForCodeScanningAlertsProvided: os.Getenv("JFROG_CLI_USAGE_GH_TOKEN_FOR_CODE_SCANNING_ALERTS_PROVIDED"),
Flags: "",
Platform: "",
Expand Down
14 changes: 7 additions & 7 deletions utils/usage/visibility/commands_count_metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
func TestCreateCommandsCountMetric(t *testing.T) {
// Set environment variables for the test using SetEnvWithCallbackAndAssert
envVars := map[string]string{
coreutils.CIJobID: "job123",
coreutils.CIRunID: "run456",
coreutils.SourceCodeRepository: "test-repo",
coreutils.OidcProviderType: token.GitHub.String(),
coreutils.CIJobID: "job123",
coreutils.CIRunID: "run456",
coreutils.CIVcsUrl: "test-repo",
coreutils.OidcProviderType: token.GitHub.String(),
"JFROG_CLI_USAGE_GH_TOKEN_FOR_CODE_SCANNING_ALERTS_PROVIDED": "TRUE",
}
cleanupFuncs := []func(){}
Expand Down Expand Up @@ -169,9 +169,9 @@ func TestCommandsCountLabelsJSONSerialization(t *testing.T) {
func TestEnhancedMetricsEnvironmentIntegration(t *testing.T) {
// Set environment variables for the test (using the keys consumed by the code)
envVars := map[string]string{
coreutils.CIJobID: "test-job-123",
coreutils.CIRunID: "test-run-456",
coreutils.SourceCodeRepository: "owner/repo",
coreutils.CIJobID: "test-job-123",
coreutils.CIRunID: "test-run-456",
coreutils.CIVcsUrl: "owner/repo",
}
cleanupFuncs := []func(){}
for key, value := range envVars {
Expand Down
Loading