-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (92 loc) · 2.74 KB
/
helm.yml
File metadata and controls
111 lines (92 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Helm
on:
push:
branches:
- main
- master
paths:
- "chart/**"
- ".github/workflows/helm.yml"
pull_request:
branches:
- main
- master
paths:
- "chart/**"
- ".github/workflows/helm.yml"
workflow_dispatch:
env:
REGISTRY: ghcr.io
HELM_REGISTRY: oci://ghcr.io/flanksource/charts
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Task
run: |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
- name: Set up Helm
uses: azure/setup-helm@v4
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
- name: Create kind cluster
uses: helm/kind-action@v1.8.0
with:
cluster_name: postgres-upgrade-test
- name: Test Helm chart
run: task test:helm:e2e
package-and-publish:
needs: lint-and-test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: "3.14.0"
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Package and push Helm chart
run: |
# Package the chart
helm package chart/ --destination .helm-packages/
# Get the chart version
CHART_VERSION=$(helm show chart chart/ | grep '^version:' | cut -d' ' -f2)
CHART_NAME=$(helm show chart chart/ | grep '^name:' | cut -d' ' -f2)
echo "Packaging $CHART_NAME version $CHART_VERSION"
# Push to OCI registry
helm push .helm-packages/${CHART_NAME}-${CHART_VERSION}.tgz ${{ env.HELM_REGISTRY }}
echo "Successfully pushed $CHART_NAME:$CHART_VERSION to ${{ env.HELM_REGISTRY }}"
security-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Checkov
uses: bridgecrewio/checkov-action@master
with:
directory: chart/
framework: kubernetes
soft_fail: true
output_format: sarif
output_file_path: checkov-results.sarif
- name: Upload Checkov results
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: checkov-results.sarif