Skip to content

K8SPSMDB-1470: revert dependency between crds and operator charts #39

K8SPSMDB-1470: revert dependency between crds and operator charts

K8SPSMDB-1470: revert dependency between crds and operator charts #39

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 '"')
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
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"