From 986f6c425414f2b6ed9adac8242864835a115bd9 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Fri, 7 Feb 2025 19:36:56 +0200 Subject: [PATCH] Fix k8s secret schema (#4819) --- .../.woodpecker/test-backend-options.yaml | 10 ++++++++++ .../frontend/yaml/linter/schema/schema.json | 20 +++++++++++++------ .../yaml/linter/schema/schema_test.go | 4 ++++ 3 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 pipeline/frontend/yaml/linter/schema/.woodpecker/test-backend-options.yaml diff --git a/pipeline/frontend/yaml/linter/schema/.woodpecker/test-backend-options.yaml b/pipeline/frontend/yaml/linter/schema/.woodpecker/test-backend-options.yaml new file mode 100644 index 000000000..d86f8e536 --- /dev/null +++ b/pipeline/frontend/yaml/linter/schema/.woodpecker/test-backend-options.yaml @@ -0,0 +1,10 @@ +steps: + - name: Build Container + image: woodpeckerci/plugin-kaniko:1.2.1 + backend_options: + kubernetes: + secrets: + - name: aws-secret + key: credentials + target: + file: /root/.aws/credentials diff --git a/pipeline/frontend/yaml/linter/schema/schema.json b/pipeline/frontend/yaml/linter/schema/schema.json index 6fcb37630..8cde9d42c 100644 --- a/pipeline/frontend/yaml/linter/schema/schema.json +++ b/pipeline/frontend/yaml/linter/schema/schema.json @@ -762,15 +762,23 @@ "description": "A target which a native Kubernetes secret maps to.", "oneOf": [ { - "env": { - "description": "The name of the environment variable which secret maps to.", - "type": "string" + "type": "object", + "additionalProperties": false, + "properties": { + "env": { + "description": "The name of the environment variable which secret maps to.", + "type": "string" + } } }, { - "file": { - "description": "The filename (path) which secret maps to.", - "type": "string" + "type": "object", + "additionalProperties": false, + "properties": { + "file": { + "description": "The filename (path) which secret maps to.", + "type": "string" + } } } ] diff --git a/pipeline/frontend/yaml/linter/schema/schema_test.go b/pipeline/frontend/yaml/linter/schema/schema_test.go index 63ddcdb85..c2c06dfed 100644 --- a/pipeline/frontend/yaml/linter/schema/schema_test.go +++ b/pipeline/frontend/yaml/linter/schema/schema_test.go @@ -80,6 +80,10 @@ func TestSchema(t *testing.T) { name: "Map and Sequence Merge", // https://woodpecker-ci.org/docs/next/usage/advanced-yaml-syntax testFile: ".woodpecker/test-merge-map-and-sequence.yaml", }, + { + name: "Backend options", + testFile: ".woodpecker/test-backend-options.yaml", + }, { name: "Broken Config", testFile: ".woodpecker/test-broken.yaml",