Skip to content

Commit 1552019

Browse files
Init commit
1 parent c03144a commit 1552019

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+4270
-0
lines changed

.github/labeler.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
tests:
2+
- '**/*_test.yaml'
3+
4+
library:
5+
- charts/cf-common/**/*
6+
7+
docs:
8+
- README.md
9+
- CHANGELOG.md
10+
11+
automation:
12+
- .github/**/*

.github/pull_request_template.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## What
2+
3+
## Why
4+
5+
## Notes

.github/workflows/lint-test.yaml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
## Reference: https://github.com/helm/chart-testing-action
2+
## Reference: https://github.com/quintush/helm-unittest
3+
name: Lint and Test Charts
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- master
9+
types:
10+
- opened
11+
- edited
12+
- reopened
13+
- ready_for_review
14+
- synchronize
15+
paths:
16+
- "charts/**"
17+
18+
concurrency:
19+
group: ${{ github.head_ref }}-lint-test
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: read
24+
25+
env:
26+
HELM_VERSION: 3.9.2 # Also update in release.yaml
27+
28+
jobs:
29+
lint-charts:
30+
runs-on: ubuntu-latest
31+
outputs:
32+
matrix: ${{ steps.list-changed.outputs.matrix }}
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Set up Helm
40+
uses: azure/setup-helm@v3
41+
with:
42+
version: ${{ env.HELM_VERSION }}
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: 3.9
48+
49+
- name: 'Set up jq'
50+
uses: dcarbone/[email protected]
51+
52+
- name: Set up chart-testing
53+
uses: helm/[email protected]
54+
55+
- name: Run chart-testing (list-changed)
56+
id: list-changed
57+
run: |
58+
set -o xtrace
59+
changed=$(ct list-changed --config ct.yaml)
60+
charts=$(echo "$changed" | tr '\n' ' ' | xargs)
61+
if [[ -n "$changed" ]]; then
62+
echo "changed=true" >> $GITHUB_OUTPUT
63+
echo "changed_charts=$charts" >> $GITHUB_OUTPUT
64+
echo "matrix=$(echo $charts | jq -R 'split(" ")' | jq '. | if index("charts/cf-common-test") then . else . += ["charts/cf-common-test"] end' | jq -c .)" >> $GITHUB_OUTPUT
65+
echo $matrix
66+
fi
67+
68+
- name: Run chart-testing (lint)
69+
run: ct lint --config "ct.yaml" --lint-conf "lintconf.yaml" --debug --excluded-charts "cf-common-test"
70+
71+
- name: Run docs-testing (helm-docs)
72+
id: helm-docs
73+
run: |
74+
./scripts/helm-docs.sh
75+
if [[ $(git diff --stat) != '' ]]; then
76+
echo -e '\033[0;31mDocumentation outdated!\033[0m ❌ Run ./scripts/helm-docs.sh before commit!'
77+
git diff --color
78+
exit 1
79+
else
80+
echo -e '\033[0;32mDocumentation up to date\033[0m ✔'
81+
fi
82+
83+
- name: Create kind cluster
84+
uses: helm/[email protected]
85+
86+
- name: Run chart-testing (install)
87+
run: |
88+
changed=$(ct list-changed --config "ct.yaml")
89+
if [[ "$changed" == "charts/cf-common" ]]; then
90+
# Do not run `ct install` for cf-common (library chart)
91+
exit 0
92+
fi
93+
ct install --config "ct.yaml"
94+
95+
unittest-charts:
96+
needs:
97+
- lint-charts
98+
runs-on: ubuntu-latest
99+
# There are no Unit Test suites in `charts/cf-common`. They are located in `charts/cf-common-test`. So `charts/cf-common` is excluded from this job.
100+
if: ${{ needs.lint-charts.outputs.matrix != '[]' && needs.lint-charts.outputs.matrix != '["charts/cf-common"]' }}
101+
strategy:
102+
matrix:
103+
chart: ${{ fromJSON(needs.lint-charts.outputs.matrix) }}
104+
exclude:
105+
- chart: charts/cf-common
106+
fail-fast: true
107+
steps:
108+
- name: Checkout
109+
uses: actions/checkout@v3
110+
with:
111+
fetch-depth: 0
112+
113+
- name: Set up Helm
114+
uses: azure/setup-helm@v3
115+
with:
116+
version: ${{ env.HELM_VERSION }}
117+
118+
- name: Run unit tests
119+
run: |
120+
echo ${{ matrix.chart }}
121+
helm plugin install https://github.com/quintush/helm-unittest --version v0.2.11
122+
helm dep update ${{ matrix.chart }}
123+
helm unittest --helm3 --color --debug -f "tests/**/*_test.yaml" ${{ matrix.chart }}
124+
125+
push-charts-dev-cm:
126+
needs:
127+
- lint-charts
128+
- unittest-charts
129+
runs-on: ubuntu-latest
130+
strategy:
131+
matrix:
132+
chart: ${{ fromJSON(needs.lint-charts.outputs.matrix) }}
133+
fail-fast: true
134+
steps:
135+
- name: Checkout
136+
uses: actions/checkout@v3
137+
with:
138+
fetch-depth: 0
139+
140+
- name: Set up Helm
141+
uses: azure/setup-helm@v3
142+
with:
143+
version: v3.8.2
144+
145+
- name: Set up yq
146+
uses: chrisdickinson/setup-yq@latest
147+
148+
- name: Set short SHA
149+
run: echo "GITHUB_SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
150+
151+
- name: Push Helm Chart to Dev ChartMuseum
152+
run: |
153+
set -o xtrace
154+
CHART_NAME=$(yq read ${{ matrix.chart }}/Chart.yaml name)
155+
CHART_VERSION=$(yq read ${{ matrix.chart }}/Chart.yaml version)-$GITHUB_SHORT_SHA
156+
157+
helm plugin install https://github.com/chartmuseum/helm-push.git
158+
helm repo add chartmuseum ${{ secrets.CHARTMUSEUM_DEV_URL }}/$CHART_NAME --username ${{ secrets.CHARTMUSEUM_DEV_USERNAME }} --password ${{ secrets.CHARTMUSEUM_DEV_PASSWORD }}
159+
helm dependency update ${{ matrix.chart }}
160+
161+
helm cm-push ${{ matrix.chart }} chartmuseum --version $CHART_VERSION

