Skip to content

Commit

Permalink
Merge pull request #858 from CircleCI-Public/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
JulesFaucherre authored Mar 3, 2023
2 parents 72f4cb1 + c899e41 commit 0ad35cd
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 31 deletions.
2 changes: 1 addition & 1 deletion chocolatey/circleci-cli/circleci-cli.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<title>circleci-cli (Install)</title>
<authors>CircleCI</authors>
<projectUrl>https://circleci.com/docs/2.0/local-cli/</projectUrl>
<iconUrl>https://github.com/CircleCI-Public/circleci-cli/raw/master/chocolatey/icons/circleci-128x.png</iconUrl>
<iconUrl>https://github.com/CircleCI-Public/circleci-cli/raw/main/chocolatey/icons/circleci-128x.png</iconUrl>
<licenseUrl>https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<projectSourceUrl>https://github.com/CircleCI-Public/circleci-cli</projectSourceUrl>
Expand Down
22 changes: 18 additions & 4 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,19 @@ func validateConfig(opts configOptions, flags *pflag.FlagSet) error {
}

//if no orgId provided use org slug
values := pipeline.LocalPipelineValues()
fmt.Println("Validating config with following values")
printValues(values)

orgID, _ := flags.GetString("org-id")
if strings.TrimSpace(orgID) != "" {
response, err = api.ConfigQuery(opts.cl, path, orgID, nil, pipeline.LocalPipelineValues())
response, err = api.ConfigQuery(opts.cl, path, orgID, nil, values)
if err != nil {
return err
}
} else {
orgSlug, _ := flags.GetString("org-slug")
response, err = api.ConfigQueryLegacy(opts.cl, path, orgSlug, nil, pipeline.LocalPipelineValues())
response, err = api.ConfigQueryLegacy(opts.cl, path, orgSlug, nil, values)
if err != nil {
return err
}
Expand Down Expand Up @@ -192,15 +196,19 @@ func processConfig(opts configOptions, flags *pflag.FlagSet) error {
}

//if no orgId provided use org slug
values := pipeline.LocalPipelineValues()
fmt.Println("Processing config with following values")
printValues(values)

orgID, _ := flags.GetString("org-id")
if strings.TrimSpace(orgID) != "" {
response, err = api.ConfigQuery(opts.cl, opts.args[0], orgID, params, pipeline.LocalPipelineValues())
response, err = api.ConfigQuery(opts.cl, opts.args[0], orgID, params, values)
if err != nil {
return err
}
} else {
orgSlug, _ := flags.GetString("org-slug")
response, err = api.ConfigQueryLegacy(opts.cl, opts.args[0], orgSlug, params, pipeline.LocalPipelineValues())
response, err = api.ConfigQueryLegacy(opts.cl, opts.args[0], orgSlug, params, values)
if err != nil {
return err
}
Expand All @@ -227,3 +235,9 @@ func packConfig(opts configOptions) error {
func migrateConfig(opts configOptions) error {
return proxy.Exec([]string{"config", "migrate"}, opts.args)
}

func printValues(values pipeline.Values) {
for key, value := range values {
fmt.Printf("\t%s:\t%s", key, value)
}
}
16 changes: 10 additions & 6 deletions cmd/orb.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,16 @@ If you change your mind about the name, you will have to create a new orb with t
`, namespace, orbName)
}

if opts.private {
fmt.Printf(`This orb will not be listed on the registry and is usable only by org users.
`)
} else {
fmt.Printf(`Please note that any versions you publish of this orb will be world readable unless you create it with the '--private' flag
`)
}

confirm := fmt.Sprintf("Are you sure you wish to create the orb: `%s/%s`", namespace, orbName)

if opts.noPrompt || opts.tty.askUserToConfirm(confirm) {
Expand All @@ -880,13 +890,7 @@ If you change your mind about the name, you will have to create a new orb with t
return err
}

confirmationString := "Please note that any versions you publish of this orb are world-readable."
if opts.private {
confirmationString = "This orb will not be listed on the registry and is usable only by org users."
}

fmt.Printf("Orb `%s` created.\n", opts.args[0])
fmt.Println(confirmationString)
fmt.Printf("You can now register versions of `%s` using `circleci orb publish`.\n", opts.args[0])
}

Expand Down
13 changes: 8 additions & 5 deletions cmd/orb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,9 @@ See a full explanation and documentation on orbs here: https://circleci.com/docs
Eventually(session).Should(gexec.Exit(0))

stdout := session.Wait().Out.Contents()
Expect(string(stdout)).To(ContainSubstring(fmt.Sprintf(`Orb %s created.
Please note that any versions you publish of this orb are world-readable.
Expect(string(stdout)).To(ContainSubstring(fmt.Sprintf(`Please note that any versions you publish of this orb will be world readable unless you create it with the '--private' flag
Orb %s created.
You can now register versions of %s using %s`, "`bar-ns/foo-orb`", "`bar-ns/foo-orb`", "`circleci orb publish`")))
})

Expand Down Expand Up @@ -1232,8 +1233,9 @@ You can now register versions of %s using %s`, "`bar-ns/foo-orb`", "`bar-ns/foo-
Eventually(session).Should(gexec.Exit(0))

stdout := session.Wait().Out.Contents()
Expect(string(stdout)).To(ContainSubstring(fmt.Sprintf(`Orb %s created.
This orb will not be listed on the registry and is usable only by org users.
Expect(string(stdout)).To(ContainSubstring(fmt.Sprintf(`This orb will not be listed on the registry and is usable only by org users.
Orb %s created.
You can now register versions of %s using %s`, "`bar-ns/foo-orb`", "`bar-ns/foo-orb`", "`circleci orb publish`")))
})

Expand Down Expand Up @@ -1365,9 +1367,10 @@ You will not be able to change the name of this orb.
If you change your mind about the name, you will have to create a new orb with the new name.
Please note that any versions you publish of this orb will be world readable unless you create it with the '--private' flag
Are you sure you wish to create the orb: %s
Orb %s created.
Please note that any versions you publish of this orb are world-readable.
You can now register versions of %s using %s.`,
"bar-ns/foo-orb", "`bar-ns/foo-orb`", "`bar-ns/foo-orb`", "`bar-ns/foo-orb`", "`circleci orb publish`")))
})
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/CircleCI-Public/circleci-cli

