Skip to content

Commit

Permalink
Implemented RegisterClaimIntent (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchmidt authored Jun 12, 2024
1 parent 4d059ae commit 24547b6
Show file tree
Hide file tree
Showing 37 changed files with 1,193 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "C# (.NET)",
"image": "mcr.microsoft.com/devcontainers/dotnet:1.1.6-8.0-jammy",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/mpriscella/features/kind:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "make restore",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig",
"ms-dotnettools.csdevkit",
"ryanluker.vscode-coverage-gutters",
"DotJoshJohnson.xml",
"zxh404.vscode-proto3",
"bierner.markdown-footnotes",
"bierner.markdown-mermaid",
"ms-vscode.makefile-tools"
],
"settings": {
"editor.formatOnSave": true
}
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "vscode"
}
23 changes: 23 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
changelog:
exclude:
labels:
- ci # exclude ci, not part of the product.
categories:
- title: Breaking changes
labels:
- breaking change
- title: New features
labels:
- enhancement
- title: Bug fixes
labels:
- bug
- title: Documentation
labels:
- documentation
- title: Dependency Updates
labels:
- dependencies
- title: Other Changes
labels:
- "*"
17 changes: 17 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": [
"github>project-origin/.github:renovate-defaults.json"
],
"customManagers": [
{
"customType": "regex",
"fileMatch": [
".csproj$"
],
"matchStrings": [
"<SourceUrl>https:\/\/raw.githubusercontent.com\/(?<depName>.+)\/(?<currentValue>v[^\/]+).+<\/SourceUrl>"
],
"datasourceTemplate": "github-releases"
}
]
}
28 changes: 28 additions & 0 deletions .github/workflows/pullrequest-verify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Verifies PR are ready for merge

on:
pull_request:
branches:
- main

jobs:
verify-devcontainer:
uses: project-origin/.github/.github/workflows/reusable-verify-devcontainer.yaml@5f308f6499ed423ed1252156296e18be614202de

verify-code:
uses: project-origin/.github/.github/workflows/reusable-verify-code.yaml@5f308f6499ed423ed1252156296e18be614202de

verify-renovate-config:
uses: project-origin/.github/.github/workflows/reusable-verify-renovate.yaml@5f308f6499ed423ed1252156296e18be614202de

verify-chart:
uses: project-origin/.github/.github/workflows/reusable-verify-chart.yaml@5f308f6499ed423ed1252156296e18be614202de

verify-container-build:
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@5f308f6499ed423ed1252156296e18be614202de
with:
imagename: ghcr.io/project-origin/chronicler
version: test
context: ./src
dockerfile: ./src/Chronicler.Dockerfile
push: false
32 changes: 32 additions & 0 deletions .github/workflows/release-published.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build release artifacts

on:
release:
types: [published]

jobs:
define-version:
uses: project-origin/.github/.github/workflows/reusable-tag-version.yaml@5f308f6499ed423ed1252156296e18be614202de

publish-container:
needs:
- define-version
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@5f308f6499ed423ed1252156296e18be614202de
with:
imagename: ghcr.io/project-origin/chronicler
version: ${{ needs.define-version.outputs.version }}
context: ./src
dockerfile: ./src/Chronicler.Dockerfile
push: true

publish-chart:
needs:
- define-version
- publish-container
uses: project-origin/.github/.github/workflows/reusable-publish-chart.yaml@5f308f6499ed423ed1252156296e18be614202de
with:
version: ${{ needs.define-version.outputs.version }}
chart_folder: chart
helm_registry_repository: project-origin/helm-registry
secrets:
helm_registry_token: ${{ secrets.HELM_REGISTRY_TOKEN }}
15 changes: 15 additions & 0 deletions .github/workflows/sonarcloud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: SonarCloud

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
analyse:
uses: project-origin/.github/.github/workflows/reusable-sonarcloud.yaml@5f308f6499ed423ed1252156296e18be614202de
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
src_path := src

docfx_config := doc/docfx.json
docfx_site_dir := doc/_site

