forked from we-promise/sure
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (69 loc) · 2.5 KB
/
chart-ci.yml
File metadata and controls
85 lines (69 loc) · 2.5 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
name: Chart CI
on:
pull_request:
paths:
- 'charts/**'
- '.sure-version'
- '.github/workflows/chart-ci.yml'
push:
branches:
- main
paths:
- 'charts/**'
- '.sure-version'
- '.github/workflows/chart-ci.yml'
jobs:
version-sync:
name: Verify Helm ↔ Rails version sync
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Check version alignment
shell: bash
run: |
set -euo pipefail
RAILS_VERSION=$(cat .sure-version | tr -d '[:space:]')
if [ -z "$RAILS_VERSION" ]; then
echo "::error::Could not read version from .sure-version"
exit 1
fi
CHART_VERSION=$(sed -n 's/^version: //p' charts/sure/Chart.yaml | head -n 1)
APP_VERSION=$(sed -n 's/^appVersion: "\{0,1\}\([^"]*\)"\{0,1\}/\1/p' charts/sure/Chart.yaml | head -n 1)
echo "App version (.sure-version): $RAILS_VERSION"
echo "Helm chart version (Chart.yaml): $CHART_VERSION"
echo "Helm appVersion (Chart.yaml): $APP_VERSION"
ERRORS=0
if [ "$RAILS_VERSION" != "$CHART_VERSION" ]; then
echo "::error::Chart version ($CHART_VERSION) does not match Rails version ($RAILS_VERSION)"
ERRORS=$((ERRORS + 1))
fi
if [ "$RAILS_VERSION" != "$APP_VERSION" ]; then
echo "::error::Chart appVersion ($APP_VERSION) does not match Rails version ($RAILS_VERSION)"
ERRORS=$((ERRORS + 1))
fi
if [ "$ERRORS" -gt 0 ]; then
echo ""
echo "To fix: ensure version in .sure-version matches"
echo "both 'version' and 'appVersion' in charts/sure/Chart.yaml"
exit 1
fi
echo "All versions are in sync."
helm-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Helm
uses: azure/setup-helm@v5
- name: Add chart dependencies repositories
run: |
helm repo add cloudnative-pg https://cloudnative-pg.github.io/charts
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts
helm repo update
- name: Build chart dependencies
run: helm dependency build charts/sure
- name: Lint chart
run: helm lint charts/sure
- name: Render templates
run: helm template sure charts/sure --kube-version 1.25.0 >/tmp/sure-chart-rendered.yaml