From 3abb710ad360f4d7ee7461d5e19c64dc2522bdfa Mon Sep 17 00:00:00 2001 From: nxcc <> Date: Fri, 3 Feb 2023 11:19:00 +0100 Subject: [PATCH] fix: make components & checkPaths optional, update examples --- examples/configmap/cuegen.cue | 1 + examples/configmap/cuegen.yaml | 1 - .../control/dev-cluster/wekan-dev/cuegen.cue | 12 ++++++++ .../control/dev-cluster/wekan-dev/cuegen.yaml | 8 ------ .../prod-cluster/wekan-prod/cuegen.cue | 12 ++++++++ .../prod-cluster/wekan-prod/cuegen.yaml | 8 ------ .../control/prod-cluster/wekan-qa/cuegen.cue | 12 ++++++++ .../control/prod-cluster/wekan-qa/cuegen.yaml | 8 ------ examples/encrypted/cuegen.cue | 4 +++ examples/encrypted/cuegen.yaml | 2 -- examples/values/cuegen.cue | 2 ++ examples/values/cuegen.yaml | 1 - internal/app/schema.cue | 4 +-- scripts/test-all-examples.sh | 28 +++++++++++++++++++ 14 files changed, 73 insertions(+), 30 deletions(-) create mode 100644 examples/configmap/cuegen.cue delete mode 100644 examples/configmap/cuegen.yaml create mode 100644 examples/control-repository/control/dev-cluster/wekan-dev/cuegen.cue delete mode 100644 examples/control-repository/control/dev-cluster/wekan-dev/cuegen.yaml create mode 100644 examples/control-repository/control/prod-cluster/wekan-prod/cuegen.cue delete mode 100644 examples/control-repository/control/prod-cluster/wekan-prod/cuegen.yaml create mode 100644 examples/control-repository/control/prod-cluster/wekan-qa/cuegen.cue delete mode 100644 examples/control-repository/control/prod-cluster/wekan-qa/cuegen.yaml create mode 100644 examples/encrypted/cuegen.cue delete mode 100644 examples/encrypted/cuegen.yaml create mode 100644 examples/values/cuegen.cue delete mode 100644 examples/values/cuegen.yaml create mode 100755 scripts/test-all-examples.sh diff --git a/examples/configmap/cuegen.cue b/examples/configmap/cuegen.cue new file mode 100644 index 0000000..0c3378a --- /dev/null +++ b/examples/configmap/cuegen.cue @@ -0,0 +1 @@ +cuegen: objectsPath: "objects" diff --git a/examples/configmap/cuegen.yaml b/examples/configmap/cuegen.yaml deleted file mode 100644 index fb96790..0000000 --- a/examples/configmap/cuegen.yaml +++ /dev/null @@ -1 +0,0 @@ -objectsPath: objects diff --git a/examples/control-repository/control/dev-cluster/wekan-dev/cuegen.cue b/examples/control-repository/control/dev-cluster/wekan-dev/cuegen.cue new file mode 100644 index 0000000..45cf365 --- /dev/null +++ b/examples/control-repository/control/dev-cluster/wekan-dev/cuegen.cue @@ -0,0 +1,12 @@ +cuegen: { + objectsPath: "objects" + secretDataPath: "secret.*.data" + checkPaths: [ + "values", + "global", + ] + components: [ + "../../../charts/mongodb", + "../../../charts/wekan", + ] +} diff --git a/examples/control-repository/control/dev-cluster/wekan-dev/cuegen.yaml b/examples/control-repository/control/dev-cluster/wekan-dev/cuegen.yaml deleted file mode 100644 index 60b16d1..0000000 --- a/examples/control-repository/control/dev-cluster/wekan-dev/cuegen.yaml +++ /dev/null @@ -1,8 +0,0 @@ -objectsPath: objects -secretDataPath: secret.*.data -checkPaths: - - values - - global -components: - - ../../../charts/mongodb - - ../../../charts/wekan diff --git a/examples/control-repository/control/prod-cluster/wekan-prod/cuegen.cue b/examples/control-repository/control/prod-cluster/wekan-prod/cuegen.cue new file mode 100644 index 0000000..63fd814 --- /dev/null +++ b/examples/control-repository/control/prod-cluster/wekan-prod/cuegen.cue @@ -0,0 +1,12 @@ +cuegen: { + objectsPath: "objects" + secretDataPath: "secret.*.data" + checkPaths: [ + "values", + "global", + ] + components: [ + "https://github.com/nxcc/cuegen-example-mongodb?ref=v1.2.0", + "https://github.com/nxcc/cuegen-example-wekan?ref=v1.2.0", + ] +} diff --git a/examples/control-repository/control/prod-cluster/wekan-prod/cuegen.yaml b/examples/control-repository/control/prod-cluster/wekan-prod/cuegen.yaml deleted file mode 100644 index 89a9b31..0000000 --- a/examples/control-repository/control/prod-cluster/wekan-prod/cuegen.yaml +++ /dev/null @@ -1,8 +0,0 @@ -objectsPath: objects -secretDataPath: secret.*.data -checkPaths: - - values - - global -components: - - https://github.com/nxcc/cuegen-example-mongodb?ref=v1.2.0 - - https://github.com/nxcc/cuegen-example-wekan?ref=v1.2.0 diff --git a/examples/control-repository/control/prod-cluster/wekan-qa/cuegen.cue b/examples/control-repository/control/prod-cluster/wekan-qa/cuegen.cue new file mode 100644 index 0000000..63fd814 --- /dev/null +++ b/examples/control-repository/control/prod-cluster/wekan-qa/cuegen.cue @@ -0,0 +1,12 @@ +cuegen: { + objectsPath: "objects" + secretDataPath: "secret.*.data" + checkPaths: [ + "values", + "global", + ] + components: [ + "https://github.com/nxcc/cuegen-example-mongodb?ref=v1.2.0", + "https://github.com/nxcc/cuegen-example-wekan?ref=v1.2.0", + ] +} diff --git a/examples/control-repository/control/prod-cluster/wekan-qa/cuegen.yaml b/examples/control-repository/control/prod-cluster/wekan-qa/cuegen.yaml deleted file mode 100644 index 89a9b31..0000000 --- a/examples/control-repository/control/prod-cluster/wekan-qa/cuegen.yaml +++ /dev/null @@ -1,8 +0,0 @@ -objectsPath: objects -secretDataPath: secret.*.data -checkPaths: - - values - - global -components: - - https://github.com/nxcc/cuegen-example-mongodb?ref=v1.2.0 - - https://github.com/nxcc/cuegen-example-wekan?ref=v1.2.0 diff --git a/examples/encrypted/cuegen.cue b/examples/encrypted/cuegen.cue new file mode 100644 index 0000000..63c570c --- /dev/null +++ b/examples/encrypted/cuegen.cue @@ -0,0 +1,4 @@ +cuegen: { + objectsPath: "objects" + secretDataPath: "secret.*.data" +} diff --git a/examples/encrypted/cuegen.yaml b/examples/encrypted/cuegen.yaml deleted file mode 100644 index 7bd0e38..0000000 --- a/examples/encrypted/cuegen.yaml +++ /dev/null @@ -1,2 +0,0 @@ -objectsPath: objects -secretDataPath: secret.*.data diff --git a/examples/values/cuegen.cue b/examples/values/cuegen.cue new file mode 100644 index 0000000..33fb9d0 --- /dev/null +++ b/examples/values/cuegen.cue @@ -0,0 +1,2 @@ +cuegen: objectsPath: "objects" +components: [] diff --git a/examples/values/cuegen.yaml b/examples/values/cuegen.yaml deleted file mode 100644 index fb96790..0000000 --- a/examples/values/cuegen.yaml +++ /dev/null @@ -1 +0,0 @@ -objectsPath: objects diff --git a/internal/app/schema.cue b/internal/app/schema.cue index 6f1d038..62ef99e 100644 --- a/internal/app/schema.cue +++ b/internal/app/schema.cue @@ -1,8 +1,8 @@ cuegen: close({ objectsPath: string checkPath: *"" | string - checkPaths: [ ...string] + checkPaths?: [ ...string] secretDataPath: *"" | string debug: *false | bool - components: [string, ...] + components?: [string, ...] }) diff --git a/scripts/test-all-examples.sh b/scripts/test-all-examples.sh new file mode 100755 index 0000000..895bcd5 --- /dev/null +++ b/scripts/test-all-examples.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -euo pipefail +cd "$(dirname "$0")/../examples" + +trap "echo ' FAILED'" EXIT + +echo configmap... +cuegen configmap | grep -q "2023-01-10T12:00:00Z" +echo " OK" + +echo values... +cuegen values | grep -q "7 replicas configured" +echo " OK" + +echo encrypted... +SOPS_AGE_KEY=AGE-SECRET-KEY-14QUHLE5A6UNSKNYXLF5ZA26P3NCFX8P68JQ066T7VJ6JW5G8FHWQN4HAUQ \ + cuegen encrypted | grep -q IEtFWS0tLS0tCk1JSUV2Z0paTXF +echo " OK" + +echo control-repository +cuegen control-repository/control/dev-cluster/wekan-dev/ | grep -q "namespace: cuegen-demo-dev" +cuegen control-repository/control/prod-cluster/wekan-prod/ | grep -q "namespace: cuegen-demo-prod" +cuegen control-repository/control/prod-cluster/wekan-qa/ | grep -q "namespace: cuegen-demo-qa" +echo " OK" + +trap "" EXIT +echo "all tests successful"