-
Notifications
You must be signed in to change notification settings - Fork 199
Expand file tree
/
Copy pathpsmdb-operator-crd-sync-check.yaml
More file actions
91 lines (76 loc) · 4.13 KB
/
psmdb-operator-crd-sync-check.yaml
File metadata and controls
91 lines (76 loc) · 4.13 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
name: PSMDB Operator CRD Sync Check
on:
pull_request:
paths:
- 'charts/psmdb-operator/**'
- 'charts/psmdb-operator-crds/**'
jobs:
check-crd-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check version sync
run: |
set -e
echo "Checking if chart versions are in sync..."
echo ""
# Extract versions - note: psmdb-operator-crds chart version should match operator appVersion, not chart version
# This rule applies ONLY to psmdb-operator-crds, not to other charts (e.g., psmdb-db can have independent version)
OPERATOR_APP_VERSION=$(grep '^appVersion:' charts/psmdb-operator/Chart.yaml | awk '{print $2}' | tr -d '"')
OPERATOR_CHART_VERSION=$(grep '^version:' charts/psmdb-operator/Chart.yaml | awk '{print $2}' | tr -d '"')
CRD_VERSION=$(grep '^version:' charts/psmdb-operator-crds/Chart.yaml | awk '{print $2}' | tr -d '"')
CRD_APP_VERSION=$(grep '^appVersion:' charts/psmdb-operator-crds/Chart.yaml | awk '{print $2}' | tr -d '"')
DEPENDENCY_VERSION=$(grep -A 3 'name: psmdb-operator-crds' charts/psmdb-operator/Chart.yaml | grep 'version:' | awk '{print $2}' | tr -d '"')
echo "Operator chart:"
echo " version: $OPERATOR_CHART_VERSION"
echo " appVersion: $OPERATOR_APP_VERSION"
echo "psmdb-operator-crds chart:"
echo " version: $CRD_VERSION"
echo " appVersion: $CRD_APP_VERSION"
echo "Dependency version: $DEPENDENCY_VERSION"
echo ""
VERSION_SYNC=true
# psmdb-operator-crds chart version should match operator appVersion (CRDs are tied to operator version, not chart version)
# Note: This rule applies ONLY to psmdb-operator-crds, other charts can have independent versions
if [ "$CRD_VERSION" != "$OPERATOR_APP_VERSION" ]; then
echo "✗ psmdb-operator-crds chart version ($CRD_VERSION) does not match operator appVersion ($OPERATOR_APP_VERSION)"
echo " Note: psmdb-operator-crds chart version must match operator appVersion, not operator chart version"
VERSION_SYNC=false
fi
# psmdb-operator-crds appVersion should match operator appVersion
if [ "$CRD_APP_VERSION" != "$OPERATOR_APP_VERSION" ]; then
echo "✗ psmdb-operator-crds chart appVersion ($CRD_APP_VERSION) does not match operator appVersion ($OPERATOR_APP_VERSION)"
VERSION_SYNC=false
fi
# Dependency version should match psmdb-operator-crds chart version
if [ "$CRD_VERSION" != "$DEPENDENCY_VERSION" ]; then
echo "✗ psmdb-operator-crds chart version ($CRD_VERSION) does not match dependency version ($DEPENDENCY_VERSION)"
VERSION_SYNC=false
fi
if [ "$VERSION_SYNC" = false ]; then
echo ""
echo "Version sync requirements for psmdb-operator-crds (this rule applies ONLY to CRD chart):"
echo " - psmdb-operator-crds chart version = operator appVersion"
echo " - psmdb-operator-crds chart appVersion = operator appVersion"
echo " - Dependency version = psmdb-operator-crds chart version"
echo ""
echo "Note: Other charts (e.g., psmdb-db) can have independent chart versions."
echo ""
echo "Example:"
echo " operator: appVersion=1.30.0, version=1.30.2"
echo " psmdb-operator-crds: appVersion=1.30.0, version=1.30.0"
echo " dependency: version=1.30.0"
exit 1
fi
echo "✓ Chart versions are in sync"
echo ""
- name: Check CRD content sync
run: |
set -e
diff -u \
--label "templates (psmdb-operator-crds)" \
--label "crd.yaml (psmdb-operator)" \
<(sed '/^---$/d' charts/psmdb-operator-crds/templates/*.yaml) \
<(sed '/^---$/d' charts/psmdb-operator/crds/crd.yaml)
echo "✓ CRDs are in sync"