Skip to content

Commit accb7db

Browse files
authored
feat: add checks for helm charts (#49)
Signed-off-by: Mauro Sardara <[email protected]>
1 parent 447075e commit accb7db

21 files changed

+224
-42
lines changed

.github/actions/setup-k8s/action.yaml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
name: Setup Kubernetes tooling
6+
description: Setup Kubernetes tooling
7+
inputs:
8+
helm-version:
9+
description: 'Helm version'
10+
required: false
11+
default: "3.12.1"
12+
helm-ct-version:
13+
description: 'Helm chart-testing version'
14+
required: false
15+
default: "3.11.0"
16+
kind-version:
17+
description: 'Kind version'
18+
required: false
19+
default: "0.24.0"
20+
kind-create-cluster:
21+
description: 'Create kind K8s cluster'
22+
required: false
23+
default: "false"
24+
kind-cluster-name:
25+
description: 'Kind K8s cluster name to create'
26+
required: false
27+
default: "kind"
28+
kind-cluster-gateway:
29+
description: 'Gateway IP to use for kind server nodes. Useful when running actions inside containers.'
30+
required: false
31+
default: "127.0.0.1"
32+
runs:
33+
using: "composite"
34+
steps:
35+
#
36+
# Install kubernetes tools
37+
#
38+
- name: Setup Helm
39+
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
40+
with:
41+
version: ${{ inputs.helm-version }}
42+
43+
- name: Set up Helm chart-testing
44+
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
45+
with:
46+
version: ${{ inputs.helm-ct-version }}
47+
48+
- name: Setup kind
49+
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
50+
with:
51+
version: v${{ inputs.kind-version }}
52+
install_only: true
53+
54+
- name: Setup kubectl
55+
uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0
56+
57+
#
58+
# Setup cluster
59+
#
60+
- name: Setup Kind cluster
61+
if: ${{ inputs.kind-create-cluster == 'true' }}
62+
shell: bash
63+
run: |
64+
# Create cluster config
65+
KIND_CONFIG_FILE=$(mktemp -p /tmp)
66+
cat <<EOF > $KIND_CONFIG_FILE
67+
kind: Cluster
68+
apiVersion: kind.x-k8s.io/v1alpha4
69+
networking:
70+
apiServerAddress: "${{ inputs.kind-cluster-gateway }}"
71+
apiServerPort: 6443
72+
EOF
73+
74+
# Create cluster
75+
kind create cluster --config $KIND_CONFIG_FILE --name ${{ inputs.kind-cluster-name }}
76+
kubectl cluster-info

.github/release-config.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
"separate-pull-requests": true,
44
"sequential-calls": true,
55
"include-component-in-tag": true,
6-
"release-type": "python",
76
"skip-github-release": false,
87
"packages": {
98
"data-plane/python-bindings": {
109
"package-name": "agp-bindings",
1110
"release-type": "python"
11+
},
12+
"charts/agp": {
13+
"package-name": "agp-helm",
14+
"release-type": "helm"
1215
}
1316
}
1417
}

.github/release-manifest.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"data-plane/python-bindings": "0.1.5"
2+
"data-plane/python-bindings": "0.1.5",
3+
"charts/agp": "0.1.0"
34
}

.github/workflows/helm-charts.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
name: ci-test-and-build-helm-charts
6+
7+
on:
8+
push:
9+
paths:
10+
- 'charts/**'
11+
branches:
12+
- main
13+
pull_request:
14+
paths:
15+
- 'charts/**'
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
20+
21+
jobs:
22+
helm-chart-lint-test:
23+
name: Helm charts lint & test
24+
uses: ./.github/workflows/reusable-helm-lint-test.yaml
25+
with:
26+
chart-path: charts
27+
dependencies: ""

.github/workflows/release-check.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
name: ci-release-python
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
steps:
23+
- uses: googleapis/release-please-action@v4
24+
id: release-please
25+
with:
26+
token: ${{ secrets.AGNTCY_BUILD_BOT_GH_TOKEN }}
27+
config-file: .github/release-config.json
28+
manifest-file: .github/release-manifest.json

.github/workflows/release-helm.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
fetch-depth: 0
2727

28-
- name: Relesae
28+
- name: Resolve release tag
2929
id: resolve
3030
run: |
3131
echo "release_tag=$(echo ${GITHUB_REF#refs/*/} | sed 's/^agp-helm-//')" >> $GITHUB_OUTPUT
@@ -43,4 +43,4 @@ jobs:
4343
registry: ghcr.io/agntcy/agp
4444
release_tag: ${{ needs.prepare-build.outputs.release_tag }}
4545
secrets:
46-
github-token: ${{ secrets.GITHUB_TOKEN }}
46+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-python.yaml

-17
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,6 @@ concurrency:
1818
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1919

