Skip to content

Commit 9a2dc2b

Browse files
committed
Add helm workflow for lint and test
Signed-off-by: S3B4SZ17 <sebastian.zumbado@sysdig.com>
1 parent bdb014d commit 9a2dc2b

File tree

3 files changed

+105
-6
lines changed

3 files changed

+105
-6
lines changed

.github/workflows/helm_test.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
name: Lint & Test helm chart
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
- develop
9+
- feature/**
10+
- release/**
11+
- hotfix/**
12+
paths:
13+
- 'charts/**'
14+
push:
15+
branches:
16+
- main
17+
- develop
18+
- feature/**
19+
- release/**
20+
- hotfix/**
21+
paths:
22+
- 'charts/**'
23+
24+
concurrency:
25+
group: '${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
26+
cancel-in-progress: true
27+
28+
jobs:
29+
set-charts:
30+
# Required permissions
31+
permissions:
32+
contents: read
33+
pull-requests: read
34+
outputs:
35+
charts: ${{ steps.charts.outputs.changes }}
36+
name: "Set Charts"
37+
runs-on: [ubuntu-latest]
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: dorny/paths-filter@v2
41+
id: charts
42+
with:
43+
base: ${{ github.ref_name }}
44+
filters: |
45+
sysdig-mcp:
46+
- 'charts/sysdig-mcp/**'
47+
lint-charts:
48+
needs: set-charts
49+
name: Lint new helm charts
50+
runs-on: [ubuntu-latest]
51+
strategy:
52+
matrix:
53+
chart: ${{ fromJSON(needs.set-charts.outputs.charts) }}
54+
# When set to true, GitHub cancels all in-progress jobs if any matrix job fails.
55+
fail-fast: false
56+
# The maximum number of jobs that can run simultaneously
57+
max-parallel: 3
58+
steps:
59+
60+
- uses: actions/checkout@v4
61+
with:
62+
fetch-depth: 0
63+
64+
- name: Set up Helm
65+
uses: azure/setup-helm@v4
66+
with:
67+
version: v3.5.0
68+
69+
- uses: actions/setup-python@v4
70+
with:
71+
python-version: '3.10'
72+
check-latest: true
73+
74+
- name: Set up chart-testing
75+
uses: helm/chart-testing-action@v2.6.1
76+
77+
- name: Run chart-testing (list-changed)
78+
id: list-changed
79+
run: |
80+
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }} --chart-dirs charts,charts/${{ matrix.chart }})
81+
if [[ -n "$changed" ]]; then
82+
echo "changed=true" >> "$GITHUB_OUTPUT"
83+
fi
84+
85+
- name: Run chart-testing (lint)
86+
if: steps.list-changed.outputs.changed == 'true'
87+
run: ct lint --target-branch ${{ github.event.repository.default_branch }} --chart-dirs charts/${{ matrix.chart }}
88+
89+
- name: Create kind cluster
90+
if: steps.list-changed.outputs.changed == 'true'
91+
uses: helm/kind-action@v1.12.0
92+
93+
- name: Run chart-testing (install)
94+
if: steps.list-changed.outputs.changed == 'true'
95+
run: ct install --target-branch ${{ github.event.repository.default_branch }} --chart-dirs charts/${{ matrix.chart }}

.github/workflows/publish.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Publish Docker image
23

34
on:
@@ -12,12 +13,10 @@ on:
1213
- tools/**
1314
- utils/**
1415
workflow_dispatch:
15-
inputs:
16-
version:
17-
description: "Version to publish"
18-
required: false
19-
default: "latest"
20-
type: string
16+
17+
concurrency:
18+
group: '${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
19+
cancel-in-progress: true
2120

2221
jobs:
2322
tests:

.github/workflows/test.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Test
23

34
on:
@@ -25,6 +26,10 @@ on:
2526
- utils/**
2627
workflow_call:
2728

29+
concurrency:
30+
group: '${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
31+
cancel-in-progress: true
32+
2833
jobs:
2934
test:
3035
name: Test

0 commit comments

Comments
 (0)