.github/workflows/pr-labeler.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Reference: https://github.com/actions/labeler
2+
name: "PR Labeler"
3+
4+
on:
5+
pull_request_target:
6+
types:
7+
- opened
8+
- synchronize
9+
- reopened
10+
11+
jobs:
12+
triage:
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/labeler@v4
19+
with:
20+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
21+
sync-labels: true

.github/workflows/pr-title.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Reference: https://github.com/amannn/action-semantic-pull-request
2+
name: "PR Lint"
3+
4+
on:
5+
pull_request_target:
6+
types:
7+
- opened
8+
- synchronize
9+
- reopened
10+
11+
jobs:
12+
main:
13+
name: Validate PR title
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: amannn/action-semantic-pull-request@v5
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## Reference: https://github.com/helm/chart-releaser-action
2+
name: Publish Charts
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "charts/**"
9+
10+
concurrency:
11+
group: helm-release
12+
13+
env:
14+
HELM_VERSION: 3.9.2 # Also update in lint-test.yaml
15+
16+
jobs:
17+
publish:
18+
permissions:
19+
contents: write
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Helm
28+
uses: azure/setup-helm@v3
29+
with:
30+
version: ${{ env.HELM_VERSION }}
31+
32+
- name: Configure Git
33+
run: |
34+
git config user.name "$GITHUB_ACTOR"
35+
git config user.email "[email protected]"
36+
37+
- name: Run chart-releaser
38+
uses: helm/[email protected]
39+
with:
40+
charts_dir: charts
41+
config: cr.yaml
42+
env:
43+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
44+
45+
- name: Upload to ChartMuseum
46+
run: |
47+
set -o xtrace
48+
if [ -d .cr-release-packages ]; then
49+
for CHART in $(find .cr-release-packages -type f -printf '%f\n'); do
50+
CHART_NAME=$(echo $CHART | rev | cut -d '-' -f2- | rev )
51+
curl --data-binary "@.cr-release-packages/$CHART" --user "${{ secrets.CHARTMUSEUM_PROD_USERNAME }}:${{ secrets.CHARTMUSEUM_PROD_PASSWORD }}" ${{ secrets.CHARTMUSEUM_PROD_URL }}/api/$CHART_NAME/charts
52+
done
53+
fi

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
reference_manifests
2+
**/__snapshot__
3+
4+
.idea
5+
.DS_Store
6+
7+
**/values-*.yaml
8+
9+
# helm template
10+
**/dry-run/**
11+
12+
# dependency charts
13+
**/charts/*.tgz
14+
*.tgz
15+
16+
# lock files
17+
*.lock

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.2.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
exclude: &exclude_pattern 'README.md'
8+
- id: trailing-whitespace

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Codefresh Helm Charts

charts/cf-common-test/Chart.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v2
2+
appVersion: v0.0.0
3+
description: Codefresh library chart - test chart - not for deployment!
4+
name: cf-common-test
5+
version: 0.0.0
6+
home: https://github.com/codefresh-sandbox/helm-charts/cf-common-test
7+
dependencies:
8+
- name: cf-common
9+
repository: file://../cf-common
10+
version: "*"
11+
keywords:
12+
- codefresh
13+
- libs
14+
maintainers:
15+
- name: codefresh
16+
url: https://codefresh-io.github.io/

0 commit comments

Comments
 (0)