Skip to content

Commit

Permalink
Merge pull request #7 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 777aec4 + 038d628 commit 0c9fe81
Show file tree
Hide file tree
Showing 18 changed files with 271 additions and 63 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
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/01_bug_report.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
name: 🐜 Bug report
about: Create a report to help us improve 🔧

labels: bug
---

<!-- Place a general description or your issue here. -->

## Steps to Reproduce the Problem
Expand Down
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/02_feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: 🚀 Feature request
about: Suggest an idea for this project 💡

labels: enhancement
---


## Context
<!--
Please let us know what you are trying to do and how you would want to do it differently?
Expand Down
28 changes: 17 additions & 11 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,16 +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
- [ ] update documentation
- [ ] update ./CHANGELOG.md
- [ ] link this PR to related issues
- [ ] PR contains a single logical change (to build a better changelog).
- [ ] Update the documentation.
- [ ] 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 / while the PR is open._ -->
<!--
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 }}
24 changes: 22 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,37 @@ on:
branches:
- master

env:
COMPONENT_NAME: metrics-server

jobs:
linting:
runs-on: ubuntu-latest
container:
image: docker.io/projectsyn/commodore-component-test:latest
strategy:
matrix:
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: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
manifests/
#
# 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
18 changes: 18 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +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/
14 changes: 0 additions & 14 deletions CHANGELOG.md

This file was deleted.

4 changes: 4 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Code of Conduct

This code repository is part of Project Syn and the code of conduct at
https://syn.tools/syn/about/code_of_conduct.html does apply.
23 changes: 3 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
# How to contribute

We are really glad you're reading this, because we need volunteer developers to
help this project come to fruition.
This code repository is part of Project Syn and the contribution guide at
https://syn.tools/syn/about/contribution_guide.html does apply.

If you haven't already, come find us at https://community.appuio.ch. We want
you working on things you're excited about.

Here are some important resources:

* [Project Syn](https://syn.tools)

## Submitting changes

Please submit a [Pull Request at GitHub][PR] with a clear list of what you've
done (read more about [pull requests](http://help.github.com/pull-requests/)).

## Coding conventions

We are using `jsonnetfmt` and `yamllint` to ensure consistency. The
[Makefile](Makefile) provides targets to invoke them.

[PR]: https://github.com/projectsyn/component-metrics-server/pulls
Submit Pull Requests at https://github.com/projectsyn/component-metrics-server/pulls.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 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
50 changes: 39 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +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:

FILES_JSONNET ?= $(shell find . -type f -name '*.*jsonnet' -or -name '*.libsonnet')
FILES_YAML ?= $(shell find . -type f -name '*.yaml' -or -name '*.yml')
include Makefile.vars.mk

JSONNETFMT_ARGS ?= --in-place
.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: lint_jsonnet lint_yaml lint_adoc ## All-in-one linting

.PHONY: lint_jsonnet
lint_jsonnet: $(FILES_JSONNET)
jsonnetfmt $(JSONNETFMT_ARGS) --test -- $?
lint_jsonnet: $(JSONNET_FILES) ## Lint jsonnet files
$(JSONNET_DOCKER) $(JSONNETFMT_ARGS) --test -- $?

.PHONY: lint_yaml
lint_yaml: $(FILES_YAML)
yamllint -f parsable -c .yamllint.yaml --no-warnings -- $?
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: format
format: format_jsonnet
format: format_jsonnet ## All-in-one formatting

.PHONY: format_jsonnet
format_jsonnet: $(FILES_JSONNET)
jsonnetfmt $(JSONNETFMT_ARGS) -- $?
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
Loading

0 comments on commit 0c9fe81

Please sign in to comment.