This repository was archived by the owner on Jun 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
139 lines (128 loc) · 5.02 KB
/
Copy pathhelm-workflows.yml
File metadata and controls
139 lines (128 loc) · 5.02 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Helm Charts
on:
workflow_call:
inputs:
app_version:
description: "Application version for Helm chart appVersion"
required: true
type: string
secrets:
NVCR_STG_TOKEN:
required: true
jobs:
# Detect per-chart changes
detect-changes:
name: Detect Helm Chart Changes
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changes.outputs.any_changed }}
nico_rest_changed: ${{ steps.changes.outputs.nico_rest }}
site_agent_changed: ${{ steps.changes.outputs.site_agent }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for helm/ changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
any_changed:
- 'helm/**'
nico_rest:
- 'helm/charts/nico-rest/**'
site_agent:
- 'helm/charts/nico-rest-site-agent/**'
# Validate Chart.yaml versions are bumped (PR branches only)
validate-versions:
name: Validate Helm Chart Versions
needs:
- detect-changes
if: ${{ needs.detect-changes.outputs.any_changed == 'true' && contains(github.ref, 'pull-request/') }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify Chart.yaml versions are updated
run: |
FAILED=false
check_version() {
local chart_dir="$1" changed="$2"
if [ "$changed" != "true" ]; then
echo "⊘ ${chart_dir}: no changes, skipping version check"
return
fi
local chart_yaml="${chart_dir}/Chart.yaml"
local current_version=$(grep '^version:' "$chart_yaml" | awk '{print $2}')
local base_version=$(git show origin/main:"$chart_yaml" 2>/dev/null | grep '^version:' | awk '{print $2}' || echo "")
if [ -n "$base_version" ] && [ "$current_version" = "$base_version" ]; then
echo "::error file=${chart_yaml}::Chart version ($current_version) was not updated. Please bump the version in $chart_yaml"
FAILED=true
else
echo "✓ ${chart_dir}: version updated to $current_version"
fi
}
check_version "helm/charts/nico-rest" "${{ needs.detect-changes.outputs.nico_rest_changed }}"
check_version "helm/charts/nico-rest-site-agent" "${{ needs.detect-changes.outputs.site_agent_changed }}"
if [ "$FAILED" = "true" ]; then
exit 1
fi
# Lint and template validation
validate-charts:
name: Validate Helm Charts
needs:
- detect-changes
- validate-versions
if: ${{ always() && needs.detect-changes.outputs.any_changed == 'true' && (needs.validate-versions.result == 'success' || needs.validate-versions.result == 'skipped') }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- chart: helm/charts/nico-rest
valueOverrides: '["nico-rest-api.config.keycloak.enabled=true","nico-rest-api.config.keycloak.baseURL=http://keycloak:8082","nico-rest-api.config.keycloak.realm=test","nico-rest-api.config.keycloak.clientID=test"]'
- chart: helm/charts/nico-rest-site-agent
valueOverrides: '[]'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate Helm chart
uses: NVIDIA/dsx-github-actions/.github/actions/helm-validate@94bde998f5d7965576b0c663db7d5d709c918167
with:
chart-path: ${{ matrix.chart }}
lint: 'true'
template: 'true'
valueOverrides: ${{ matrix.valueOverrides }}
# Package and push to NGC (main branch only)
push-charts:
name: Push Helm Charts
needs:
- detect-changes
- validate-charts
if: ${{ !cancelled() && needs.detect-changes.outputs.any_changed == 'true' && needs.validate-charts.result == 'success' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
strategy:
matrix:
chart:
- helm/charts/nico-rest
- helm/charts/nico-rest-site-agent
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read chart version from Chart.yaml
id: chart-version
run: |
VERSION=$(grep '^version:' ${{ matrix.chart }}/Chart.yaml | awk '{print $2}')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Package and push Helm chart to NGC
uses: NVIDIA/dsx-github-actions/.github/actions/helm-package-push@94bde998f5d7965576b0c663db7d5d709c918167
with:
chart-path: ${{ matrix.chart }}
chart-version: ${{ steps.chart-version.outputs.version }}
app-version: ${{ inputs.app_version }}
lint: 'false'
ngc-key: ${{ secrets.NVCR_STG_TOKEN }}
ngc-path: 0837451325059433/carbide-dev
ngc-duplicate: fail