formatting_header := \033[1m
formatting_command := \033[1;34m
formatting_desc := \033[0;32m
formatting_none := \033[0m

.PHONY: help test clean build lint

.DEFAULT_GOAL := help

## Show help for each of the Makefile recipes.
help:
@printf "${formatting_header}Available targets:\n"
@awk -F '## ' '/^## /{desc=$$2}/^[a-zA-Z0-9][a-zA-Z0-9_-]+:/{gsub(/:.*/, "", $$1); printf " ${formatting_command}%-20s ${formatting_desc}%s${formatting_none}\n", $$1, desc}' $(MAKEFILE_LIST) | sort
@printf "\n"

## Verify code is ready for commit to branch, runs tests and verifies formatting.
verify: build test lint
@echo "Code is ready to commit."

## Prints dotnet info
info:
@echo "Print info and version"
dotnet --info
dotnet --version

## Lint the dotnet code
lint:
@echo "Verifying code formatting..."
dotnet format $(src_path) --verify-no-changes

## Does a dotnet clean
clean:
dotnet clean $(src_path)

## Restores all dotnet projects
restore:
dotnet tool restore --tool-manifest src/.config/dotnet-tools.json
dotnet restore $(src_path)

## Builds all the code
build: restore
dotnet build --no-restore $(src_path)

## Formats files using dotnet format
format:
dotnet format $(src_path)

## Run all tests
test: build
dotnet test --no-build $(src_path)

## Tests run with the sonarcloud analyser
sonarcloud-test:
dotnet test --no-build $(src_path)

## Run all Unit-tests
unit-test:
dotnet test $(src_path) --filter 'FullyQualifiedName!~IntegrationTests'

## Builds the local container, creates kind cluster and installs chart, and verifies it works
verify-chart:
@kind version >/dev/null 2>&1 || { echo >&2 "kind not installed! kind is required to use recipe, please install or use devcontainer"; exit 1;}
@helm version >/dev/null 2>&1 || { echo >&2 "helm not installed! helm is required to use recipe, please install or use devcontainer"; exit 1;}
chart/run_kind_test.sh
23 changes: 23 additions & 0 deletions chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
15 changes: 15 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: project-origin-chronicler
description: A helm chart for deploying the Project Origin Chronicler
type: application
version: 0.1.0
appVersion: "0.1.0"

annotations:
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/licence: Apache-2.0
artifacthub.io/links: |
- name: Source Code
url: https://github.com/project-origin/chronicler
artifacthub.io/prerelease: "false"
artifacthub.io/operator: "false"
3 changes: 3 additions & 0 deletions chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Project Origin Chronicler

This Helm chart enables one to install the Project Origin Chronicler.
47 changes: 47 additions & 0 deletions chart/run_kind_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# This script is used to test the chronicler chart using kind.
# It installs the chart and validates it starts up correctly.

# Define kind cluster name
cluster_name=chronicler-test

# Ensures script fails if something goes wrong.
set -eo pipefail

# cleanup - delete temp_folder and cluster
trap 'rm -fr $temp_folder; kind delete cluster -n ${cluster_name} >/dev/null 2>&1' 0

# define variables
temp_folder=$(mktemp -d)
values_filename=${temp_folder}/values.yaml

# create kind cluster
kind delete cluster -n ${cluster_name}
kind create cluster -n ${cluster_name}

# install rabbitmq-operator
kubectl apply -f "https://github.com/rabbitmq/cluster-operator/releases/download/v2.5.0/cluster-operator.yml"

# install cnpg-operator
helm install cnpg-operator cloudnative-pg --repo https://cloudnative-pg.io/charts --version 0.18.0 --namespace cnpg --create-namespace --wait

# build docker image
docker build -f src/Chronicler.Dockerfile -t ghcr.io/project-origin/chronicler:test src/

# load docker image into cluster
kind load -n ${cluster_name} docker-image ghcr.io/project-origin/chronicler:test

# generate values.yaml file
cat << EOF > "${values_filename}"
image:
tag: test
messageBroker:
type: rabbitmqOperator
EOF

# install chronicler chart
helm install chronicler ./chart --values ${values_filename} --namespace chronicler --create-namespace --wait

echo "Test completed successfully ✅"
18 changes: 18 additions & 0 deletions chart/templates/cnpg-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
{{- if and (eq .Values.persistence.type "CloudNativePG") }}
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: {{ .Values.persistence.cloudNativePG.name }}
namespace: {{ .Release.Namespace }}
spec:
instances: {{ .Values.persistence.cloudNativePG.replicas }}
storage:
size: {{ .Values.persistence.cloudNativePG.size }}
bootstrap:
initdb:
database: {{ .Values.persistence.cloudNativePG.database }}
owner: {{ .Values.persistence.cloudNativePG.owner }}
monitoring:
enablePodMonitor: true
{{- end }}
Loading

0 comments on commit 24547b6

Please sign in to comment.