Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zugao committed Jan 5, 2022
0 parents commit 1b84e83
Show file tree
Hide file tree
Showing 31 changed files with 498 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
; 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

# Don't check for trailing newlines in golden tests output
[tests/golden/**]
insert_final_newline = unset
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/01_bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
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
<!-- Tell us how to reproduce your issue -->

1.
1.
1.

## Actual Behavior
<!-- What did happen as a result of the above? -->

## Expected Behavior
<!-- What is your expectation of the result? -->
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/02_feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
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?
Is it something you currently cannot do?
Is this related to an issue/problem?
-->

## Alternatives
<!--
Can you achieve the same result doing it in an alternative way?
Is the alternative considerable?
-->
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: ❓ Help and Support RocketChat Channel
url: https://community.appuio.ch
about: Please ask and answer questions here. 🏥
22 changes: 22 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@



## Checklist

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

<!--
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.
-->
32 changes: 32 additions & 0 deletions .github/changelog-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

{
"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:
build:
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 }}
59 changes: 59 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Pull Request
on:
pull_request:
branches:
- master

env:
COMPONENT_NAME: openshift4-keepalived

jobs:
linting:
runs-on: ubuntu-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/eclint@v1.0.1
with:
args: 'check'
test:
runs-on: ubuntu-latest
strategy:
matrix:
instance:
- defaults
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
steps:
- uses: actions/checkout@v2
with:
path: ${{ env.COMPONENT_NAME }}
- name: Compile component
run: make test -e instance=${{ matrix.instance }}
golden:
runs-on: ubuntu-latest
strategy:
matrix:
instance:
- defaults
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
steps:
- uses: actions/checkout@v2
with:
path: ${{ env.COMPONENT_NAME }}
- name: Golden diff
run: make golden-diff -e instance=${{ matrix.instance }}
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Commodore
.cache/
helmcharts/
manifests/
vendor/
jsonnetfile.lock.json
crds/
compiled/

# Antora
_archive/
_public/

# Additional entries
15 changes: 15 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
:global:
componentName: openshift4-keepalived
githubUrl: https://github.com/appuio/component-openshift4-keepalived
feature_goldenTests: true

docs/antora.yml:
name: openshift4-keepalived
title: openshift4-keepalived
.github/workflows/test.yaml:
test_makeTarget: test -e instance=${{ matrix.instance }}
goldenTest_makeTarget: golden-diff -e instance=${{ matrix.instance }}
matrix:
key: instance
entries:
- defaults
14 changes: 14 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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/
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.
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# How to contribute

This code repository is part of Project Syn and the contribution guide at
https://syn.tools/syn/about/contribution_guide.html does apply.

Submit Pull Requests at https://github.com/appuio/component-openshift4-keepalived/pulls.
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2022, VSHN AG <info@vshn.ch>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:

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 ## All-in-one linting

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

.PHONY: lint_yaml
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 ## All-in-one formatting

.PHONY: format_jsonnet
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: 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: clean
clean: ## Clean the project
rm -rf compiled dependencies vendor helmcharts jsonnetfile*.json || true
Loading

0 comments on commit 1b84e83

Please sign in to comment.