Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #900

Merged
merged 6 commits into from
Apr 5, 2023
Merged
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: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/i
You can also set a specific version of the CLI to install with the `VERSION` environment variable:

```
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | VERSION=0.1.5222 sudo bash
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | sudo VERSION=0.1.5222 bash
```

Take note that additional environment variables should be passed between sudo and invoking bash.

#### Checksum verification

If you would like to verify the checksum yourself, you can download the checksum file from the [GitHub releases page](https://github.com/CircleCI-Public/circleci-cli/releases) and verify the checksum of the archive using the `circleci-cli_<version>_checksums.txt` inside the assets of the release you'd like to install:
Expand Down
21 changes: 16 additions & 5 deletions config/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,27 @@ package config
import (
"fmt"
"os"
"sort"
"strings"

"github.com/pkg/errors"
"gopkg.in/yaml.v3"
)

func printValues(values Values) {
for key, value := range values {
fmt.Fprintf(os.Stderr, "%-18s %s\n", key+":", value)
// Provide a stable sort order for printed values
keys := make([]string, 0, len(values))
for k := range values {
keys = append(keys, k)
}
sort.Strings(keys)

for _, key := range keys {
fmt.Fprintf(os.Stderr, "%-18s %v\n", key+":", values[key])
}

// Add empty newline at end
fmt.Fprintf(os.Stderr, "\n")
}

type ProcessConfigOpts struct {
Expand Down Expand Up @@ -73,7 +84,7 @@ func (c *ConfigCompiler) ProcessConfig(opts ProcessConfigOpts) error {
//if no orgId provided use org slug
values := LocalPipelineValues()
if opts.VerboseOutput {
fmt.Println("Processing config with following values")
fmt.Fprintln(os.Stderr, "Processing config with following values:")
printValues(values)
}

Expand Down Expand Up @@ -118,7 +129,7 @@ func (c *ConfigCompiler) ValidateConfig(opts ValidateConfigOpts) error {
//if no orgId provided use org slug
values := LocalPipelineValues()
if opts.VerboseOutput {
fmt.Println("Validating config with following values")
fmt.Fprintln(os.Stderr, "Validating config with following values:")
printValues(values)
}

Expand Down Expand Up @@ -152,6 +163,6 @@ func (c *ConfigCompiler) ValidateConfig(opts ValidateConfigOpts) error {
}
}

fmt.Printf("\nConfig file at %s is valid.\n", opts.ConfigPath)
fmt.Printf("Config file at %s is valid.\n", opts.ConfigPath)
return nil
}