Skip to content

Commit

Permalink
Updated the names and locations of the environment variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
oshratZairi committed Dec 11, 2024
1 parent 27e154a commit eec755a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions evidence/cli/command_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,16 @@ func ensureKeyExists(ctx *components.Context, key string) error {
return nil
}

signingKeyValue, _ := getEnvVariable(evdSigningKey)
signingKeyValue, _ := getEnvVariable(coreUtils.SigningKey)
if signingKeyValue == "" {
return errorutils.CheckErrorf("'key' or EVD_SIGNING_KEY must be provided when creating evidence: --%s", key)
return errorutils.CheckErrorf("JFROG_CLI_SIGNING_KEY env variable or --%s flag must be provided when creating evidence", key)
}
ctx.AddStringFlag(key, signingKeyValue)
return nil
}

func setKeyAliasIfProvided(ctx *components.Context, keyAlias string) {
evdKeyAliasValue, _ := getEnvVariable(evdKeyAlias)
evdKeyAliasValue, _ := getEnvVariable(coreUtils.KeyAlias)
if evdKeyAliasValue != "" {
ctx.AddStringFlag(keyAlias, evdKeyAliasValue)
}
Expand Down
9 changes: 5 additions & 4 deletions evidence/cli/command_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"github.com/jfrog/jfrog-cli-core/v2/common/commands"
"github.com/jfrog/jfrog-cli-core/v2/plugins/components"
coreUtils "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
"go.uber.org/mock/gomock"
Expand All @@ -15,10 +16,10 @@ func TestCreateEvidence_Context(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()

assert.NoError(t, os.Setenv(evdSigningKey, "PGP"), "Failed to set env: "+evdSigningKey)
assert.NoError(t, os.Setenv("JFROG_CLI_BUILD_NAME", buildName), "Failed to set env: JFROG_CLI_BUILD_NAME")
defer os.Unsetenv(evdSigningKey)
defer os.Unsetenv("JFROG_CLI_BUILD_NAME")
assert.NoError(t, os.Setenv(coreUtils.SigningKey, "PGP"), "Failed to set env: "+coreUtils.SigningKey)
assert.NoError(t, os.Setenv(coreUtils.BuildName, buildName), "Failed to set env: JFROG_CLI_BUILD_NAME")
defer os.Unsetenv(coreUtils.SigningKey)
defer os.Unsetenv(coreUtils.BuildName)

app := cli.NewApp()
app.Commands = []cli.Command{
Expand Down
6 changes: 0 additions & 6 deletions evidence/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ const (
keyAlias = "key-alias"
)

const (
// Evidence environments vars
evdSigningKey = "evd_signing_key"
evdKeyAlias = "evd_key_alias"
)

// Flag keys mapped to their corresponding components.Flag definition.
var flagsMap = map[string]components.Flag{
// Common commands flags
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ require (
)

//replace github.com/jfrog/jfrog-cli-core/v2 => github.com/oshratZairi/jfrog-cli-core/v2 v2.56.9-0.20241127142944-b39d0cc8f1c1
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/oshratZairi/jfrog-cli-core/v2 v2.56.9-0.20241127142944-b39d0cc8f1c1
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/oshratZairi/jfrog-cli-core/v2 v2.31.1-0.20241211104546-3e12a85de116

//replace github.com/jfrog/jfrog-cli-core/v2 => ../../jfrog-cli-core

//replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240811150357-12a9330a2d67
//replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240811142930-ab9715567376
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9l
github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/oshratZairi/jfrog-cli-core/v2 v2.56.9-0.20241127142944-b39d0cc8f1c1 h1:4RpB6gtAbO5ODXneIHzF/+9Ty/kY+wcscQYbAEmoVYw=
github.com/oshratZairi/jfrog-cli-core/v2 v2.56.9-0.20241127142944-b39d0cc8f1c1/go.mod h1:SThaC/fniC96oN8YgCsHjvOxp5rBM7IppuIybn1oxT0=
github.com/oshratZairi/jfrog-cli-core/v2 v2.31.1-0.20241211104546-3e12a85de116 h1:mj3vWZsJurae/5f8BMSAWNPa6b31PGyiB4KC2fQuctg=
github.com/oshratZairi/jfrog-cli-core/v2 v2.31.1-0.20241211104546-3e12a85de116/go.mod h1:RY74eDpw1WBxruSfZ0HO1ax7c1NAj+rbBgA/hVOJNME=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
Expand Down

0 comments on commit eec755a

Please sign in to comment.