Per-environment platform layers (dev, stage, world0) with restricted pod security, quotas, limit ranges, default-deny networking and token-less service accounts, applied by an administrator rather than Argo. A native ValidatingAdmissionPolicy denies deleting World0 data, identity and Argo objects to every requester without the break-glass group. Stage and World0 Argo projects are scoped to one namespace, World0 blocks automated sync, and a cleanup tool refuses World0. An offline policy check runs as a new CI suite; a live verification script uses only can-i, reads and server dry runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
137 lines
6.0 KiB
YAML
137 lines
6.0 KiB
YAML
name: Foundation
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
code: read
|
|
|
|
env:
|
|
UBUNTU_IMAGE: ${{ vars.UBUNTU_IMAGE || 'ubuntu:24.04' }}
|
|
|
|
jobs:
|
|
checks:
|
|
runs-on: ${{ vars.CI_RUNNER_LABEL || 'ubuntu-22.04' }}
|
|
timeout-minutes: 40
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
suite: [checks, tsan, ecs, postgres, deploy]
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Build and execute Linux checks
|
|
env:
|
|
CHECK_SUITE: ${{ matrix.suite }}
|
|
run: |
|
|
set -eu
|
|
docker version
|
|
ci_image="aevolution-ci:${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-$CHECK_SUITE"
|
|
docker build --progress=plain --file deploy/docker/Dockerfile \
|
|
--build-arg "UBUNTU_IMAGE=$UBUNTU_IMAGE" \
|
|
--target "ci-$CHECK_SUITE" --tag "$ci_image" .
|
|
if [ "$CHECK_SUITE" = tsan ]; then
|
|
profile="$RUNNER_TEMP/aevolution-tsan-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}.json"
|
|
node tools/ci/tsan-profile.mjs "$profile"
|
|
docker run --rm --network none --read-only --user 10001:10001 \
|
|
--cap-drop ALL --security-opt no-new-privileges \
|
|
--security-opt "seccomp=$profile" \
|
|
--tmpfs /source/build/tsan/Testing:rw,noexec,nosuid,size=16m,mode=1777 \
|
|
--tmpfs /source/build/tsan/cli-integration:rw,noexec,nosuid,size=16m,mode=1777 \
|
|
--tmpfs /source/build/tsan/world-proof:rw,noexec,nosuid,size=16m,mode=1777 \
|
|
--tmpfs /tmp:rw,noexec,nosuid,size=16m,mode=1777 "$ci_image"
|
|
fi
|
|
|
|
postgres-tools:
|
|
needs: [checks]
|
|
runs-on: ${{ vars.CI_RUNNER_LABEL || 'ubuntu-22.04' }}
|
|
timeout-minutes: 40
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
with:
|
|
persist-credentials: false
|
|
- name: Build and smoke-test migration tooling
|
|
run: |
|
|
set -eu
|
|
docker build --file deploy/docker/Dockerfile --target postgres-tools \
|
|
--build-arg "UBUNTU_IMAGE=$UBUNTU_IMAGE" \
|
|
--tag "aevolution-postgres-tools:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" .
|
|
docker run --rm --network none --read-only --cap-drop ALL \
|
|
--entrypoint /opt/postgres/bin/psql \
|
|
"aevolution-postgres-tools:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" --version
|
|
- name: Publish configured migration tools
|
|
if: ${{ gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request' && vars.HARBOR_POSTGRES_REPOSITORY != '' }}
|
|
env:
|
|
HARBOR_PROJECT: ${{ vars.HARBOR_PROJECT }}
|
|
HARBOR_REPOSITORY: ${{ vars.HARBOR_POSTGRES_REPOSITORY }}
|
|
HARBOR_USERNAME: ${{ secrets.HARBOR_USERNAME }}
|
|
HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }}
|
|
run: |
|
|
export SOURCE_IMAGE="aevolution-postgres-tools:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
bash tools/ci/publish-image.sh
|
|
|
|
server-image:
|
|
needs: [checks]
|
|
runs-on: ${{ vars.CI_RUNNER_LABEL || 'ubuntu-22.04' }}
|
|
timeout-minutes: 60
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
with:
|
|
persist-credentials: false
|
|
- name: Build and smoke-test the region server image
|
|
run: |
|
|
set -eu
|
|
image="aevolution-server:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
docker build --file deploy/docker/Dockerfile --target server-runtime --build-arg "UBUNTU_IMAGE=$UBUNTU_IMAGE" --tag "$image" .
|
|
bash tools/ci/server-image-smoke.sh "$image"
|
|
- name: Publish configured region server image
|
|
if: ${{ gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request' && vars.HARBOR_SERVER_REPOSITORY != '' }}
|
|
env:
|
|
HARBOR_PROJECT: ${{ vars.HARBOR_PROJECT }}
|
|
HARBOR_REPOSITORY: ${{ vars.HARBOR_SERVER_REPOSITORY }}
|
|
HARBOR_USERNAME: ${{ secrets.HARBOR_USERNAME }}
|
|
HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }}
|
|
run: |
|
|
export SOURCE_IMAGE="aevolution-server:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
bash tools/ci/publish-image.sh
|
|
|
|
image:
|
|
needs: [checks]
|
|
runs-on: ${{ vars.CI_RUNNER_LABEL || 'ubuntu-22.04' }}
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Build and smoke-test runtime
|
|
run: |
|
|
set -eu
|
|
image="aevolution-proof:${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
docker build --progress=plain --file deploy/docker/Dockerfile \
|
|
--build-arg "UBUNTU_IMAGE=$UBUNTU_IMAGE" \
|
|
--label "org.opencontainers.image.revision=$GITHUB_SHA" \
|
|
--label "org.opencontainers.image.source=https://git.aeternalisgames.com/dingo/AEvolution" \
|
|
--tag "$image" .
|
|
docker run --rm --network none --read-only --cap-drop ALL \
|
|
--security-opt no-new-privileges "$image" \
|
|
--seed 123456 --entities 8 --ticks 1000 --verify-replay
|
|
- name: Publish configured main build to Harbor
|
|
if: ${{ gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request' && vars.HARBOR_PROJECT != '' }}
|
|
env:
|
|
HARBOR_PROJECT: ${{ vars.HARBOR_PROJECT }}
|
|
HARBOR_REPOSITORY: ${{ vars.HARBOR_REPOSITORY || 'aevolution' }}
|
|
HARBOR_USERNAME: ${{ secrets.HARBOR_USERNAME }}
|
|
HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }}
|
|
run: bash tools/ci/publish-image.sh
|
|
- name: Explain unconfigured publishing
|
|
if: ${{ vars.HARBOR_PROJECT == '' }}
|
|
run: echo 'Image build/smoke only. Set HARBOR_PROJECT and Harbor robot secrets to enable main publishing. See deploy/README.md.'
|