|
| 1 | +--- |
| 2 | +name: pin_upstream_images |
| 3 | +description: Pin multigres container image tags in image_defaults.go for operator releases. Compares upstream multigres code changes between the current and new SHA, highlights breaking changes and new features, then updates the tags. Triggered by user requests like "prepare images for release", "pin image tags", "pin upstream images", or "upgrade multigres images". |
| 4 | +--- |
| 5 | + |
| 6 | +# Pin Upstream Images |
| 7 | + |
| 8 | +Upgrade multigres container image tags in `api/v1alpha1/image_defaults.go` to the latest SHA tags, with an upstream code review between the old and new versions. |
| 9 | + |
| 10 | +## Workflow |
| 11 | + |
| 12 | +### 1. Fetch Latest SHA Tags |
| 13 | + |
| 14 | +Run the fetch script to get the latest SHA tags: |
| 15 | + |
| 16 | +```bash |
| 17 | +python3 tools/skills/pin_upstream_images/scripts/fetch_latest_tags.py |
| 18 | +``` |
| 19 | + |
| 20 | +This outputs `KEY_TAG=sha-XXXXXXX` for each image. The script resolves which `sha-*` tag currently points to the same digest as `main` for each of: |
| 21 | +- `ghcr.io/multigres/multigres` -> used by DefaultMultiAdminImage, DefaultMultiOrchImage, DefaultMultiPoolerImage, DefaultMultiGatewayImage |
| 22 | +- `ghcr.io/multigres/pgctld` -> used by DefaultPostgresImage |
| 23 | +- `ghcr.io/multigres/multiadmin-web` -> used by DefaultMultiAdminWebImage |
| 24 | + |
| 25 | +### 2. Update Image Tags |
| 26 | + |
| 27 | +Immediately update `api/v1alpha1/image_defaults.go` by replacing the old `sha-XXXXXXX` tags with the new ones: |
| 28 | + |
| 29 | +| Constant | Image | Tag source | |
| 30 | +|----------------------------|------------------------------------|-----------------| |
| 31 | +| DefaultPostgresImage | ghcr.io/multigres/pgctld | PGCTLD_TAG | |
| 32 | +| DefaultMultiAdminImage | ghcr.io/multigres/multigres | MULTIGRES_TAG | |
| 33 | +| DefaultMultiAdminWebImage | ghcr.io/multigres/multiadmin-web | MULTIADMIN_WEB_TAG | |
| 34 | +| DefaultMultiOrchImage | ghcr.io/multigres/multigres | MULTIGRES_TAG | |
| 35 | +| DefaultMultiPoolerImage | ghcr.io/multigres/multigres | MULTIGRES_TAG | |
| 36 | +| DefaultMultiGatewayImage | ghcr.io/multigres/multigres | MULTIGRES_TAG | |
| 37 | + |
| 38 | +Do NOT modify DefaultEtcdImage -- it uses a separate versioned release. |
| 39 | + |
| 40 | +If old and new SHAs are identical for all images, inform the user that images are already up to date and stop. |
| 41 | + |
| 42 | +### 3. Upstream Code Comparison |
| 43 | + |
| 44 | +All multigres images (`multigres`, `pgctld`, `multiadmin-web`) are built from the same monorepo: `https://github.com/multigres/multigres`. Perform the comparison there. |
| 45 | + |
| 46 | +1. Clone or pull the upstream multigres repo to `/tmp/multigres`: |
| 47 | + ```bash |
| 48 | + if [ -d /tmp/multigres ]; then |
| 49 | + cd /tmp/multigres && git fetch --all && git checkout main && git pull |
| 50 | + else |
| 51 | + git clone https://github.com/multigres/multigres /tmp/multigres |
| 52 | + fi |
| 53 | + ``` |
| 54 | + |
| 55 | +2. Identify the unique old and new SHA values from Step 2. Since `multigres/multigres` and `multigres/pgctld` may have different SHA tags, compare each distinct old->new pair. Typically: |
| 56 | + - **MULTIGRES_TAG** old SHA vs new SHA (covers multiadmin, multiorch, multipooler, multigateway, and pgctld if they share the same SHA) |
| 57 | + - **MULTIADMIN_WEB_TAG** old SHA vs new SHA (if different from the above) |
| 58 | + |
| 59 | +3. For each distinct old->new SHA pair, run: |
| 60 | + ```bash |
| 61 | + cd /tmp/multigres |
| 62 | + git log --oneline <old-sha>..<new-sha> |
| 63 | + git diff --stat <old-sha>..<new-sha> |
| 64 | + ``` |
| 65 | + Then selectively review the full diff for files that look relevant to the operator (e.g., changes to CLI flags, configuration, proto definitions, RPC interfaces, container entrypoints, health checks, pooler behavior, orchestrator logic, gateway behavior, backup/restore, topology management). |
| 66 | + |
| 67 | +4. If the old and new SHAs are the same for an image group, note that no changes occurred and skip the diff. |
| 68 | + |
| 69 | +### 4. Cross-Reference with Operator Code |
| 70 | + |
| 71 | +This is the critical step. Do NOT make hypothetical recommendations. For each upstream change identified in Step 3, **search the operator codebase** to determine concrete impact. |
| 72 | + |
| 73 | +For every potentially impactful upstream change: |
| 74 | + |
| 75 | +1. **Search the operator code** using `grep_search`, `view_file_outline`, and `view_code_item` to find whether the operator references, uses, or depends on the changed upstream construct (proto field, gRPC service, CLI flag, topology record field, behavior, etc.). |
| 76 | + |
| 77 | +2. **Classify each change with evidence:** |
| 78 | + - **Action required** -- The operator code directly references or depends on something that changed. Cite the exact file and line in the operator. Describe what needs to change and why. |
| 79 | + - **New feature opportunity** -- The upstream change introduces a capability the operator *could* support but currently does not. Cite what the upstream change adds and confirm the operator has no existing support for it. |
| 80 | + - **No impact** -- The upstream change does not touch anything the operator interacts with. Confirm this by showing the search came up empty. |
| 81 | + |
| 82 | +3. **Do not speculate.** Every recommendation must be backed by a concrete search result (or confirmed absence) in the operator codebase. No "if the operator does X" phrasing -- either it does or it doesn't. |
| 83 | + |
| 84 | +### 5. Present Results |
| 85 | + |
| 86 | +Present a structured summary to the user: |
| 87 | + |
| 88 | +**Commits between old and new:** |
| 89 | +- List of commit messages (from `git log --oneline`) |
| 90 | + |
| 91 | +**Impact Analysis:** |
| 92 | +For each upstream change, include: |
| 93 | +- What changed upstream (one-liner) |
| 94 | +- Operator files affected (with file paths and line references) or "none found" |
| 95 | +- Verdict: **Action required** / **New feature opportunity** / **No impact** |
| 96 | +- For action-required items: specific description of what needs to change in the operator |
| 97 | + |
| 98 | +### 6. Finalize |
| 99 | + |
| 100 | +1. Display the `image_defaults.go` diff to the user. |
| 101 | + |
| 102 | +2. Suggest a branch name and generate a commit message using the `generate_commit_message` skill: |
| 103 | + - Branch name: `release/pin-image-tags-YYYY-MM-DD` |
| 104 | + - The commit message should reference upgrading multigres images and include the old->new SHA transitions |
0 commit comments