Skip to content

Commit

Permalink
Merge pull request #11 from projectsyn/modulesync-17389b2
Browse files Browse the repository at this point in the history
[ModuleSync] Update from projectsyn/modulesync-control@17389b2
  • Loading branch information
simu authored Jan 19, 2022
2 parents 3ed518b + dbc1662 commit 2d893e6
Show file tree
Hide file tree
Showing 16 changed files with 244 additions and 68 deletions.
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
25 changes: 13 additions & 12 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<!--
Thank you for your pull request. Please provide a description above and
review the checklist below.

Contributors guide: ./CONTRIBUTING.md
-->


## Checklist
<!--
Remove items that do not apply. For completed items, change [ ] to [x].
-->

- [ ] 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.

<!--
NOTE: these things are not required to open a PR and can be done afterwards,
Thank you for your pull request. Please provide a description above and
review the checklist.
Contributors guide: ./CONTRIBUTING.md
Remove items that do not apply. For completed items, change [ ] to [x].
These things are not required to open a PR and can be done afterwards,
while the PR is open.
-->
30 changes: 30 additions & 0 deletions .github/changelog-configuration.json
Original file line number Diff line number Diff line change
@@ -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}}"
}
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
branches:
- master

env:
COMPONENT_NAME: storageclass

jobs:
linting:
runs-on: ubuntu-latest
Expand All @@ -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/[email protected]
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
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#
# File managed by ModuleSync - Do Not Edit
#

extends: default

rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length:
max: 80
level: warning

ignore: |
dependencies/
helmcharts/
manifests/
vendor/
compiled/
29 changes: 0 additions & 29 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020, VSHN AG <[email protected]>
Copyright 2021, VSHN AG <[email protected]>
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
57 changes: 34 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,49 +1,60 @@
#
# 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
.DEFAULT_GOAL := all
.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
36 changes: 36 additions & 0 deletions Makefile.vars.mk
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 6 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extends": [
"config:base"
"config:base",
":gitSignOff",
":disableDependencyDashboard"
],
"labels": [
"dependency"
]
}
Loading

0 comments on commit 2d893e6

Please sign in to comment.