From 7a94680cea0afdb356ae6add2ad5e77b2d578776 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Mon, 20 Mar 2023 13:53:45 +0000 Subject: [PATCH 1/2] docs: correct installation of given version with sudo --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f9fdb9e4..1ba7e4d76 100644 --- a/README.md +++ b/README.md @@ -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__checksums.txt` inside the assets of the release you'd like to install: From cb2d3e635e5be8bbaf1c8e18eb0fad4cdadd3322 Mon Sep 17 00:00:00 2001 From: William Yardley Date: Tue, 4 Apr 2023 19:57:22 -0700 Subject: [PATCH 2/2] Additional formatting updates for config validation Resolve some issues from #861 and #896 - Suppress some whitespace when verbose output is not enabled - Write to stderr again - Use "%v" instead of "%s" so that "number" in pipeline values gets printed correctly - Sort values to provide stable output order for pipeline values --- config/commands.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/config/commands.go b/config/commands.go index 5b8fd3309..64504939f 100644 --- a/config/commands.go +++ b/config/commands.go @@ -3,6 +3,7 @@ package config import ( "fmt" "os" + "sort" "strings" "github.com/pkg/errors" @@ -10,9 +11,19 @@ import ( ) 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 { @@ -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) } @@ -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) } @@ -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 }