fix(scripts): migrate ghcr.io→ECR + raw.githubusercontent.com→Gitea (#46) #16
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/script-ghcr-and-lint-paths"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes the runtime-breaking ghcr.io shell-script references + the workflow-only-audit-missed lint script that documentation-specialist's grep agent surfaced (see internal#46). 6 files / 11 substitutions.
These are the highest-priority post-suspension fixes from §3 + §7 of the Gitea Actions Migration Checklist runbook.
Files changed (6)
.github/scripts/lint_secret_pattern_drift.pypre-commit-checks.shconsumer URL:raw.githubusercontent.com→ Gitea/raw/branch/main/. Lint job runs in CI; would 404 today. Slip-past-workflow finding — security-auditor's.github/workflows/-only sweep missed this because it lives under.github/scripts/.scripts/refresh-workspace-images.shghcr.io/molecule-ai/...→ ECR (153263036946.dkr.ecr.us-east-2.amazonaws.com/molecule-ai/...).scripts/rollback-latest.shghcr.io→ ECR;GITHUB_TOKEN write:packages→aws ecr get-login-password. Per saved memoryreference_post_suspension_pipeline, prod cutover is to ECR. Updated header docs to match.scripts/demo-freeze.shghcr → ECR; the script doesn't currently exec these URLs but the comments describe the cascade and need to match reality.docker-compose.ymlghcr.io→ ECR. Auth comment updated to describeaws ecr get-login-passwordflow.tools/check-template-parity.shraw.githubusercontent.com→ Gitea/raw/branch/main/.Phase 2 design
SSOT decision: each affected file is its own SSOT for the URL it embeds. No central table to update.
Alternatives considered:
A. Per-file URL-substitution (chosen). Smallest change; each file's behavior continues post-fix.
B. Extract to a
REGISTRY_HOSTenv var or shared constant. Better for future migrations; bigger change for now. Rejected because the migration is one-shot — re-introducing parameterization for a single-direction transition is overkill.C. Keep ghcr.io with auth migration ❌ rejected — the GitHub org is suspended; ghcr.io for
molecule-ai/*returns 404.Security check:
lint_secret_pattern_drift.pyreads + diffs a remote file's content vs local. New URL points at a public Gitea raw endpoint; no credential transmission. Drift detection semantics unchanged.rollback-latest.shswitches fromGITHUB_TOKEN(long-lived, broad scope) toaws ecr get-login-password(short-lived, ECR-scoped). Strict improvement — credential lifetime + scope both narrowed.docker-compose.ymlauth migration similar — replaces long-lived GitHub PAT with short-lived AWS credential.No new attack surface. Fail-closed on auth failure (existing scripts also fail-closed). On the record.
Versioning + back-compat:
rollback-latest.shis operator-facing; the change is observable (GITHUB_TOKENenv var no longer needed;awsCLI now required). Operators using this script must reconfigure their auth. Documented in updated header. Failure mode if they haven't:aws: command not installed— clear, not silent.docker-compose.ymlfor local dev: same — operators needaws ecr get-login-passwordinstead ofdocker login ghcr.io. Comment updated.Phase 4 verification
python3 -c "import urllib.request; r = urllib.request.Request('https://git.moleculesai.app/molecule-ai/molecule-ai-workspace-runtime/raw/branch/main/molecule_runtime/scripts/pre-commit-checks.sh', headers={'Authorization': 'token ' + open('/Users/hongming/.molecule-ai/gitea-token').read().strip()}); print(urllib.request.urlopen(r).status)"⇒ should be 200 (verified out-of-band; pre-commit-checks.sh exists in the workspace-runtime mirror).bash -n <script>for syntax. Behavior verification (actual ECR pull) requires aws-CLI auth and is out of CI scope; operator runs it next time they rollback.docker compose configparses cleanly post-edit (verified).DoD
Mostly script-edit + a single python list update. No tests added (URLs are not unit-testable in isolation). No observation window needed (not a long-running surface). Back-compat: documented operator-side change for rollback-latest.sh. Security: improved (long→short-lived credentials).
Hostile self-review (3 weakest spots)
rollback-latest.shauth-flow swap is a real behavior change. Operators using this script need aws CLI authenticated for region us-east-2 with ECR pull/push. Documented in updated header. Mitigation: failure mode is loud (aws: command not installed), not silent. Accepted: alternative (keep GHCR auth) is broken./raw/branch/main/) differs from GitHub'sraw.githubusercontent.com/.../main/. Verified pattern by inspecting other Gitea raw URLs in the codebase. Mitigation: if Gitea's URL changes (1.23+), update via the same one-line edit. Accepted: stable for Gitea 1.22.packer/scripts/install-base.shwhich has a similar ghcr.io ref per the grep agent's findings (line 134). That's in molecule-controlplane-ish territory (packer-build pipeline) — separate concern. Filed implicitly under internal#46. Same fix pattern when picked up.Refs: internal#46, internal#37, internal#38. Saved memory:
reference_post_suspension_pipeline.Doc-sweep / install-path migration. Independent review.