Skip to content

Commit b2c55ac

Browse files
committed
feat: move from helm-chart repository
0 parents  commit b2c55ac

27 files changed

Lines changed: 1170 additions & 0 deletions

.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@39c06395cbac76e79afc4ad4e5c5c6db6ecfdd2e # v2.2.0
17+
with:
18+
repo-token: ${{ secrets.PAT_GITHUB }}
19+
teams: devops-ia

.github/workflows/lint-test.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Lint and test charts
2+
permissions:
3+
contents: read
4+
5+
on:
6+
workflow_dispatch:
7+
pull_request:
8+
9+
jobs:
10+
lint-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
15+
with:
16+
fetch-depth: 0
17+
18+
# default install latest (stable)
19+
- name: Set up Helm
20+
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
21+
22+
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
23+
with:
24+
python-version: 3.x
25+
check-latest: true
26+
27+
- name: Set up chart-testing
28+
uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0
29+
with:
30+
yamale_version: "6.0.0"
31+
32+
- name: Run chart-testing (list-changed)
33+
id: list-changed
34+
run: |
35+
changed=$(ct list-changed --config .github/ct.yaml)
36+
if [[ -n "${changed}" ]]; then
37+
echo "changed=true" >> "$GITHUB_OUTPUT"
38+
fi
39+
40+
- name: Run chart-testing (lint)
41+
if: steps.list-changed.outputs.changed == 'true'
42+
run: ct lint --config .github/ct.yaml
43+
44+
- name: Create kind cluster
45+
if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
46+
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
47+
48+
- name: Run ct install
49+
if: steps.list-changed.outputs.changed == 'true'
50+
run: ct install --config .github/ct.yaml --helm-extra-args '--timeout 900s --debug'
51+
52+
- name: (workflow_dispatch) Run ct install
53+
if: github.event_name == 'workflow_dispatch'
54+
run: ct install --config .github/ct.yaml --helm-extra-args '--timeout 900s --debug' --all

.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 release-cleaner chart
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- "charts/release-cleaner/**"
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
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 "$GITHUB_ACTOR@users.noreply.github.com"
30+
31+
- name: Semantic Release
32+
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
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/release-cleaner/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/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0
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@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
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@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
79+
80+
- name: Install Oras
81+
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
82+
uses: oras-project/setup-oras@22ce207df3b08e061f537244349aac6ae1d214f6 # v1.2.4
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

.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: v6.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.30
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 release-cleaner Helm Chart
2+
3+
This document provides guidelines for contributing to the *release-cleaner 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-release-cleaner/issues).
10+
* If you cannot find an open issue addressing the problem, [open a new one](https://github.com/devops-ia/helm-release-cleaner/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-release-cleaner/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.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 DevOps Solutions
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

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

0 commit comments

Comments
 (0)