Skip to content

Commit 6a19343

Browse files
committed
feat: initial commit
1 parent 8874b57 commit 6a19343

25 files changed

+1261
-0
lines changed

.github/cr.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
generate-release-notes: true
2+
release-name-template: "v{{ .Version }}"

.github/ct.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# See https://github.com/helm/chart-testing#configuration
2+
chart-dirs: charts
3+
check-version-increment: false
4+
debug: false
5+
remote: origin
6+
target-branch: main
7+
upgrade: true
8+
validate-chart-schema: true
9+
validate-maintainers: false
10+
validate-yaml: true

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: monthly
7+
open-pull-requests-limit: 10
8+
labels:
9+
- enhancement
10+
- dependency-management
11+
groups:
12+
github-actions:
13+
patterns:
14+
- "*"

.github/workflows/auto-assign.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Auto-assign Issue
2+
on:
3+
issues:
4+
types: [opened]
5+
pull_request_target:
6+
types: [opened, ready_for_review]
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
pull-requests: write
13+
14+
steps:
15+
- name: 'auto-assign issue'
16+
uses: pozil/auto-assign-issue@v2
17+
with:
18+
repo-token: ${{ secrets.PAT_GITHUB }}
19+
teams: devops-ia

.github/workflows/lint-test.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Lint and Test Charts
2+
3+
on: pull_request
4+
5+
jobs:
6+
lint-test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
14+
# default install latest (stable)
15+
- name: Set up Helm
16+
uses: azure/setup-helm@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: 3.x
21+
check-latest: true
22+
23+
- name: Set up chart-testing
24+
uses: helm/chart-testing-action@v2
25+
26+
- name: Run chart-testing (list-changed)
27+
id: list-changed
28+
run: |
29+
changed=$(ct list-changed --config .github/ct.yaml)
30+
if [[ -n "${changed}" ]]; then
31+
echo "changed=true" >> "$GITHUB_OUTPUT"
32+
fi
33+
34+
- name: Run chart-testing (lint)
35+
if: steps.list-changed.outputs.changed == 'true'
36+
run: ct lint --config .github/ct.yaml
37+
38+
# TODO: uncomment when we've self-managed nodes
39+
# - name: Create kind cluster
40+
# if: steps.list-changed.outputs.changed == 'true'
41+
# uses: helm/kind-action@v1
42+
43+
# - name: Run chart-testing (install)
44+
# if: steps.list-changed.outputs.changed == 'true'
45+
# run: ct install --config ct.yaml