require (
github.com/AlecAivazis/survey/v2 v2.1.1
github.com/CircleCI-Public/circle-policy-agent v0.0.534
github.com/CircleCI-Public/circle-policy-agent v0.0.564
github.com/Masterminds/semver v1.4.2
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/blang/semver v3.5.1+incompatible
Expand Down Expand Up @@ -82,10 +82,10 @@ require (
github.com/yashtewari/glob-intersection v0.1.0 // indirect
github.com/yazgazan/jaydiff v0.3.1 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/term v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ github.com/AlecAivazis/survey/v2 v2.1.1 h1:LEMbHE0pLj75faaVEKClEX1TM4AJmmnOh9eim
github.com/AlecAivazis/survey/v2 v2.1.1/go.mod h1:9FJRdMdDm8rnT+zHVbvQT2RTSTLq0Ttd6q3Vl2fahjk=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CircleCI-Public/circle-policy-agent v0.0.534 h1:NekWjox7QQ2+K1QtNNPRP244JwLCLPze9Km3IOWTB+I=
github.com/CircleCI-Public/circle-policy-agent v0.0.534/go.mod h1:oySWkeJOAnvT56DRaGL0n2lHmeCEFwrhGg0Bvj9jiI8=
github.com/CircleCI-Public/circle-policy-agent v0.0.564 h1:i7CkwfUVL9fItTc1X9evcCgwmuiRsTOODcCmYrByu7s=
github.com/CircleCI-Public/circle-policy-agent v0.0.564/go.mod h1:oySWkeJOAnvT56DRaGL0n2lHmeCEFwrhGg0Bvj9jiI8=
github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc=
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw=
Expand Down Expand Up @@ -419,8 +419,8 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -483,21 +483,21 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg=
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down

0 comments on commit 0ad35cd

Please sign in to comment.