From 5dab18301599dde7c3ec84ad94e421e7a6595c5f Mon Sep 17 00:00:00 2001 From: simu Date: Wed, 19 Jan 2022 12:03:11 +0000 Subject: [PATCH 1/2] Update from projectsyn/modulesync-control --- .editorconfig | 29 ++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 25 ++++++------ .github/changelog-configuration.json | 30 +++++++++++++++ .github/workflows/release.yaml | 32 ++++++++++++++++ .github/workflows/test.yaml | 22 +++++++++++ .gitignore | 20 ++++++++++ .yamllint.yml | 11 ++++++ CHANGELOG.md | 29 -------------- CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 2 +- LICENSE | 2 +- Makefile | 57 +++++++++++++++++----------- Makefile.vars.mk | 36 ++++++++++++++++++ docs/antora.yml | 6 +++ renovate.json | 7 +++- 15 files changed, 242 insertions(+), 68 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/changelog-configuration.json create mode 100644 .github/workflows/release.yaml create mode 100644 .gitignore delete mode 100644 CHANGELOG.md create mode 100644 Makefile.vars.mk diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..56b9042 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,29 @@ +; +; File managed by ModuleSync - Do Not Edit +; +; This file is for unifying the coding style for different editors and IDEs. +; More information at https://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{y*ml,*json}] +indent_style = space +indent_size = 2 + +[*.*sonnet] +# C-style doc comments +block_comment_start = /* +block_comment = * +block_comment_end = */ + +[.gitkeep] +insert_final_newline = false + +[Makefile] +indent_style = tab diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7197a98..594cbbe 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,21 +1,22 @@ - + ## Checklist - -- [ ] Keep pull requests small so they can be easily reviewed. +- [ ] PR contains a single logical change (to build a better changelog). - [ ] Update the documentation. -- [ ] Update the ./CHANGELOG.md. -- [ ] Link this PR to related issues. +- [ ] Categorize the PR by setting a good title and adding one of the labels: + `bug`, `enhancement`, `documentation`, `change`, `breaking`, `dependency` + as they show up in the changelog. +- [ ] Link this PR to related issues or PRs. diff --git a/.github/changelog-configuration.json b/.github/changelog-configuration.json new file mode 100644 index 0000000..56a090f --- /dev/null +++ b/.github/changelog-configuration.json @@ -0,0 +1,30 @@ +{ + "pr_template": "- ${{TITLE}} (#${{NUMBER}})", + "categories": [ + { + "title": "## 🚀 Features", + "labels": ["enhancement", "feature"] + }, + { + "title": "## 🛠️ Minor Changes", + "labels": ["change"] + }, + { + "title": "## 🔎 Breaking Changes", + "labels": ["breaking"] + }, + { + "title": "## 🐛 Fixes", + "labels": ["bug", "fix"] + }, + { + "title": "## 📄 Documentation", + "labels": ["documentation"] + }, + { + "title": "## 🔗 Dependency Updates", + "labels": ["dependency"] + } + ], + "template": "${{CATEGORIZED_COUNT}} changes since ${{FROM_TAG}}\n\n${{CHANGELOG}}" +} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c51d842 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: Release +on: + push: + tags: + - v* + +jobs: + dist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: "0" + - name: Build changelog from PRs with labels + id: build_changelog + uses: mikepenz/release-changelog-builder-action@v2 + with: + configuration: ".github/changelog-configuration.json" + # PreReleases still get a changelog, but the next full release gets a diff since the last full release, + # combining possible changelogs of all previous PreReleases in between. + # PreReleases show a partial changelog since last PreRelease. + ignorePreReleases: "${{ !contains(github.ref, '-rc') }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + uses: ncipollo/release-action@v1 + with: + body: ${{steps.build_changelog.outputs.changelog}} + prerelease: "${{ contains(github.ref, '-rc') }}" + # Ensure target branch for release is "master" + commit: master + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 35909d1..a693049 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,6 +4,9 @@ on: branches: - master +env: + COMPONENT_NAME: storageclass + jobs: linting: runs-on: ubuntu-latest @@ -12,7 +15,26 @@ jobs: command: - lint_jsonnet - lint_yaml + - lint_adoc steps: - uses: actions/checkout@v2 - name: Run ${{ matrix.command }} run: make ${{ matrix.command }} + editorconfig: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: snow-actions/eclint@v1.0.1 + with: + args: 'check' + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ env.COMPONENT_NAME }} + steps: + - uses: actions/checkout@v2 + with: + path: ${{ env.COMPONENT_NAME }} + - name: Compile component + run: make test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b057600 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# +# File managed by ModuleSync - Do Not Edit +# +# Additional entries can be added to `.sync.yml` in '.gitignore.additionalEntries' +# + +# Commodore +.cache/ +helmcharts/ +manifests/ +vendor/ +jsonnetfile.lock.json +crds/ +compiled/ + +# Antora +_archive/ +_public/ + +# Additional entries diff --git a/.yamllint.yml b/.yamllint.yml index addf0aa..22e2862 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -1,3 +1,7 @@ +# +# File managed by ModuleSync - Do Not Edit +# + extends: default rules: @@ -5,3 +9,10 @@ rules: line-length: max: 80 level: warning + +ignore: | + dependencies/ + helmcharts/ + manifests/ + vendor/ + compiled/ diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 70a7dcf..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,29 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] -### Added - -- Initial implementation ([#1]) - -### Changed - -- Component name ([#2]) -- Disable Kapitan plugin ([#4]) -- Non-default StorageClasses have their "is-default-class" annotation removed ([#7]) - -### Fixed - -- Keep the empty manifest directory ([#3]) -- Deep-merging of StorageClass overrides ([#6]) - -[Unreleased]: https://github.com/projectsyn/component-storageclass/compare/76db758a57b9dc33b95abf0a1bd7a21ce1ac185a...HEAD -[#1]: https://github.com/projectsyn/component-storageclass/pull/1 -[#2]: https://github.com/projectsyn/component-storageclass/pull/2 -[#3]: https://github.com/projectsyn/component-storageclass/pull/3 -[#4]: https://github.com/projectsyn/component-storageclass/pull/4 -[#6]: https://github.com/projectsyn/component-storageclass/pull/6 -[#7]: https://github.com/projectsyn/component-storageclass/pull/7 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 36d9baa..a7f4366 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,4 +1,4 @@ # Code of Conduct This code repository is part of Project Syn and the code of conduct at -https://syn.tools/syn/code_of_conduct.html does apply. +https://syn.tools/syn/about/code_of_conduct.html does apply. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d69c5cf..dab76ef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # How to contribute This code repository is part of Project Syn and the contribution guide at -https://syn.tools/syn/contribution_guide.html does apply. +https://syn.tools/syn/about/contribution_guide.html does apply. Submit Pull Requests at https://github.com/projectsyn/component-storageclass/pulls. diff --git a/LICENSE b/LICENSE index c38ddf1..34a84ef 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2020, VSHN AG +Copyright 2021, VSHN AG All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Makefile b/Makefile index b98bd2f..3ea0c03 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,9 @@ +# +# File managed by ModuleSync - Do Not Edit +# +# Additional Makefiles can be added to `.sync.yml` in 'Makefile.includes' +# + MAKEFLAGS += --warn-undefined-variables SHELL := bash .SHELLFLAGS := -eu -o pipefail -c @@ -5,45 +11,50 @@ SHELL := bash .DELETE_ON_ERROR: .SUFFIXES: -DOCKER_CMD ?= docker -DOCKER_ARGS ?= run --rm --user "$$(id -u)" -v "$${PWD}:/component" --workdir /component - -JSONNET_FILES ?= $(shell find . -type f -name '*.*jsonnet' -or -name '*.libsonnet') -JSONNETFMT_ARGS ?= --in-place -JSONNET_IMAGE ?= docker.io/bitnami/jsonnet:latest -JSONNET_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) --entrypoint=jsonnetfmt $(JSONNET_IMAGE) - -YAML_FILES ?= $(shell find . -type f -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 +include Makefile.vars.mk +.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 .PHONY: lint -lint: lint_jsonnet lint_yaml lint_adoc +lint: lint_jsonnet lint_yaml lint_adoc ## 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_adoc: ## Lint documentation $(VALE_CMD) $(VALE_ARGS) .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: ## Preview the documentation + $(ANTORA_PREVIEW_CMD) + +.PHONY: compile +.compile: + mkdir -p dependencies + $(COMMODORE_CMD) + +.PHONY: test +test: commodore_args += -f tests/$(instance).yml +test: .compile ## Compile the component + +.PHONY: clean +clean: ## Clean the project + rm -rf .cache compiled dependencies vendor helmcharts jsonnetfile*.json || true diff --git a/Makefile.vars.mk b/Makefile.vars.mk new file mode 100644 index 0000000..3204e79 --- /dev/null +++ b/Makefile.vars.mk @@ -0,0 +1,36 @@ +# +# File managed by ModuleSync - Do Not Edit +# +# Additional Makefiles can be added to `.sync.yml` in 'Makefile.includes' +# + +# Commodore takes the root dir name as the component name +COMPONENT_NAME ?= $(shell basename ${PWD} | sed s/component-//) + +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 ./dependencies --search-paths . + +DOCKER_CMD ?= docker +DOCKER_ARGS ?= run --rm -u "$$(id -u):$$(id -g)" -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 ?= docker.io/bitnami/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 docker.io/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 docker.io/vshn/antora-preview:2.3.3 --style=syn --antora=docs + +COMMODORE_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) docker.io/projectsyn/commodore:latest component compile . $(commodore_args) +JB_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) --entrypoint /usr/local/bin/jb docker.io/projectsyn/commodore:latest install + +instance ?= defaults diff --git a/docs/antora.yml b/docs/antora.yml index 620b504..5d12c96 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -1,3 +1,9 @@ +# +# File managed by ModuleSync - Do Not Edit +# +# The name and title can be customized in `.sync.yml` with `'docs/antora.yml'.title`, `'docs/antora.yml'.name` +# + name: storageclass title: StorageClass version: master diff --git a/renovate.json b/renovate.json index f45d8f1..b6651c3 100644 --- a/renovate.json +++ b/renovate.json @@ -1,5 +1,10 @@ { "extends": [ - "config:base" + "config:base", + ":gitSignOff", + ":disableDependencyDashboard" + ], + "labels": [ + "dependency" ] } From dbc16623b62727e69efa3b0134865d97e339511c Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Wed, 19 Jan 2022 13:08:00 +0100 Subject: [PATCH 2/2] Add tests/defaults.yml --- tests/defaults.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/defaults.yml diff --git a/tests/defaults.yml b/tests/defaults.yml new file mode 100644 index 0000000..9bfd9d0 --- /dev/null +++ b/tests/defaults.yml @@ -0,0 +1,2 @@ +parameters: + storageclass: {}