.github/workflows/release.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Release mongodb-community-database chart
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- "charts/mongodb-community-database/**"
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: write
17+
packages: write
18+
id-token: write
19+
20+
steps:
21+
- name: Checkout Code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Configure Git
27+
run: |
28+
git config user.name "$GITHUB_ACTOR"
29+
git config user.email "[email protected]"
30+
31+
- name: Semantic Release
32+
uses: cycjimmy/semantic-release-action@v4
33+
id: semantic_release
34+
with:
35+
dry_run: true
36+
branch: main
37+
tag_format: ${version}
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Update Chart version
42+
id: chart_version
43+
if: steps.semantic_release.outputs.new_release_published == 'true'
44+
run: |
45+
sed -i 's/^version: .*/version: ${{ steps.semantic_release.outputs.new_release_git_tag }}/g' charts/mongodb-community-database/Chart.yaml
46+
echo "CHART_VERSION=${{ steps.semantic_release.outputs.new_release_git_tag }}" >> $GITHUB_OUTPUT
47+
48+
- name: Check if tag exists
49+
id: tag_exists
50+
if: steps.semantic_release.outputs.new_release_published == 'true'
51+
run: |
52+
TAG_EXISTS=true
53+
if ! [ $(git tag -l "v${{ steps.chart_version.outputs.CHART_VERSION }}") ]; then
54+
TAG_EXISTS=false
55+
fi
56+
echo TAG_EXISTS=$TAG_EXISTS >> $GITHUB_OUTPUT
57+
58+
- name: Run chart-releaser
59+
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
60+
uses: helm/[email protected]
61+
with:
62+
charts_dir: charts
63+
config: .github/cr.yaml
64+
env:
65+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
66+
CR_SKIP_EXISTING: true
67+
68+
- name: Login in to the Container registry
69+
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
70+
uses: docker/login-action@v3
71+
with:
72+
registry: ghcr.io
73+
username: ${{ github.actor }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Install Cosign
77+
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
78+
uses: sigstore/cosign-installer@v3
79+
80+
- name: Install Oras
81+
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
82+
uses: oras-project/setup-oras@v1
83+
84+
# ref: https://github.com/backstage/charts/blob/88240ce7a0726e3773ee0e4866fbe6325c15267b/.github/workflows/release.yml#L50
85+
- name: Publish and Sign OCI Charts
86+
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
87+
run: |
88+
for chart in `find .cr-release-packages -name '*.tgz' -print`; do
89+
helm push ${chart} oci://ghcr.io/${GITHUB_REPOSITORY} |& tee helm-push-output.log
90+
file_name=${chart##*/}
91+
chart_name=${file_name%-*}
92+
digest=$(awk -F "[, ]+" '/Digest/{print $NF}' < helm-push-output.log)
93+
cosign sign -y "ghcr.io/${GITHUB_REPOSITORY}/${chart_name}@${digest}"
94+
95+
oras push "ghcr.io/${GITHUB_REPOSITORY}/${chart_name}:artifacthub.io" "./charts/${chart_name}/artifacthub-repo.yml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml"
96+
done
97+
env:
98+
COSIGN_EXPERIMENTAL: 1

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.tgz
2+
Chart.lock

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-added-large-files
8+
- id: check-merge-conflict
9+
10+
- repo: https://github.com/gruntwork-io/pre-commit
11+
rev: v0.1.28
12+
hooks:
13+
- id: helmlint
14+
15+
- repo: https://github.com/norwoodj/helm-docs
16+
rev: v1.14.2
17+
hooks:
18+
- id: helm-docs
19+
args:
20+
- --chart-search-root=.
21+
- --template-files=README.md.gotmpl
22+
23+
- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
24+
rev: v1.1.2
25+
hooks:
26+
- id: markdown-toc
27+
args: [--maxdepth, "3", -i]
28+
files: ^README\.md$

CONTRIBUTING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# How to contribute to mongodb-database-community Helm Chart
2+
3+
This document provides guidelines for contributing to the *mongodb-database-community Helm Chart* project.
4+
5+
## How can I contribute?
6+
7+
### Did you find a bug?
8+
9+
* **Ensure the bug has not already been reported** by searching on GitHub under [Issues](https://github.com/devops-ia/helm-mongodb-community-database/issues).
10+
* If you cannot find an open issue addressing the problem, [open a new one](https://github.com/devops-ia/helm-mongodb-community-database/issues/new). Include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the unexpected behavior.
11+
* Use the relevant bug report templates to create the issue, if available.
12+
13+
### Do you intend to add a new feature or change an existing one?
14+
15+
* Please discuss first ([open an issue](https://github.com/devops-ia/helm-mongodb-community-database/issues)) before starting any significant pull request (e.g., implementing features, refactoring code) to avoid spending time on something that might not be merged.
16+
* Adhere to the project's coding conventions (indentation, accurate comments, etc.) and any other requirements (such as test coverage, documentation).
17+
18+
## Styleguides
19+
20+
### YAML Styleguide
21+
22+
All YAML files must adhere to the following style guide:
23+
24+
* Indentation: Use 2 spaces for indentation.
25+
* No trailing spaces.
26+
* Use hyphens for list items.
27+
* Use camelCase for key names.
28+
* Ensure there are no syntax errors.
29+
30+
Additional rules:
31+
32+
* Always use double quotes for strings.
33+
* Keep lines to a maximum of 80 characters.
34+
* Ensure proper alignment of nested elements.
35+
36+
### Git Commit Messages
37+
38+
* Use the present tense ("Add feature" not "Added feature").
39+
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...").
40+
* Limit the first line to 72 characters or less.
41+
* Reference issues and pull requests liberally after the first line.

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# mongodb-database-community Helm Chart
2+
3+
> [!NOTE]
4+
> This project is not affiliated with [MongoDB](https://github.com/mongodb/helm-charts).
5+
6+
## Usage
7+
8+
Charts are available in:
9+
10+
* [Chart Repository](https://helm.sh/docs/topics/chart_repository/)
11+
* [OCI Artifacts](https://helm.sh/docs/topics/registries/)
12+
13+
### Chart Repository
14+
15+
#### Add repository
16+
17+
```console
18+
helm repo add mongodb-community-database https://devops-ia.github.io/helm-mongodb-community-database
19+
helm repo update
20+
```
21+
22+
#### Install Helm chart
23+
24+
```console
25+
helm install [RELEASE_NAME] mongodb-community-database/mongodb-community-database
26+
```
27+
28+
This install all the Kubernetes components associated with the chart and creates the release.
29+
30+
_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._
31+
32+
### OCI Registry
33+
34+
Charts are also available in OCI format. The list of available charts can be found [here](https://github.com/devops-ia/helm-mongodb-community-database/pkgs/container/helm-mongodb-community-database%2Fmongodb-community-database).
35+
36+
#### Install Helm chart
37+
38+
```console
39+
helm install [RELEASE_NAME] oci://ghcr.io/devops-ia/helm-mongodb-community-database/mongodb-community-database --version=[version]
40+
```
41+
42+
## mongodb-database-community chart
43+
44+
Can be found in [mongodb-community-database chart](charts/mongodb-community-database).

0 commit comments

Comments
 (0)