mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 06:53:14 +00:00
Some checks are pending
Build & publish app artifacts / Publish + deploy (dev) (push) Waiting to run
Build & publish app artifacts / Publish + deploy (prod) (push) Waiting to run
Infra CD / Infra CI (pre-deploy) (push) Waiting to run
Infra CD / Deploy open-swe-dev (push) Blocked by required conditions
Infra CD / Deploy open-swe-prod (push) Blocked by required conditions
Agent CI / Agent lint (push) Waiting to run
Agent CI / Agent format check (push) Waiting to run
Agent CI / Agent unit tests (push) Waiting to run
Agent CI / Playwright E2E (push) Waiting to run
T20 CD safety nets. Two gaps closed before the first real prod deploy: 1. Promotion gate. promote_dev_to_prod.yml previously fast-forwarded dev→main unconditionally. It now hard-gates on check-dev-green.sh: every check-run on the dev HEAD must be completed+passing AND the Agent CI suite (lint/format/unit/E2E) must be present+success, or the promotion blocks (fails safe on a missing/renamed check). The promote run excludes its OWN check-run by run-id (unforgeable), never by the mutable name "promote", so a colliding red check cannot hide. Fields are read with a 0x1F separator so an empty conclusion (every in_progress check) cannot shift columns. ci.yml now also runs on push:dev so dev HEAD actually carries that signal (a PR check alone can be admin-merged past). 2. Rollback + last-good. publish-and-deploy.sh advances releases/last-good/ only after a successful roll (deploy.sh gates on `systemctl is-active`), and makes releases/latest/ transactional — reverting to the prior release if the roll fails so a replaced box never self-deploys a broken release. New rollback.yml + rollback.sh re-point latest at last-good (or an explicit sha) and re-fire the deploy; prod is gated by the `prod` Environment approval, same as a deploy. The shared fire/wait/aggregate-gate logic is factored into roll-box.sh (used by both forward and backward rolls). Least-privilege: drop the unused s3:DeleteObject from the app deploy role — publish/rollback/deploy only Get+Put (S3-to-S3 copy), and the rollback fallback now depends on immutable release history staying intact. Lifecycle expiry (not CI) handles old-version cleanup. Gate logic unit-tested (7 cases + jq round-trip). IAM change + release-safety control cross-reviewed by GPT-4.1: APPROVE, no blocks. Claude-Session: https://claude.ai/code/session_01DMhLf4G5V8MStJQyAW95hi
84 lines
2.8 KiB
YAML
84 lines
2.8 KiB
YAML
name: Rollback (re-point env to a prior release)
|
|
|
|
# Roll an env back to a previously published release without rebuilding. Re-points
|
|
# releases/latest/ at the chosen release and re-fires the open-swe-<env>-deploy SSM
|
|
# document — same fire/wait/gate path as a forward deploy (roll-box.sh).
|
|
#
|
|
# env=dev, sha blank → restore open-swe-dev-assets/releases/last-good/ (AUTO)
|
|
# env=prod, sha blank → restore open-swe-prod-assets/releases/last-good/ (manual
|
|
# approval: Environment "prod", same gate as a prod deploy)
|
|
# sha=<commit> → restore that exact releases/<sha>/ instead of last-good.
|
|
#
|
|
# No new IAM: reuses the githubdeploy-open-swe-app-<env> role's existing releases/*
|
|
# write + tag-scoped ssm:SendCommand. OIDC subject alignment matches build-artifacts:
|
|
# - rollback-dev declares NO `environment:` → sub = repo:…:ref:refs/heads/<branch>
|
|
# - rollback-prod declares `environment: prod` → sub = repo:…:environment:prod
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
env:
|
|
description: "Which environment to roll back"
|
|
required: true
|
|
type: choice
|
|
options: [dev, prod]
|
|
sha:
|
|
description: "Release SHA to restore (blank = releases/last-good)"
|
|
required: false
|
|
type: string
|
|
|
|
concurrency:
|
|
# never overlap a rollback with another rollback/deploy of the same env.
|
|
group: rollback-${{ inputs.env }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
rollback-dev:
|
|
name: Rollback (dev)
|
|
if: ${{ inputs.env == 'dev' }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
env:
|
|
ENV: dev
|
|
BUCKET: open-swe-dev-assets
|
|
DEPLOY_DOC: open-swe-dev-deploy
|
|
TARGET_SHA: ${{ inputs.sha }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: aws-actions/configure-aws-credentials@v6
|
|
with:
|
|
role-to-assume: ${{ vars.AWS_DEPLOY_ROLE_APP_DEV }}
|
|
aws-region: us-east-1
|
|
- name: Re-point releases/latest + redeploy
|
|
run: bash .github/scripts/rollback.sh
|
|
|
|
rollback-prod:
|
|
name: Rollback (prod)
|
|
if: ${{ inputs.env == 'prod' }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
# Manual-approval gate: the "prod" Environment requires a reviewer (Adam). Also
|
|
# makes the OIDC sub …:environment:prod (matches the prod app-role trust).
|
|
environment: prod
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
env:
|
|
ENV: prod
|
|
BUCKET: open-swe-prod-assets
|
|
DEPLOY_DOC: open-swe-prod-deploy
|
|
TARGET_SHA: ${{ inputs.sha }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: aws-actions/configure-aws-credentials@v6
|
|
with:
|
|
role-to-assume: ${{ vars.AWS_DEPLOY_ROLE_APP_PROD }}
|
|
aws-region: us-east-1
|
|
- name: Re-point releases/latest + redeploy
|
|
run: bash .github/scripts/rollback.sh
|