rapp-playwright/Makefile

36 lines
1.7 KiB
Makefile
Raw Normal View History

SHELL := /bin/bash
IMAGE_REPOSITORY := forgejo.coulomb.social/coulomb/rapp-playwright
TAG ?= 0.1.0
IMAGE_REFERENCE ?=
TARGET ?= railiance01
TRIAL_OUT ?= .local/live-trial
.PHONY: install check test test-integration build render bootstrap-namespace server-dry-run deploy verify-live rollback
install:
npm ci --ignore-scripts
check:
npm run check
python3 -m py_compile client/rapp_playwright.py tools/render.py
test: check
npm test
test-integration:
docker run --rm --init --user 1000:1000 --read-only --tmpfs /tmp:rw,size=512m --shm-size=256m --memory=1g --cpus=1 --cap-drop ALL --security-opt no-new-privileges --mount type=bind,src=$(CURDIR),dst=/app,readonly -w /app mcr.microsoft.com/playwright:v1.64.0-noble@sha256:06a9939e57531807f8d5fd76ce44b53165ffb7d7501d87ab10e285c20b1e971f node --test tests/integration.mjs
build:
docker build -t $(IMAGE_REPOSITORY):$(TAG) .
render:
IMAGE_REFERENCE='$(IMAGE_REFERENCE)' python3 tools/render.py
bootstrap-namespace: render
ssh $(TARGET) 'kubectl apply --server-side --dry-run=server -f -' < .rendered/namespace.yaml
ssh $(TARGET) 'kubectl diff -f -; result=$$?; test $$result -le 1' < .rendered/namespace.yaml
ssh $(TARGET) 'kubectl apply --server-side -f -' < .rendered/namespace.yaml
server-dry-run: render
ssh $(TARGET) 'kubectl apply --server-side --dry-run=server -f -' < .rendered/workload.yaml
deploy: server-dry-run
ssh $(TARGET) 'kubectl diff -f -; result=$$?; test $$result -le 1' < .rendered/workload.yaml
ssh $(TARGET) 'kubectl apply --server-side -f -' < .rendered/workload.yaml
ssh $(TARGET) 'kubectl -n playwright rollout status deployment/playwright --timeout=180s'
verify-live:
python3 client/rapp_playwright.py preflight
python3 client/rapp_playwright.py trial --out '$(TRIAL_OUT)'
rollback: deploy