diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5d57cd581..ec9fce118 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,6 +1,5 @@ * @CircleCI-Public/developer-experience -*orb*.go @CircleCI-Public/CPEng @CircleCI-Public/developer-experience +*orb*.go @CircleCI-Public/orb-publishers @CircleCI-Public/developer-experience /api/runner @CircleCI-Public/runner /cmd/runner @CircleCI-Public/runner - diff --git a/config/commands.go b/config/commands.go index 2167e6859..5b8fd3309 100644 --- a/config/commands.go +++ b/config/commands.go @@ -11,7 +11,7 @@ import ( func printValues(values Values) { for key, value := range values { - fmt.Printf("\t%s:\t%s", key, value) + fmt.Fprintf(os.Stderr, "%-18s %s\n", key+":", value) } } @@ -29,7 +29,6 @@ func (c *ConfigCompiler) getOrgID( optsOrgSlug string, ) (string, error) { if optsOrgID == "" && optsOrgSlug == "" { - fmt.Println("No org id or slug has been provided") return "", nil } diff --git a/config/config.go b/config/config.go index 7d17b75e5..896d2a337 100644 --- a/config/config.go +++ b/config/config.go @@ -64,7 +64,7 @@ type CompileConfigRequest struct { type Options struct { OwnerID string `json:"owner_id,omitempty"` PipelineParameters map[string]interface{} `json:"pipeline_parameters,omitempty"` - PipelineValues map[string]string `json:"pipeline_values,omitempty"` + PipelineValues map[string]interface{} `json:"pipeline_values,omitempty"` } // ConfigQuery - attempts to compile or validate a given config file with the diff --git a/config/pipeline.go b/config/pipeline.go index 09375d918..923630c4e 100644 --- a/config/pipeline.go +++ b/config/pipeline.go @@ -7,7 +7,7 @@ import ( ) // CircleCI provides various `<< pipeline.x >>` values to be used in your config, but sometimes we need to fabricate those values when validating config. -type Values map[string]string +type Values map[string]interface{} // Static typing is bypassed using an empty interface here due to pipeline parameters supporting multiple types. type Parameters map[string]interface{} @@ -31,9 +31,9 @@ func LocalPipelineValues() Values { } } - vals := map[string]string{ + vals := map[string]interface{}{ "id": "00000000-0000-0000-0000-000000000001", - "number": "1", + "number": 1, "project.git_url": gitUrl, "project.type": projectType, "git.tag": git.Tag(), diff --git a/integration_tests/features/circleci_config.feature b/integration_tests/features/circleci_config.feature index 3f645f936..9628d3bf3 100644 --- a/integration_tests/features/circleci_config.feature +++ b/integration_tests/features/circleci_config.feature @@ -159,6 +159,36 @@ Feature: Config checking Then the output should contain "fighters" And the exit status should be 0 + Scenario: Testing new type casting works as expected + Given a file named "config.yml" with: + """ + version: 2.1 + + jobs: + datadog-hello-world: + docker: + - image: cimg/base:stable + parameters: + an-integer: + description: a test case to ensure parameters are passed correctly + type: integer + default: -1 + steps: + - unless: + condition: + equal: [<< parameters.an-integer >>, -1] + steps: + - run: echo "<< parameters.an-integer >> - test" + workflows: + main-workflow: + jobs: + - datadog-hello-world: + an-integer: << pipeline.number >> + """ + When I run `circleci config process config.yml` + Then the output should contain "1 - test" + And the exit status should be 0 + Scenario: Checking a valid config file with default pipeline params Given a file named "config.yml" with: """