forked from mtusi2026/mtusi2026lab7
ci: verify lab7 over HTTPS
This commit is contained in:
+12
-12
@@ -16,7 +16,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
env:
|
env:
|
||||||
COMPOSE_PROJECT_NAME: mtusi2026lab6-${{ github.run_id }}
|
COMPOSE_PROJECT_NAME: mtusi2026lab7-${{ github.run_id }}
|
||||||
API_BIND_ADDRESS: 127.0.0.1:0
|
API_BIND_ADDRESS: 127.0.0.1:0
|
||||||
SWAGGER_BIND_ADDRESS: 127.0.0.1:0
|
SWAGGER_BIND_ADDRESS: 127.0.0.1:0
|
||||||
PROMETHEUS_BIND_ADDRESS: 127.0.0.1:0
|
PROMETHEUS_BIND_ADDRESS: 127.0.0.1:0
|
||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
- name: Check formatting and shell scripts
|
- name: Check formatting and shell scripts
|
||||||
run: |
|
run: |
|
||||||
test -z "$(gofmt -l cmd internal migrations)"
|
test -z "$(gofmt -l cmd internal migrations)"
|
||||||
sh -n infra/minio/bootstrap.sh scripts/restart.sh scripts/rolling-update.sh scripts/stop-one.sh scripts/test-lab5.sh scripts/test-lab5-acceptance.sh scripts/test-lab6.sh scripts/incident-worker.sh scripts/incident-database.sh scripts/incident-telemetry.sh
|
sh -n infra/minio/bootstrap.sh infra/pki/bootstrap.sh infra/pki/install.sh scripts/restart.sh scripts/rolling-update.sh scripts/stop-one.sh scripts/test-lab5.sh scripts/test-lab5-acceptance.sh scripts/test-lab6.sh scripts/test-tls-matrix.sh scripts/incident-worker.sh scripts/incident-database.sh scripts/incident-telemetry.sh
|
||||||
python3 -m py_compile scripts/lab6-traffic.py scripts/lab6-observe.py scripts/lab6-alert.py scripts/lab6-correlation.py scripts/validate-lab6-evidence.py
|
python3 -m py_compile scripts/lab6-traffic.py scripts/lab6-observe.py scripts/lab6-alert.py scripts/lab6-correlation.py scripts/validate-lab6-evidence.py
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
@@ -65,7 +65,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare local stack
|
- name: Prepare local stack
|
||||||
run: |
|
run: |
|
||||||
cp lab6.env.example .env
|
cp lab7.env.example .env
|
||||||
|
./infra/pki/bootstrap.sh
|
||||||
docker compose config --quiet
|
docker compose config --quiet
|
||||||
docker compose up -d --build --scale api=2 --wait --wait-timeout 150
|
docker compose up -d --build --scale api=2 --wait --wait-timeout 150
|
||||||
docker network connect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME"
|
docker network connect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME"
|
||||||
@@ -74,19 +75,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Integration checks
|
- name: Integration checks
|
||||||
run: |
|
run: |
|
||||||
set -a
|
test "$(curl --noproxy '*' -s -o /dev/null -w '%{http_code}' "http://s3:9000/messenger-attachments")" = "403"
|
||||||
. ./.env
|
make test BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
|
||||||
set +a
|
make test-security BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
|
||||||
test "$(curl --noproxy '*' -s -o /dev/null -w '%{http_code}' "http://s3:9000/$S3_BUCKET")" = "403"
|
make test-tls-matrix
|
||||||
make test BASE_URL=http://nginx:8080
|
|
||||||
docker compose --profile tests run --rm --build tests
|
docker compose --profile tests run --rm --build tests
|
||||||
go run ./cmd/dependencycheck -base-url=http://nginx:8080
|
go run ./cmd/dependencycheck -base-url=https://nginx:8443 -ca-file=.runtime/security/public-ca/ca.crt
|
||||||
make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=http://nginx:8080
|
make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
|
||||||
make test-failover ACTION_SCRIPT=scripts/stop-one.sh BASE_URL=http://nginx:8080
|
make test-failover ACTION_SCRIPT=scripts/stop-one.sh BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
|
||||||
docker compose up -d --scale api=2 --wait --wait-timeout 90
|
docker compose up -d --scale api=2 --wait --wait-timeout 90
|
||||||
make test-lab5-acceptance
|
make test-lab5-acceptance
|
||||||
make test-lab5
|
make test-lab5
|
||||||
ENV_FILE=.env PROMETHEUS_URL=http://prometheus:9090 TEMPO_URL=http://tempo:3200 LOKI_URL=http://loki:3100 make test-lab6-smoke BASE_URL=http://nginx:8080
|
ENV_FILE=.env CA_FILE=.runtime/security/public-ca/ca.crt PROMETHEUS_URL=http://prometheus:9090 TEMPO_URL=http://tempo:3200 LOKI_URL=http://loki:3100 make test-lab6-smoke BASE_URL=https://nginx:8443
|
||||||
|
|
||||||
- name: Container logs
|
- name: Container logs
|
||||||
if: failure()
|
if: failure()
|
||||||
|
|||||||
+22
-22
@@ -22,7 +22,7 @@ jobs:
|
|||||||
s3_image: ${{ steps.publish.outputs.s3_image }}
|
s3_image: ${{ steps.publish.outputs.s3_image }}
|
||||||
s3_bootstrap_image: ${{ steps.publish.outputs.s3_bootstrap_image }}
|
s3_bootstrap_image: ${{ steps.publish.outputs.s3_bootstrap_image }}
|
||||||
env:
|
env:
|
||||||
COMPOSE_PROJECT_NAME: mtusi2026lab6-deploy-${{ github.run_id }}
|
COMPOSE_PROJECT_NAME: mtusi2026lab7-deploy-${{ github.run_id }}
|
||||||
COMPOSE_FILE: compose.yaml:deploy/compose.images.yaml
|
COMPOSE_FILE: compose.yaml:deploy/compose.images.yaml
|
||||||
API_BIND_ADDRESS: 127.0.0.1:0
|
API_BIND_ADDRESS: 127.0.0.1:0
|
||||||
SWAGGER_BIND_ADDRESS: 127.0.0.1:0
|
SWAGGER_BIND_ADDRESS: 127.0.0.1:0
|
||||||
@@ -30,13 +30,13 @@ jobs:
|
|||||||
GRAFANA_BIND_ADDRESS: 127.0.0.1:0
|
GRAFANA_BIND_ADDRESS: 127.0.0.1:0
|
||||||
LOKI_BIND_ADDRESS: 127.0.0.1:0
|
LOKI_BIND_ADDRESS: 127.0.0.1:0
|
||||||
TEMPO_BIND_ADDRESS: 127.0.0.1:0
|
TEMPO_BIND_ADDRESS: 127.0.0.1:0
|
||||||
API_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab6-api:${{ github.sha }}
|
API_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-api:${{ github.sha }}
|
||||||
NGINX_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab6-nginx:${{ github.sha }}
|
NGINX_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-nginx:${{ github.sha }}
|
||||||
SWAGGER_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab6-swagger:${{ github.sha }}
|
SWAGGER_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-swagger:${{ github.sha }}
|
||||||
PROMETHEUS_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab6-prometheus:${{ github.sha }}
|
PROMETHEUS_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-prometheus:${{ github.sha }}
|
||||||
GRAFANA_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab6-grafana:${{ github.sha }}
|
GRAFANA_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-grafana:${{ github.sha }}
|
||||||
S3_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab6-minio:${{ github.sha }}
|
S3_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-minio:${{ github.sha }}
|
||||||
S3_BOOTSTRAP_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab6-minio-client:${{ github.sha }}
|
S3_BOOTSTRAP_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-minio-client:${{ github.sha }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout exact commit
|
- name: Checkout exact commit
|
||||||
run: |
|
run: |
|
||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
- name: Check formatting and shell scripts
|
- name: Check formatting and shell scripts
|
||||||
run: |
|
run: |
|
||||||
test -z "$(gofmt -l cmd internal migrations)"
|
test -z "$(gofmt -l cmd internal migrations)"
|
||||||
sh -n infra/minio/bootstrap.sh scripts/restart.sh scripts/rolling-update.sh scripts/stop-one.sh scripts/test-lab5.sh scripts/test-lab5-acceptance.sh scripts/test-lab6.sh scripts/incident-worker.sh scripts/incident-database.sh scripts/incident-telemetry.sh
|
sh -n infra/minio/bootstrap.sh infra/pki/bootstrap.sh infra/pki/install.sh scripts/restart.sh scripts/rolling-update.sh scripts/stop-one.sh scripts/test-lab5.sh scripts/test-lab5-acceptance.sh scripts/test-lab6.sh scripts/test-tls-matrix.sh scripts/incident-worker.sh scripts/incident-database.sh scripts/incident-telemetry.sh
|
||||||
python3 -m py_compile scripts/lab6-traffic.py scripts/lab6-observe.py scripts/lab6-alert.py scripts/lab6-correlation.py scripts/validate-lab6-evidence.py
|
python3 -m py_compile scripts/lab6-traffic.py scripts/lab6-observe.py scripts/lab6-alert.py scripts/lab6-correlation.py scripts/validate-lab6-evidence.py
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
@@ -79,7 +79,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare local stack
|
- name: Prepare local stack
|
||||||
run: |
|
run: |
|
||||||
cp lab6.env.example .env
|
cp lab7.env.example .env
|
||||||
|
./infra/pki/bootstrap.sh
|
||||||
docker compose config --quiet
|
docker compose config --quiet
|
||||||
docker compose up -d --build --scale api=2 --wait --wait-timeout 150
|
docker compose up -d --build --scale api=2 --wait --wait-timeout 150
|
||||||
docker network connect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME"
|
docker network connect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME"
|
||||||
@@ -88,18 +89,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Integration checks
|
- name: Integration checks
|
||||||
run: |
|
run: |
|
||||||
set -a
|
test "$(curl --noproxy '*' -s -o /dev/null -w '%{http_code}' "http://s3:9000/messenger-attachments")" = "403"
|
||||||
. ./.env
|
make test BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
|
||||||
set +a
|
make test-security BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
|
||||||
test "$(curl --noproxy '*' -s -o /dev/null -w '%{http_code}' "http://s3:9000/$S3_BUCKET")" = "403"
|
make test-tls-matrix
|
||||||
make test BASE_URL=http://nginx:8080
|
|
||||||
docker compose --profile tests run --rm --build tests
|
docker compose --profile tests run --rm --build tests
|
||||||
go run ./cmd/dependencycheck -base-url=http://nginx:8080
|
go run ./cmd/dependencycheck -base-url=https://nginx:8443 -ca-file=.runtime/security/public-ca/ca.crt
|
||||||
make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=http://nginx:8080
|
make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
|
||||||
make test-failover ACTION_SCRIPT=scripts/stop-one.sh BASE_URL=http://nginx:8080
|
make test-failover ACTION_SCRIPT=scripts/stop-one.sh BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
|
||||||
make test-lab5-acceptance
|
make test-lab5-acceptance
|
||||||
make test-lab5
|
make test-lab5
|
||||||
ENV_FILE=.env PROMETHEUS_URL=http://prometheus:9090 TEMPO_URL=http://tempo:3200 LOKI_URL=http://loki:3100 make test-lab6-smoke BASE_URL=http://nginx:8080
|
ENV_FILE=.env CA_FILE=.runtime/security/public-ca/ca.crt PROMETHEUS_URL=http://prometheus:9090 TEMPO_URL=http://tempo:3200 LOKI_URL=http://loki:3100 make test-lab6-smoke BASE_URL=https://nginx:8443
|
||||||
|
|
||||||
- name: Publish verified images
|
- name: Publish verified images
|
||||||
id: publish
|
id: publish
|
||||||
@@ -177,17 +177,17 @@ jobs:
|
|||||||
run: printf '%s' "$REGISTRY_PASSWORD" | ssh "$DEPLOY_USER@$DEPLOY_HOST" "docker login gitea.privcloud.tech --username '$REGISTRY_USERNAME' --password-stdin"
|
run: printf '%s' "$REGISTRY_PASSWORD" | ssh "$DEPLOY_USER@$DEPLOY_HOST" "docker login gitea.privcloud.tech --username '$REGISTRY_USERNAME' --password-stdin"
|
||||||
|
|
||||||
- name: Upload image manifest
|
- name: Upload image manifest
|
||||||
run: scp deploy-images.env "$DEPLOY_USER@$DEPLOY_HOST:/tmp/mtusi2026lab6-${{ github.run_id }}.env"
|
run: scp deploy-images.env "$DEPLOY_USER@$DEPLOY_HOST:/tmp/mtusi2026lab7-${{ github.run_id }}.env"
|
||||||
|
|
||||||
- name: Deploy and verify
|
- name: Deploy and verify
|
||||||
run: |
|
run: |
|
||||||
ssh "$DEPLOY_USER@$DEPLOY_HOST" "
|
ssh "$DEPLOY_USER@$DEPLOY_HOST" "
|
||||||
set -eu
|
set -eu
|
||||||
cd ~/mtusi2026lab6
|
cd ~/mtusi2026lab7
|
||||||
git fetch origin main
|
git fetch origin main
|
||||||
git cat-file -e '$DEPLOY_SHA^{commit}'
|
git cat-file -e '$DEPLOY_SHA^{commit}'
|
||||||
git reset --hard '$DEPLOY_SHA'
|
git reset --hard '$DEPLOY_SHA'
|
||||||
manifest='/tmp/mtusi2026lab6-${{ github.run_id }}.env'
|
manifest='/tmp/mtusi2026lab7-${{ github.run_id }}.env'
|
||||||
if DEPLOY_GENERATION='${{ github.run_id }}' scripts/rolling-update.sh \"\$manifest\"; then
|
if DEPLOY_GENERATION='${{ github.run_id }}' scripts/rolling-update.sh \"\$manifest\"; then
|
||||||
rm -f \"\$manifest\"
|
rm -f \"\$manifest\"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
name: Lab 6 incidents
|
name: Lab 7 inherited incidents
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: lab6-incidents-${{ github.repository }}-${{ github.ref }}
|
group: lab7-incidents-${{ github.repository }}-${{ github.ref }}
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 35
|
timeout-minutes: 35
|
||||||
env:
|
env:
|
||||||
COMPOSE_PROJECT_NAME: mtusi2026lab6-incidents-${{ github.run_id }}
|
COMPOSE_PROJECT_NAME: mtusi2026lab7-incidents-${{ github.run_id }}
|
||||||
API_BIND_ADDRESS: 127.0.0.1:0
|
API_BIND_ADDRESS: 127.0.0.1:0
|
||||||
SWAGGER_BIND_ADDRESS: 127.0.0.1:0
|
SWAGGER_BIND_ADDRESS: 127.0.0.1:0
|
||||||
PROMETHEUS_BIND_ADDRESS: 127.0.0.1:0
|
PROMETHEUS_BIND_ADDRESS: 127.0.0.1:0
|
||||||
@@ -34,7 +34,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare stack
|
- name: Prepare stack
|
||||||
run: |
|
run: |
|
||||||
cp lab6.env.example .env
|
cp lab7.env.example .env
|
||||||
|
./infra/pki/bootstrap.sh
|
||||||
docker compose config --quiet
|
docker compose config --quiet
|
||||||
docker compose up -d --build --scale api=2 --wait --wait-timeout 180
|
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}_application" "$HOSTNAME"
|
||||||
@@ -44,7 +45,8 @@ jobs:
|
|||||||
- name: Reproduce SLO incidents
|
- name: Reproduce SLO incidents
|
||||||
run: |
|
run: |
|
||||||
ENV_FILE=.env \
|
ENV_FILE=.env \
|
||||||
BASE_URL=http://nginx:8080 \
|
BASE_URL=https://nginx:8443 \
|
||||||
|
CA_FILE=.runtime/security/public-ca/ca.crt \
|
||||||
PROMETHEUS_URL=http://prometheus:9090 \
|
PROMETHEUS_URL=http://prometheus:9090 \
|
||||||
TEMPO_URL=http://tempo:3200 \
|
TEMPO_URL=http://tempo:3200 \
|
||||||
LOKI_URL=http://loki:3100 \
|
LOKI_URL=http://loki:3100 \
|
||||||
|
|||||||
Reference in New Issue
Block a user