Skip to content

RHOAIENG-63027: Integrate operator-chaos shift-left validation (L1-L2) #5

RHOAIENG-63027: Integrate operator-chaos shift-left validation (L1-L2)

RHOAIENG-63027: Integrate operator-chaos shift-left validation (L1-L2) #5

Workflow file for this run

name: Chaos Validation
on:
pull_request:
paths:
- 'chaos/**'
- 'manifests/**'
- 'dashboard-operator/internal/**'
- 'dashboard-operator/api/**'
- 'dashboard-operator/config/**'
- 'dashboard-operator/cmd/**'
- '.github/workflows/operator-chaos.yml'
env:
KNOWLEDGE_FILE: "chaos/knowledge/dashboard.yaml"
jobs:
validate:
name: Operator Chaos
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: dashboard-operator/go.mod
cache: true
- name: Install operator-chaos
shell: bash
run: |
set -euo pipefail
version=$(grep '^OPERATOR_CHAOS_VERSION' dashboard-operator/Makefile | head -1 | sed 's/.*?= *//')
mkdir -p "${RUNNER_TEMP}/bin"
GOBIN="${RUNNER_TEMP}/bin" go install "github.com/opendatahub-io/operator-chaos/cmd/operator-chaos@${version}"
echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}"
- name: Validate knowledge model
shell: bash
run: |
set -euo pipefail
operator-chaos validate --knowledge "${KNOWLEDGE_FILE}"
- name: Validate all experiments
shell: bash
run: |
set -euo pipefail
status=0
for f in chaos/experiments/*.yaml; do
echo "--- $f ---"
if ! operator-chaos validate "$f"; then
status=1
fi
done
exit "$status"
- name: Local preflight
shell: bash
run: |
set -euo pipefail
operator-chaos preflight --knowledge "${KNOWLEDGE_FILE}" --local
- name: Checkout base branch assets
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.base.sha }}
path: base-branch
persist-credentials: false
sparse-checkout: chaos/knowledge
sparse-checkout-cone-mode: false
- name: Detect breaking changes
shell: bash
run: |
set -euo pipefail
if [ ! -d "base-branch/chaos/knowledge" ]; then
echo "No base knowledge model found — skipping diff (first-time integration)"
exit 0
fi
output_dir="${RUNNER_TEMP}/operator-chaos"
mkdir -p "${output_dir}"
knowledge_diff_json="${output_dir}/knowledge-diff.json"
operator-chaos diff \
--source base-branch/chaos/knowledge \
--target chaos/knowledge \
--breaking \
--format json \
| tee "${knowledge_diff_json}"
knowledge_breaking=$(jq -r '.summary.breakingChanges // 0' "${knowledge_diff_json}")
if (( knowledge_breaking > 0 )); then
echo "operator-chaos detected ${knowledge_breaking} breaking knowledge change(s)."
exit 1
fi
- name: Simulate upgrade
shell: bash
run: |
set -euo pipefail
if [ ! -d "base-branch/chaos/knowledge" ]; then
echo "No base knowledge model found — skipping simulate-upgrade (first-time integration)"
exit 0
fi
operator-chaos simulate-upgrade \
--source base-branch/chaos/knowledge \
--target chaos/knowledge \
--dry-run