2020
jobs:
21-
release:
22-
runs-on: ubuntu-latest
23-
if: github.event_name == 'push'
24-
permissions:
25-
contents: write
26-
pull-requests: write
27-
outputs:
28-
releases_created: ${{ steps.release-please.outputs.releases_created }}
29-
released_paths: ${{ steps.release-please.outputs.paths_released }}
30-
steps:
31-
- uses: googleapis/release-please-action@v4
32-
id: release-please
33-
with:
34-
token: ${{ secrets.AGNTCY_BUILD_BOT_GH_TOKEN }}
35-
config-file: .github/release-config.json
36-
manifest-file: .github/release-manifest.json
37-
3821
build-wheels:
3922
name: Data plane - Python wheels
4023
uses: ./.github/workflows/reusable-python-build-wheels.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
name: Lint / Test Helm Chart
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
chart-path:
11+
description: "Path to the chart to lint"
12+
required: true
13+
type: string
14+
config-file:
15+
description: "Path to the chart-testing config file"
16+
required: false
17+
type: string
18+
default: ""
19+
dependencies:
20+
description: "List of dependencies to add"
21+
required: false
22+
default: ""
23+
type: string
24+
25+
26+
jobs:
27+
lint-test:
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
35+
submodules: "true"
36+
37+
- name: Print chart path
38+
run: |
39+
echo "Chart path: ${{ inputs.chart-path }}"
40+
41+
- name: Setup K8s
42+
uses: ./.github/actions/setup-k8s
43+
with:
44+
kind-create-cluster: true
45+
46+
- name: Add dependencies
47+
shell: bash
48+
run: |
49+
IFS='\n' readarray -t dependencies <<< "${{ inputs.dependencies }}"
50+
for dependency in "${dependencies[@]}"; do
51+
# Skip line if it is empty
52+
if [[ -z "${dependency//[[:space:]]/}" ]]; then
53+
continue
54+
fi
55+
56+
# Split the dependency into name and repo
57+
IFS='@' read -r name repo <<< "${dependency}"
58+
59+
echo helm repo add ${name} ${repo}
60+
done
61+
62+
- name: Run chart-testing (lint & test)
63+
run: |
64+
args=(
65+
--upgrade
66+
--debug
67+
--target-branch=${{ github.base_ref }}
68+
--chart-dirs ${{ inputs.chart-path }}
69+
--validate-maintainers=false
70+
--check-version-increment=false
71+
)
72+
73+
if [[ -f "${{ inputs.config-file }}" ]]; then
74+
args+="--config ${{ inputs.config-file }}"
75+
fi
76+
77+
ct lint-and-install ${args[@]}

.github/workflows/reusable-helm-release.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
---
45
name: Release
56

67
on:
@@ -48,7 +49,7 @@ jobs:
4849

4950
- name: Helm lint
5051
shell: bash
51-
run: helm lint deploy/charts/agp --with-subcharts
52+
run: helm lint charts/agp --with-subcharts
5253

5354
- name: Set chart name
5455
id: chart-name
@@ -59,7 +60,7 @@ jobs:
5960
id: build
6061
shell: bash
6162
run: |
62-
helm package deploy/charts/agp --dependency-update --version ${{ inputs.release_tag }}
63+
helm package charts/agp --dependency-update --version ${{ inputs.release_tag }}
6364
echo "package=${{ steps.chart-name.outputs.value }}-${{ inputs.release_tag }}.tgz" >> "$GITHUB_OUTPUT"
6465
6566
- name: Helm push to GHCR OCI registry

deploy/charts/agp/.helmignore renamed to charts/agp/.helmignore

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# This supports shell glob matching, relative path matching, and
33
# negation (prefixed with !). Only one pattern per line.
44
.DS_Store
5+
56
# Common VCS dirs
67
.git/
78
.gitignore
@@ -10,12 +11,14 @@
1011
.hg/
1112
.hgignore
1213
.svn/
14+
1315
# Common backup files
1416
*.swp
1517
*.bak
1618
*.tmp
1719
*.orig
1820
*~
21+
1922
# Various IDEs
2023
.project
2124
.idea/

deploy/charts/agp/Chart.yaml renamed to charts/agp/Chart.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
---
45
apiVersion: v2
56
name: agp
67
description: A Helm chart for Kubernetes
@@ -24,4 +25,4 @@ version: 0.1.0
2425
# incremented each time you make changes to the application. Versions are not expected to
2526
# follow Semantic Versioning. They should reflect the version the application is using.
2627
# It is recommended to use it with quotes.
27-
appVersion: "0.1.1"
28+
appVersion: "0.3.0"
File renamed without changes.
File renamed without changes.

deploy/charts/agp/templates/tests/test-connection.yaml

-18
This file was deleted.

0 commit comments

Comments
 (0)