fix deploy: preserve bootstrap-tier creds from .env, never rotate RustFS
Some checks are pending
ci/woodpecker/push/deploy Pipeline is running
ci/woodpecker/push/infra-ci Pipeline was successful
coverage 99% coverage
ci/woodpecker/push/ci Pipeline was successful

BOOTSTRAP-tier credentials (POSTGRES_PASSWORD, RUSTFS_ACCESS_KEY,
RUSTFS_SECRET_KEY, WOODPECKER_AGENT_SECRET) are set during initial
bootstrap and stored on disk by backends. Rotating them via env vars
crashes RustFS (IAM mismatch) and breaks postgres auth.

deploy.py now reads current .env and overrides all BOOTSTRAP-tier
values in the derived dict, so they're preserved through rotation.
Only SERVICE-tier credentials (per-commit) get new derived values.
This commit is contained in:
kert
2026-03-23 12:01:08 -04:00
parent 70688c8b9c
commit dd19c3b566

View File

@@ -145,6 +145,21 @@ def deploy(
k, _, v = line.partition("=")
current_env[k.strip()] = v.strip()
# Preserve BOOTSTRAP-tier credentials from current .env.
# These were set during initial bootstrap and must NOT be rotated
# (RustFS stores IAM on disk; changing env vars crashes it).
from api.auth.manifest import CREDENTIALS, Provisioner, Tier
bootstrap_vars = {
c.env_var
for c in CREDENTIALS
if c.tier is Tier.BOOTSTRAP and c.provisioner is not Provisioner.SKIP
}
for var in bootstrap_vars:
if var in current_env:
values[var] = current_env[var]
log.info("Preserved %d bootstrap-tier credentials from .env", len(bootstrap_vars))
# Use current GITEA_TOKEN (derived one is just a hash placeholder)
if current_env.get("GITEA_TOKEN"):
values["GITEA_TOKEN"] = current_env["GITEA_TOKEN"]