Files
mtusi2026lab7/.gitea/workflows/incidents.yml
T
2026-11-04 23:05:11 +03:00

76 lines
2.5 KiB
YAML

name: Lab 7 inherited incidents
on:
workflow_dispatch:
concurrency:
group: lab7-incidents-${{ github.repository }}-${{ github.ref }}
cancel-in-progress: false
jobs:
incidents:
runs-on: ubuntu-latest
timeout-minutes: 35
env:
COMPOSE_PROJECT_NAME: mtusi2026lab7-incidents-${{ github.run_id }}
API_BIND_ADDRESS: 127.0.0.1:0
SWAGGER_BIND_ADDRESS: 127.0.0.1:0
PROMETHEUS_BIND_ADDRESS: 127.0.0.1:0
GRAFANA_BIND_ADDRESS: 127.0.0.1:0
LOKI_BIND_ADDRESS: 127.0.0.1:0
TEMPO_BIND_ADDRESS: 127.0.0.1:0
steps:
- name: Checkout exact commit
run: |
git init .
git remote add origin https://gitea.privcloud.tech/${{ github.repository }}.git
git fetch --depth=1 origin ${{ github.sha }}
git checkout --detach FETCH_HEAD
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false
- name: Prepare stack
run: |
cp lab7.env.example .env
./infra/pki/bootstrap.sh
docker compose config --quiet
docker compose up -d --build --scale api=2 --wait --wait-timeout 180
docker network connect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME"
docker network connect "${COMPOSE_PROJECT_NAME}_data" "$HOSTNAME"
docker network connect "${COMPOSE_PROJECT_NAME}_monitoring" "$HOSTNAME"
- name: Reproduce SLO incidents
run: |
ENV_FILE=.env \
BASE_URL=https://nginx:8443 \
CA_FILE=.runtime/security/public-ca/ca.crt \
PROMETHEUS_URL=http://prometheus:9090 \
TEMPO_URL=http://tempo:3200 \
LOKI_URL=http://loki:3100 \
EVIDENCE_DIR=evidence/runtime/ci \
make test-lab6
- name: Upload sanitized evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: lab6-incidents-${{ github.sha }}
path: evidence/runtime/ci
if-no-files-found: warn
retention-days: 14
- name: Container logs
if: failure()
run: docker compose logs --no-color --tail=200
- name: Stop local stack
if: always()
run: |
docker network disconnect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_data" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_monitoring" "$HOSTNAME" 2>/dev/null || true
docker compose down -v --remove-orphans