Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
glrf committed Oct 4, 2021
0 parents commit ed68eeb
Show file tree
Hide file tree
Showing 30 changed files with 433 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
; 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
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. 🏥
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
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 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.

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

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'
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
_archive/
_public/
.cache/
helmcharts/
manifests/
vendor/
jsonnetfile.lock.json
7 changes: 7 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:global:
componentName: group-sync-operator
githubUrl: https://github.com/appuio/component-group-sync-operator

docs/antora.yml:
name: group-sync-operator
title: group-sync-operator
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-group-sync-operator/pulls.
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2021, 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.
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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 --search-paths ./dependencies
test: .compile ## Compile the component

.PHONY: clean
clean: ## Clean the project
rm -rf compiled dependencies vendor helmcharts jsonnetfile*.json || true
29 changes: 29 additions & 0 deletions Makefile.vars.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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)"

DOCKER_CMD ?= docker
DOCKER_ARGS ?= run --rm -u "$$(id -u)" -w /$(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 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

COMMODORE_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) projectsyn/commodore:latest component compile . $(commodore_args)
JB_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) --entrypoint /usr/local/bin/jb projectsyn/commodore:latest install

instance ?= defaults
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Commodore Component: group-sync-operator

This is a [Commodore][commodore] Component for group-sync-operator.

This repository is part of Project Syn.
For documentation on Project Syn and this component, see https://syn.tools.

## 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.

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.

## Contributing and license

This library is licensed under [BSD-3-Clause](LICENSE).
For information about how to contribute see [CONTRIBUTING](CONTRIBUTING.md).

[commodore]: https://docs.syn.tools/commodore/index.html
[asciidoc]: https://asciidoctor.org/
[antora]: https://antora.org/
4 changes: 4 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
group_sync_operator:
=_metadata: {}
namespace: syn-group-sync-operator
11 changes: 11 additions & 0 deletions class/group-sync-operator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
kapitan:
compile:
- input_paths:
- group-sync-operator/component/app.jsonnet
input_type: jsonnet
output_path: apps/
- input_paths:
- group-sync-operator/component/main.jsonnet
input_type: jsonnet
output_path: group-sync-operator/
10 changes: 10 additions & 0 deletions component/app.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local kap = import 'lib/kapitan.libjsonnet';
local inv = kap.inventory();
local params = inv.parameters.group_sync_operator;
local argocd = import 'lib/argocd.libjsonnet';

local app = argocd.App('group-sync-operator', params.namespace);

{
'group-sync-operator': app,
}
Loading

0 comments on commit ed68eeb

Please sign in to comment.