Skip to content

feat(demo): repin serving demo store to the kitchen-appliance legend (B3) #126

feat(demo): repin serving demo store to the kitchen-appliance legend (B3)

feat(demo): repin serving demo store to the kitchen-appliance legend (B3) #126

Workflow file for this run

name: Chaos Engineering
on:
pull_request:
paths:
- "src/**"
- "tests/chaos/**"
- "docker-compose.chaos.yml"
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
chaos-smoke:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -e ".[dev,cloud]" pytest-json-report
- name: Start chaos stack
run: |
mkdir -p .tmp
mkdir -p .artifacts/chaos
docker compose -p agentflow-chaos -f docker-compose.chaos.yml up -d --wait --wait-timeout 120
- name: Run chaos smoke tests
env:
AGENTFLOW_CHAOS_CI_MODE: "1"
AGENTFLOW_CHAOS_STARTUP_TIMEOUT: "120"
PYTHONUNBUFFERED: "1"
# Dump thread stacks if the interpreter aborts at exit (the known
# intermittent native teardown SIGABRT the guard below tolerates).
PYTHONFAULTHANDLER: "1"
run: |
set +e
python -m pytest tests/chaos/test_chaos_smoke.py -v --tb=short --json-report --json-report-file=.artifacts/chaos/chaos-report.json
pytest_exit=$?
set -e
# Tolerate ONLY a green-session signal death (post-report native
# teardown abort); real failures propagate. See the script docstring.
python scripts/chaos_teardown_guard.py --report .artifacts/chaos/chaos-report.json --pytest-exit-code "$pytest_exit"
- name: Generate chaos report
if: always()
run: |
python scripts/chaos_report.py \
--input .artifacts/chaos/chaos-report.json \
--output .artifacts/chaos/chaos-summary.json \
--markdown .artifacts/chaos/chaos-summary.md
- name: Collect compose logs
if: always()
run: docker compose -p agentflow-chaos -f docker-compose.chaos.yml logs --no-color > .artifacts/chaos/docker-compose.log
- name: Upload chaos artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: chaos-smoke-report
path: .artifacts/chaos/
- name: Tear down chaos stack
if: always()
run: docker compose -p agentflow-chaos -f docker-compose.chaos.yml down -v
chaos-full:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -e ".[dev,cloud]" pytest-json-report
- name: Start chaos stack
run: |
mkdir -p .tmp
mkdir -p .artifacts/chaos
docker compose -p agentflow-chaos -f docker-compose.chaos.yml up -d --wait --wait-timeout 120
- name: Run chaos full suite
env:
AGENTFLOW_CHAOS_CI_MODE: "1"
AGENTFLOW_CHAOS_STARTUP_TIMEOUT: "120"
PYTHONUNBUFFERED: "1"
# Dump thread stacks if the interpreter aborts at exit (the known
# intermittent native teardown SIGABRT the guard below tolerates).
PYTHONFAULTHANDLER: "1"
run: |
set +e
python -m pytest tests/chaos/ --ignore=tests/chaos/test_chaos_smoke.py -v --tb=short --json-report --json-report-file=.artifacts/chaos/chaos-report.json
pytest_exit=$?
set -e
# Tolerate ONLY a green-session signal death (post-report native
# teardown abort); real failures propagate. See the script docstring.
python scripts/chaos_teardown_guard.py --report .artifacts/chaos/chaos-report.json --pytest-exit-code "$pytest_exit"
- name: Generate chaos report
if: always()
run: |
python scripts/chaos_report.py \
--input .artifacts/chaos/chaos-report.json \
--output .artifacts/chaos/chaos-summary.json \
--markdown .artifacts/chaos/chaos-summary.md
- name: Collect compose logs
if: always()
run: docker compose -p agentflow-chaos -f docker-compose.chaos.yml logs --no-color > .artifacts/chaos/docker-compose.log
- name: Create issue on failure
if: failure()
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Chaos scheduled run failed — ${new Date().toISOString().split('T')[0]}`,
body: `Workflow run: ${context.payload.workflow_run?.html_url || `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`}\n\nReview logs and investigate which scenario regressed.`,
labels: ['chaos-failure', 'severity:high']
})
- name: Upload chaos artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: chaos-report
path: .artifacts/chaos/
- name: Tear down chaos stack
if: always()
run: docker compose -p agentflow-chaos -f docker-compose.chaos.yml down -v