diff --git a/.editorconfig b/.editorconfig index 98e0bca..206b7f7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -24,3 +24,10 @@ insert_final_newline = false [Makefile] indent_style = tab + +; Ignore golden test outputs +[tests/golden/**] +indent_size = unset +indent_style = unset +insert_final_newline = unset +trim_trailing_whitespace = unset diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml new file mode 100644 index 0000000..f022f87 --- /dev/null +++ b/.github/workflows/auto-release.yaml @@ -0,0 +1,24 @@ +name: Autorelease +on: + pull_request: + types: + - synchronize + - labeled + - unlabeled + - closed + +permissions: + contents: write + issues: write + pull-requests: write + actions: write + +jobs: + create-release-tag: + runs-on: ubuntu-latest + steps: + - name: Create new tag + uses: projectsyn/pr-label-tag-action@v1 + with: + trigger: | + Release diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5042b59..b0eac75 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,17 +3,18 @@ on: push: tags: - v* + workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 with: fetch-depth: "0" - name: Build changelog from PRs with labels id: build_changelog - uses: mikepenz/release-changelog-builder-action@v1 + uses: mikepenz/release-changelog-builder-action@v5 with: configuration: ".github/changelog-configuration.json" # PreReleases still get a changelog, but the next full release gets a diff since the last full release, diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8a7030a..31b45f9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,8 +1,11 @@ name: Pull Request on: + push: pull_request: - branches: - - master + workflow_dispatch: + +env: + COMPONENT_NAME: helm-chart jobs: linting: @@ -12,15 +15,47 @@ jobs: command: - lint_jsonnet - lint_yaml - - docs-vale + - lint_adoc steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - name: Run ${{ matrix.command }} run: make ${{ matrix.command }} editorconfig: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: snow-actions/eclint@v1.0.1 with: args: 'check' + test: + runs-on: ubuntu-latest + strategy: + matrix: + instance: + - defaults + - with_values + defaults: + run: + working-directory: ${{ env.COMPONENT_NAME }} + steps: + - uses: actions/checkout@v5 + with: + path: ${{ env.COMPONENT_NAME }} + - name: Compile component + run: make test -e instance=${{ matrix.instance }} + golden: + runs-on: ubuntu-latest + strategy: + matrix: + instance: + - defaults + - with_values + defaults: + run: + working-directory: ${{ env.COMPONENT_NAME }} + steps: + - uses: actions/checkout@v5 + with: + path: ${{ env.COMPONENT_NAME }} + - name: Golden diff + run: make golden-diff -e instance=${{ matrix.instance }} diff --git a/.gitignore b/.gitignore index 0b56d41..a12081c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,16 @@ -_archive/ -_public/ -.cache/ -helmcharts/ -manifests/ -vendor/ -jsonnetfile.lock.json -build +# Commodore +/.cache +/dependencies +helmcharts +/manifests +/vendor +/jsonnetfile.lock.json +/crds +/compiled + +# Antora +/_archive +/_public + +# Additional entries +/.idea/ diff --git a/.sync.yaml b/.sync.yaml deleted file mode 100644 index 97ded86..0000000 --- a/.sync.yaml +++ /dev/null @@ -1,7 +0,0 @@ -:global: - componentName: helm-chart - githubUrl: https://github.com/projectsyn/component-helm-chart - -docs/antora.yml: - name: helm-chart - title: Helm Chart diff --git a/.yamllint.yml b/.yamllint.yml index addf0aa..92aea6c 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -5,3 +5,20 @@ rules: line-length: max: 80 level: warning + + # Forbid octal literals until we've fully migrated to reclass-rs + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true + + # Restrict truthy values to set which is parsed as boolean by reclass-rs + truthy: + allowed-values: ['true', 'false', 'True', 'False', 'TRUE', 'FALSE'] + check-keys: true + +ignore: | + dependencies/ + helmcharts/ + manifests/ + vendor/ + compiled/ diff --git a/Makefile b/Makefile index a775e60..daba018 100644 --- a/Makefile +++ b/Makefile @@ -5,50 +5,81 @@ SHELL := bash .DELETE_ON_ERROR: .SUFFIXES: -DOCKER_CMD ?= docker -DOCKER_ARGS ?= run --rm --user "$$(id -u)" -v "$${PWD}:/component" --workdir /component +include Makefile.vars.mk +include Makefile.custom.mk -JSONNET_FILES ?= $(shell find . -type f -not -path './vendor/*' \( -name '*.*jsonnet' -or -name '*.libsonnet' \)) -JSONNETFMT_ARGS ?= --in-place --pad-arrays -JSONNET_IMAGE ?= docker.io/bitnami/jsonnet:latest -JSONNET_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) --entrypoint=jsonnetfmt $(JSONNET_IMAGE) - -YAML_FILES ?= $(shell find . -type f -not -path './vendor/*' \( -name '*.yaml' -or -name '*.yml' \)) -YAMLLINT_ARGS ?= --no-warnings -YAMLLINT_CONFIG ?= .yamllint.yml -YAMLLINT_IMAGE ?= docker.io/cytopia/yamllint:latest -YAMLLINT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(YAMLLINT_IMAGE) - -VALE_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) --volume "$${PWD}"/docs/modules:/pages vshn/vale:2.1.1 -VALE_ARGS ?= --minAlertLevel=error --config=/pages/ROOT/pages/.vale.ini /pages - -ANTORA_PREVIEW_CMD ?= $(DOCKER_CMD) run --rm --publish 2020:2020 --volume "${PWD}":/antora vshn/antora-preview:2.3.3 --style=syn --antora=docs +.PHONY: help +help: ## Show this help + @grep -E -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = "(: ).*?## "}; {gsub(/\\:/,":", $$1)}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' .PHONY: all -all: lint open +all: lint .PHONY: lint -lint: lint_jsonnet lint_yaml docs-vale +lint: lint_jsonnet lint_yaml lint_adoc lint_kubent ## All-in-one linting .PHONY: lint_jsonnet -lint_jsonnet: $(JSONNET_FILES) +lint_jsonnet: $(JSONNET_FILES) ## Lint jsonnet files $(JSONNET_DOCKER) $(JSONNETFMT_ARGS) --test -- $? .PHONY: lint_yaml -lint_yaml: $(YAML_FILES) - $(YAMLLINT_DOCKER) -f parsable -c $(YAMLLINT_CONFIG) $(YAMLLINT_ARGS) -- $? +lint_yaml: ## Lint yaml files + $(YAMLLINT_DOCKER) -f parsable -c $(YAMLLINT_CONFIG) $(YAMLLINT_ARGS) -- . + +.PHONY: lint_adoc +lint_adoc: ## Lint documentation + $(VALE_CMD) $(VALE_ARGS) +.PHONY: lint_kubent +lint_kubent: ## Check for deprecated Kubernetes API versions + $(KUBENT_DOCKER) $(KUBENT_ARGS) -f $(KUBENT_FILES) .PHONY: format -format: format_jsonnet +format: format_jsonnet ## All-in-one formatting .PHONY: format_jsonnet -format_jsonnet: $(JSONNET_FILES) +format_jsonnet: $(JSONNET_FILES) ## Format jsonnet files $(JSONNET_DOCKER) $(JSONNETFMT_ARGS) -- $? .PHONY: docs-serve -docs-serve: +docs-serve: ## Preview the documentation $(ANTORA_PREVIEW_CMD) -.PHONY: docs-vale -docs-vale: - $(VALE_CMD) $(VALE_ARGS) +.PHONY: compile +.compile: + mkdir -p dependencies + $(COMPILE_CMD) + +.PHONY: test +test: commodore_args += -f tests/$(instance).yml +test: .compile ## Compile the component +.PHONY: gen-golden +gen-golden: commodore_args += -f tests/$(instance).yml +gen-golden: clean .compile ## Update the reference version for target `golden-diff`. + @rm -rf tests/golden/$(instance) + @mkdir -p tests/golden/$(instance) + @cp -R compiled/. tests/golden/$(instance)/. + +.PHONY: golden-diff +golden-diff: commodore_args += -f tests/$(instance).yml +golden-diff: clean .compile ## Diff compile output against the reference version. Review output and run `make gen-golden golden-diff` if this target fails. + @git diff --exit-code --minimal --no-index -- tests/golden/$(instance) compiled/ + +.PHONY: golden-diff-all +golden-diff-all: recursive_target=golden-diff +golden-diff-all: $(test_instances) ## Run golden-diff for all instances. Note: this doesn't work when running make with multiple parallel jobs (-j != 1). + +.PHONY: gen-golden-all +gen-golden-all: recursive_target=gen-golden +gen-golden-all: $(test_instances) ## Run gen-golden for all instances. Note: this doesn't work when running make with multiple parallel jobs (-j != 1). + +.PHONY: lint_kubent_all +lint_kubent_all: recursive_target=lint_kubent +lint_kubent_all: $(test_instances) ## Lint deprecated Kubernetes API versions for all golden test instances. Will exit on first error. Note: this doesn't work when running make with multiple parallel jobs (-j != 1). + +.PHONY: $(test_instances) +$(test_instances): + $(MAKE) $(recursive_target) -e instance=$(basename $(@F)) + +.PHONY: clean +clean: ## Clean the project + rm -rf .cache compiled dependencies vendor helmcharts jsonnetfile*.json || true diff --git a/Makefile.custom.mk b/Makefile.custom.mk new file mode 100644 index 0000000..6e30823 --- /dev/null +++ b/Makefile.custom.mk @@ -0,0 +1,2 @@ +# Configure instance alias for commodore component compile +commodore_args += --alias $(instance) diff --git a/Makefile.vars.mk b/Makefile.vars.mk new file mode 100644 index 0000000..9738d21 --- /dev/null +++ b/Makefile.vars.mk @@ -0,0 +1,53 @@ +# The component name is hard-coded from the template +COMPONENT_NAME ?= helm-chart + +git_dir ?= $(shell git rev-parse --git-common-dir) +compiled_path ?= compiled/$(COMPONENT_NAME)/$(COMPONENT_NAME) +root_volume ?= -v "$${PWD}:/$(COMPONENT_NAME)" +compiled_volume ?= -v "$${PWD}/$(compiled_path):/$(COMPONENT_NAME)" +commodore_args ?= --search-paths . -n $(COMPONENT_NAME) + +ifneq "$(git_dir)" ".git" + git_volume ?= -v "$(git_dir):$(git_dir):ro" + antora_git_volume ?= -v "$(git_dir):/preview/antora/.git:ro" +else + git_volume ?= + antora_git_volume ?= -v "${PWD}/.git:/preview/antora/.git:ro" +endif + +ifneq "$(shell which docker 2>/dev/null)" "" + DOCKER_CMD ?= $(shell which docker) + DOCKER_USERNS ?= "" +else + DOCKER_CMD ?= podman + DOCKER_USERNS ?= keep-id +endif +DOCKER_ARGS ?= run --rm -u "$$(id -u):$$(id -g)" --userns=$(DOCKER_USERNS) -w /$(COMPONENT_NAME) -e HOME="/$(COMPONENT_NAME)" + +JSONNET_FILES ?= $(shell find . -type f -not -path './vendor/*' \( -name '*.*jsonnet' -or -name '*.libsonnet' \)) +JSONNETFMT_ARGS ?= --in-place --pad-arrays +JSONNET_IMAGE ?= ghcr.io/projectsyn/jsonnet:latest +JSONNET_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=jsonnetfmt $(JSONNET_IMAGE) + +YAMLLINT_ARGS ?= --no-warnings +YAMLLINT_CONFIG ?= .yamllint.yml +YAMLLINT_IMAGE ?= docker.io/cytopia/yamllint:latest +YAMLLINT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) $(YAMLLINT_IMAGE) + +VALE_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --volume "$${PWD}"/docs/modules:/pages ghcr.io/vshn/vale:2.15.5 +VALE_ARGS ?= --minAlertLevel=error --config=/pages/ROOT/pages/.vale.ini /pages + +ANTORA_PREVIEW_CMD ?= $(DOCKER_CMD) run --rm --publish 35729:35729 --publish 2020:2020 $(antora_git_volume) --volume "${PWD}/docs":/preview/antora/docs ghcr.io/vshn/antora-preview:3.1.2.3 --style=syn --antora=docs + +COMMODORE_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(git_volume) $(root_volume) docker.io/projectsyn/commodore:latest +COMPILE_CMD ?= $(COMMODORE_CMD) component compile . $(commodore_args) +JB_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) --entrypoint /usr/local/bin/jb docker.io/projectsyn/commodore:latest install +GOLDEN_FILES ?= $(shell find tests/golden/$(instance) -type f) + +KUBENT_FILES ?= $(shell echo "$(GOLDEN_FILES)" | sed 's/ /,/g') +KUBENT_ARGS ?= -c=false --helm3=false -e +KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest +KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE) + +instance ?= defaults +test_instances = tests/defaults.yml tests/with_values.yml diff --git a/README.md b/README.md index d86f177..892b7d9 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,38 @@ # Commodore Component: helm-chart -This is a [Commodore][commodore] Component for helm charts. +This is a [Commodore][commodore] Component for helm-chart. -This repository is part of Project Syn. -For documentation on Project Syn and this component, see https://syn.tools. +This can be used to deploy a helm chart to the cluster. +The component is multi-tenant, multi-instance and multi-version aware: each +instance gets its own namespace and can pin its own chart version. + +By default the component installs the OCI chart `test-helm-chart` from +`oci://ghcr.io/appuio/test-helm-chart/test-helm-chart`. ## Documentation Documentation for this component is written using [Asciidoc][asciidoc] and [Antora][antora]. -It is located in the [docs/](docs) folder. -The [Divio documentation structure](https://documentation.divio.com/) is used to organize its content. +It can be found in the [`docs`](docs) folder. +We use the [Divio documentation structure](https://documentation.divio.com/) to organize our documentation. Run the `make docs-serve` command in the root of the project, and then browse to http://localhost:2020 to see a preview of the current state of the documentation. After writing the documentation, please use the `make docs-vale` command and correct any warnings raised by the tool. +## Testing + +The component is tested with two instances, `defaults` and `with_values`: + +- `make test -e instance=defaults` +- `make test -e instance=with_values` + +Run `make gen-golden-all` to regenerate the golden test outputs. + ## Contributing and license This library is licensed under [BSD-3-Clause](LICENSE). -For information about how to contribute see [CONTRIBUTING](CONTRIBUTING.md). +For information about how to contribute, see [CONTRIBUTING](CONTRIBUTING.md). -[commodore]: https://docs.syn.tools/commodore/index.html +[commodore]: https://syn.tools/commodore/ [asciidoc]: https://asciidoctor.org/ [antora]: https://antora.org/ diff --git a/class/defaults.yml b/class/defaults.yml index 09d5bb0..e323e30 100644 --- a/class/defaults.yml +++ b/class/defaults.yml @@ -1,5 +1,17 @@ parameters: helm_chart: - multi_instance: true - include_crds: true - helmValues: {} + =_metadata: + multi_tenant: true + multi_instance: true + multi_version: true + namespace: ${_instance} + createNamespace: true + namespaceLabels: {} + namespaceAnnotations: {} + charts: + chart1: + name: test-helm-chart + # renovate: datasource=docker depName=ghcr.io/appuio/test-helm-chart + version: "0.0.1" + source: oci://ghcr.io/appuio/test-helm-chart/test-helm-chart + helm_values: {} diff --git a/class/helm-chart.yml b/class/helm-chart.yml index 9dbdeef..74cf252 100644 --- a/class/helm-chart.yml +++ b/class/helm-chart.yml @@ -2,23 +2,24 @@ parameters: kapitan: dependencies: - type: helm - source: ${${_instance}:chart:repo} - chart_name: ${${_instance}:chart:name} - version: ${${_instance}:chart:version} - output_path: ${_instance}_${${_instance}:chart:name} + source: ${helm_chart:charts:chart1:source} + chart_name: ${helm_chart:charts:chart1:name} + version: ${helm_chart:charts:chart1:version} + output_path: ${_base_directory}/helmcharts/${helm_chart:charts:chart1:name}-${helm_chart:charts:chart1:version} compile: - input_paths: - - helm-chart/component/app.jsonnet + - ${_base_directory}/helmcharts/${helm_chart:charts:chart1:name}-${helm_chart:charts:chart1:version} + input_type: helm + output_path: ${_instance}/${helm_chart:charts:chart1:name} + helm_values: ${helm_chart:helm_values} + helm_params: + name: ${helm_chart:charts:chart1:name} + namespace: ${helm_chart:namespace} + - input_paths: + - ${_base_directory}/component/app.jsonnet input_type: jsonnet - output_path: apps/ + output_path: . - input_paths: - - helm-chart/component/main.jsonnet + - ${_base_directory}/component/main.jsonnet input_type: jsonnet - output_path: ${_instance} - - input_type: helm - input_paths: - - ${_instance}_${${_instance}:chart:name} - helm_values: ${${_instance}:helmValues} - helm_params: - namespace: ${${_instance}:namespace} - output_path: ${_instance}/01_helmchart + output_path: ${_instance}/${helm_chart:charts:chart1:name} diff --git a/component/app.jsonnet b/component/app.jsonnet index aacb9f5..9ca47eb 100644 --- a/component/app.jsonnet +++ b/component/app.jsonnet @@ -1,12 +1,15 @@ local kap = import 'lib/kapitan.libjsonnet'; local inv = kap.inventory(); +local params = inv.parameters.helm_chart; local argocd = import 'lib/argocd.libjsonnet'; -local params = inv.parameters; + local instance = inv.parameters._instance; -local params = inv.parameters[instance]; +local app = argocd.App(instance, params.namespace, secrets=true, base='helm-chart'); -local app = argocd.App(instance, params.namespace); +local appPath = + local project = std.get(std.get(app, 'spec', {}), 'project', 'syn'); + if project == 'syn' then 'apps' else 'apps-%s' % project; { - [instance]: app, + ['%s/%s' % [ appPath, instance ]]: app, } diff --git a/component/main.jsonnet b/component/main.jsonnet index 9ecdef5..d1ec044 100644 --- a/component/main.jsonnet +++ b/component/main.jsonnet @@ -2,12 +2,25 @@ local kap = import 'lib/kapitan.libjsonnet'; local kube = import 'lib/kube.libjsonnet'; local inv = kap.inventory(); -local instance = inv.parameters._instance; -local params = inv.parameters[instance]; - -local namespace = kube.Namespace(params.namespace); +// The hiera parameters for the component +local params = inv.parameters.helm_chart; +local instance = inv.parameters._instance; // Define outputs below { - '00_namespace': namespace, + [if params.createNamespace then '00_namespace']: kube.Namespace(params.namespace) + { + metadata+: { + labels+: + { + component: 'helm-chart', + instance: instance, + } + + params.namespaceLabels, + annotations+: + { + 'syn.tools/source': 'https://github.com/appuio/component-helm-chart', + } + + params.namespaceAnnotations, + }, + }, } diff --git a/docs/antora.yml b/docs/antora.yml deleted file mode 100644 index 677fe76..0000000 --- a/docs/antora.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: helm-chart -title: helm-chart -version: master -start_page: ROOT:index.adoc -nav: - - modules/ROOT/partials/nav.adoc diff --git a/docs/modules/ROOT/pages/.vale.ini b/docs/modules/ROOT/pages/.vale.ini new file mode 100644 index 0000000..bbabddf --- /dev/null +++ b/docs/modules/ROOT/pages/.vale.ini @@ -0,0 +1 @@ +# Vale config diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index 3409a5f..0bf24e0 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -1,5 +1,12 @@ = helm-chart -helm-chart is a Commodore component to manage helm charts. +helm-chart is a Commodore component to deploy a helm chart to the cluster. + +The component is multi-tenant, multi-instance and multi-version aware. Each +instance is compiled with `--alias ` and gets its own namespace. The +chart version can be pinned per instance. + +By default the component installs the OCI chart `test-helm-chart` from +`oci://ghcr.io/appuio/test-helm-chart/test-helm-chart`. See the xref:references/parameters.adoc[parameters] reference for further details. diff --git a/docs/modules/ROOT/pages/references/parameters.adoc b/docs/modules/ROOT/pages/references/parameters.adoc index ddbc82c..88edbc3 100644 --- a/docs/modules/ROOT/pages/references/parameters.adoc +++ b/docs/modules/ROOT/pages/references/parameters.adoc @@ -1,32 +1,100 @@ = Parameters -Use an alias for the component. +The parent key for all of the following parameters is `helm_chart`. + +The component is multi-tenant, multi-instance and multi-version aware. Each +instance is compiled with `--alias ` and can override the parameters +below. == `namespace` [horizontal] type:: string +default:: `${_instance}` The namespace in which to deploy this component. +The default is the instance name, so each instance gets its own namespace. + + +== Example + +[source,yaml] +---- +namespace: example-namespace +---- + +== `createNamespace` + +[horizontal] +type:: boolean +default:: `true` + +Whether to create the namespace. + + +== Example + +[source,yaml] +---- +createNamespace: false +---- + +== `charts.chart1` + +[horizontal] +type:: dict -== `include_crds` +The helm chart to install. + +== `charts.chart1.name` [horizontal] -type:: bool -default:: true +type:: string +default:: `test-helm-chart` + +The name of the helm chart. + +== `charts.chart1.version` + +[horizontal] +type:: string +default:: `0.0.1` -Include crds in deployment. +The version of the helm chart. +Each instance can pin its own version. -== `chart` + +== Example + +[source,yaml] +---- +charts: + chart1: + version: "0.1.0" +---- + +== `charts.chart1.source` [horizontal] -type:: map +type:: string +default:: `oci://ghcr.io/appuio/test-helm-chart/test-helm-chart` -The configuration of the helm chart: repo, name, version +The source of the helm chart. +This can be an OCI registry reference or a helm repository URL. -== `helmValues` +== `helm_values` [horizontal] -type:: map +type:: dict +default:: `{}` + +The values passed to the helm chart. + + +== Example -Configuration values for the helm charts. +[source,yaml] +---- +helm_values: + foo: bar +---- diff --git a/jsonnetfile.json b/jsonnetfile.json deleted file mode 100644 index b14b472..0000000 --- a/jsonnetfile.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": 1, - "dependencies": [ - { - "source": { - "git": { - "remote": "https://github.com/bitnami-labs/kube-libsonnet" - } - }, - "version": "v1.14.6" - } - ], - "legacyImports": true -} \ No newline at end of file diff --git a/renovate.json b/renovate.json index b44ed76..939245a 100644 --- a/renovate.json +++ b/renovate.json @@ -1,8 +1,48 @@ { "extends": [ - "config:base" + "config:base", + ":gitSignOff", + ":disableDependencyDashboard" + ], + "ignorePaths": [ + ".github/**" ], "labels": [ "dependency" + ], + "separateMinorPatch": true, + "packageRules": [ + { + "matchUpdateTypes": [ + "patch", + "digest" + ], + "matchCurrentVersion": "!/^v?0\\./", + "automerge": true, + "platformAutomerge": false, + "labels": [ + "dependency", + "automerge", + "bump:patch" + ] + }, + { + "automerge": true, + "platformAutomerge": false, + "matchDatasources": [ + "docker" + ], + "labels": [ + "dependency", + "automerge", + "bump:minor" + ] + }, + { + "matchDepNames": [ + "ghcr.io/appuio/test-helm-chart" + ], + "versioning": "loose" + } ] } diff --git a/tests/defaults.yml b/tests/defaults.yml new file mode 100644 index 0000000..6618a70 --- /dev/null +++ b/tests/defaults.yml @@ -0,0 +1,7 @@ +parameters: + defaults: + helm_values: + foo: bar + from_parameters: "yes" + createNamespace: true + namespace: test-defaults diff --git a/docs/modules/ROOT/pages/explanations/.gitkeep b/tests/golden/defaults/defaults/apps/defaults.yaml similarity index 100% rename from docs/modules/ROOT/pages/explanations/.gitkeep rename to tests/golden/defaults/defaults/apps/defaults.yaml diff --git a/tests/golden/defaults/defaults/defaults/test-helm-chart/00_namespace.yaml b/tests/golden/defaults/defaults/defaults/test-helm-chart/00_namespace.yaml new file mode 100644 index 0000000..707c6cf --- /dev/null +++ b/tests/golden/defaults/defaults/defaults/test-helm-chart/00_namespace.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Namespace +metadata: + annotations: + syn.tools/source: https://github.com/appuio/component-helm-chart + labels: + component: helm-chart + instance: defaults + name: test-defaults + name: test-defaults diff --git a/tests/golden/defaults/defaults/defaults/test-helm-chart/test-helm-chart/templates/configmap.yaml b/tests/golden/defaults/defaults/defaults/test-helm-chart/test-helm-chart/templates/configmap.yaml new file mode 100644 index 0000000..5d5571f --- /dev/null +++ b/tests/golden/defaults/defaults/defaults/test-helm-chart/test-helm-chart/templates/configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +data: + values: |2 + + foo: bar + from_parameters: "yes" +kind: ConfigMap +metadata: + name: test-helm-chart diff --git a/docs/modules/ROOT/pages/how-tos/.gitkeep b/tests/golden/with_values/with_values/apps/with_values.yaml similarity index 100% rename from docs/modules/ROOT/pages/how-tos/.gitkeep rename to tests/golden/with_values/with_values/apps/with_values.yaml diff --git a/tests/golden/with_values/with_values/with_values/test-helm-chart/test-helm-chart/templates/configmap.yaml b/tests/golden/with_values/with_values/with_values/test-helm-chart/test-helm-chart/templates/configmap.yaml new file mode 100644 index 0000000..9d18cb0 --- /dev/null +++ b/tests/golden/with_values/with_values/with_values/test-helm-chart/test-helm-chart/templates/configmap.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +data: + values: |2 + + foo: from-with-values + nested: + key: value +kind: ConfigMap +metadata: + name: test-helm-chart diff --git a/tests/with_values.yml b/tests/with_values.yml new file mode 100644 index 0000000..1b0093d --- /dev/null +++ b/tests/with_values.yml @@ -0,0 +1,8 @@ +parameters: + with_values: + helm_values: + foo: from-with-values + nested: + key: value + createNamespace: false + namespace: test-with-values