Skip to content

fix(workflows): clean temp arch tags after merge#18

Open
imbajin wants to merge 1 commit intomasterfrom
clean-tags
Open

fix(workflows): clean temp arch tags after merge#18
imbajin wants to merge 1 commit intomasterfrom
clean-tags

Conversation

@imbajin
Copy link
Collaborator

@imbajin imbajin commented Mar 22, 2026

  • add Docker Hub tag cleanup after successful manifest publish in pd/store/server flow
  • keep partial amd64 availability when arm64 fails by cleaning only in publish_manifest job
  • document the critical pd/store/server release pipeline with an ASCII workflow diagram
  • align AGENTS.md with the staged dual-arch publish and cleanup semantics

Summary by CodeRabbit

发布说明

  • 文档

    • 更新了发布工作流程文档,明确说明 pd/store/server 模块使用专用发布流程,包括预检查和分阶段的多架构构建与清理语义。
  • 维护

    • 添加了自动清理功能,在清单发布成功后删除临时架构标签,确保构建过程中的临时工件得到及时清理。

- add Docker Hub tag cleanup after successful manifest publish in pd/store/server flow
- keep partial amd64 availability when arm64 fails by cleaning only in publish_manifest job
- document the critical pd/store/server release pipeline with an ASCII workflow diagram
- align AGENTS.md with the staged dual-arch publish and cleanup semantics
Copilot AI review requested due to automatic review settings March 22, 2026 15:33
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 22, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

工作流程说明

pd/store/server 的 Docker 镜像发布工作流中,添加了 manifest 发布后的清理步骤,用于删除临时的单架构标签(amd64arm64),同时更新了对应的文档以阐明完整的发布流程和错误处理策略。

变更

集合/文件 摘要
工作流程增强
.github/workflows/_publish_pd_store_server_reusable.yml
publish_manifest 任务中新增"删除 manifest 发布后的临时架构标签"步骤,通过 Docker Hub API 认证后删除 ${VERSION_TAG}-amd64${VERSION_TAG}-arm64 标签,支持最多 5 次重试和指数退避,将 HTTP 204 和 404 状态视为成功。
文档更新
AGENTS.md, README.md
补充说明 pd/store/server 使用专用的可复用工作流,文档化了严格的构建前检查和分阶段的 amd64/arm64 → manifest 发布流程,以及临时标签清理的时机(仅在 manifest 发布成功后执行)。

预期代码审查工作量

🎯 2 (简单) | ⏱️ ~10 分钟

可能相关的 PR

建议标签

enhancement, documentation, size:L

诗歌

🐰 工作流优化,清理有序安排
临时标签去,manifest 已发布
文档更新明,流程清晰现
双架构成功,方可删除净

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题"fix(workflows): clean temp arch tags after merge"准确概括了主要变更:在manifest发布后清理临时架构标签。标题简洁、具体,准确反映了changeset中的核心功能改动。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch clean-tags

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the pd/store/server Docker image publishing workflow by introducing a more robust and resilient mechanism for handling multi-architecture images. The primary goal is to ensure that temporary architecture-specific tags are cleaned up only after a successful manifest publication, preventing the loss of partially published amd64 images if arm64 builds encounter issues. Additionally, the changes include updated documentation to clearly outline this critical publishing path and its associated tag management behavior.

Highlights

  • Docker Hub Tag Cleanup: Implemented cleanup for temporary *-amd64 and *-arm64 Docker Hub tags, ensuring they are removed only after a successful multi-architecture manifest has been published for the pd/store/server images.
  • Resilient Multi-Architecture Publishing: Ensured that amd64 artifacts remain available even if arm64 publishing fails, by explicitly performing temporary tag cleanup only within the publish_manifest job, which runs after both architectures have successfully built.
  • Workflow Documentation: Added comprehensive documentation for the critical pd/store/server release pipeline, including a detailed ASCII workflow diagram and explicit tag behavior rules, to README.md.
  • Documentation Alignment: Updated AGENTS.md to reflect the new staged dual-architecture publishing and cleanup semantics for pd/store/server, providing clear guidelines for future modifications.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/_publish_pd_store_server_reusable.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation in AGENTS.md and README.md to reflect changes in the CI/CD workflow for publishing pd/store/server Docker images. The changes document the new behavior of cleaning up temporary architecture-specific tags only after a successful multi-arch manifest creation. The documentation is well-written, and the inclusion of an ASCII diagram in README.md is very helpful for understanding the workflow. I have a couple of suggestions to further improve the clarity and potentially the efficiency of the documented process.

Comment on lines +65 to +73
publish_amd64 (matrix x4 modules)
+-------------------------------------------------+
| pd | store | server-hstore | server-standalone |
+-------------------------------------------------+
push x.y.z-amd64 (or latest-amd64)
|
v
publish_arm64 (matrix x4 modules)
push x.y.z-arm64 (or latest-arm64)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ASCII diagram shows publish_arm64 running after publish_amd64. If the builds for different architectures are independent, they could be run in parallel to speed up the workflow. The publish_manifest job would then need to depend on both publish_amd64 and publish_arm64 completing successfully.

This would change the diagram to show parallel execution, for example:

                  integration_precheck (optional)
                               |
             +-----------------+-----------------+
             |                                 |
             v                                 v
 publish_amd64 (matrix x4)         publish_arm64 (matrix x4)
             |                                 |
             +-----------------+-----------------+
                               |
                               v
                 publish_manifest (matrix x4 modules)

If the sequential execution is intentional (e.g., due to runner limitations), consider adding a note to explain why.


Tag behavior:

- If only amd64 is published and arm64 fails, manifest is not created and `*-amd64` remains available.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This sentence is slightly ambiguous. "If only amd64 is published" could be interpreted in different ways. For clarity, consider rephrasing to focus on the success/failure of the workflow jobs. For example: "If the amd64 publish succeeds but the arm64 publish fails, the manifest is not created and the *-amd64 tag remains available."

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the pd/store/server publishing pipeline to clean up temporary per-architecture Docker Hub tags after a successful multi-arch manifest publish, and documents the intended staged publish semantics.

Changes:

  • Add a Docker Hub tag-deletion step in publish_manifest to remove *-amd64 / *-arm64 tags after manifest creation.
  • Document the critical pd/store/server pipeline and tag semantics in README.md and AGENTS.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
README.md Adds an ASCII diagram and tag-behavior notes for the pd/store/server critical publish path.
AGENTS.md Aligns repository guidance with the staged dual-arch publish + cleanup semantics for pd/store/server.
.github/workflows/_publish_pd_store_server_reusable.yml Implements temporary Docker Hub tag cleanup after manifest publish.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

[`.github/workflows/_publish_pd_store_server_reusable.yml`](./.github/workflows/_publish_pd_store_server_reusable.yml).

```text
source branch (master / release-x.y.z)
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diagram references master, but the rest of the README describes the default branch as main (e.g., “current main branch line”). This is likely inaccurate/confusing; consider changing the diagram to main (or main/master if both are supported).

Suggested change
source branch (master / release-x.y.z)
source branch (main / release-x.y.z)

Copilot uses AI. Check for mistakes.
Comment on lines +484 to +490
- name: Delete temporary arch tags after manifest publish (${{ matrix.module }})
env:
IMAGE_REPO: ${{ matrix.image_repo }}
VERSION_TAG: ${{ env.VERSION_TAG }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this tag-cleanup step fails (e.g., Docker Hub API hiccup), the entire publish_manifest job will fail even though the manifest may already be created, and update_latest_hash will be skipped. Consider making cleanup non-blocking (e.g., continue-on-error: true) or moving it to a separate job so successful publishes still count as success/have their hash updated.

Copilot uses AI. Check for mistakes.
Comment on lines +516 to +520
status_code="$(
curl -sS -o /tmp/dockerhub-delete-response.txt -w "%{http_code}" -X DELETE \
-H "Authorization: JWT $auth_token" \
"https://hub.docker.com/v2/repositories/${namespace}/${repository}/tags/${tag}/"
)"
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry loop won’t actually retry on transient network failures because set -e will exit the script if the curl command itself returns non-zero inside the command substitution. Consider handling curl failures explicitly (e.g., capture the exit code and treat it as a retryable failure) so the backoff logic is effective.

Suggested change
status_code="$(
curl -sS -o /tmp/dockerhub-delete-response.txt -w "%{http_code}" -X DELETE \
-H "Authorization: JWT $auth_token" \
"https://hub.docker.com/v2/repositories/${namespace}/${repository}/tags/${tag}/"
)"
if ! status_code="$(
curl -sS -o /tmp/dockerhub-delete-response.txt -w "%{http_code}" -X DELETE \
-H "Authorization: JWT $auth_token" \
"https://hub.docker.com/v2/repositories/${namespace}/${repository}/tags/${tag}/"
)"; then
# Treat curl failures (e.g., network errors) as a retryable failure
status_code="000"
fi

Copilot uses AI. Check for mistakes.
Comment on lines +501 to +503
curl --fail-with-body -sS -X POST "https://hub.docker.com/v2/users/login/" \
-H "Content-Type: application/json" \
-d '{"username":"'"$DOCKERHUB_USERNAME"'","password":"'"$DOCKERHUB_PASSWORD"'"}' \
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSON request body is built via shell string concatenation, which will break if the Docker Hub username/password contain quotes or backslashes. Consider generating the JSON safely (e.g., via jq -nc --arg ... or another proper JSON encoder) to avoid auth failures with certain credentials.

Suggested change
curl --fail-with-body -sS -X POST "https://hub.docker.com/v2/users/login/" \
-H "Content-Type: application/json" \
-d '{"username":"'"$DOCKERHUB_USERNAME"'","password":"'"$DOCKERHUB_PASSWORD"'"}' \
jq -nc --arg u "$DOCKERHUB_USERNAME" --arg p "$DOCKERHUB_PASSWORD" '{username:$u, password:$p}' \
| curl --fail-with-body -sS -X POST "https://hub.docker.com/v2/users/login/" \
-H "Content-Type: application/json" \
-d @- \

Copilot uses AI. Check for mistakes.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/_publish_pd_store_server_reusable.yml (1)

500-509: 建议使用 jq 构建 JSON 请求体以避免潜在的注入问题。

当前使用 shell 字符串拼接构建 JSON,如果凭据中包含 "\ 等特殊字符,可能导致 JSON 格式错误或意外行为。

♻️ 使用 jq 安全构建 JSON
         auth_token="$(
-          curl --fail-with-body -sS -X POST "https://hub.docker.com/v2/users/login/" \
-            -H "Content-Type: application/json" \
-            -d '{"username":"'"$DOCKERHUB_USERNAME"'","password":"'"$DOCKERHUB_PASSWORD"'"}' \
-          | jq -r '.token'
+          jq -n --arg u "$DOCKERHUB_USERNAME" --arg p "$DOCKERHUB_PASSWORD" \
+            '{username: $u, password: $p}' \
+          | curl --fail-with-body -sS -X POST "https://hub.docker.com/v2/users/login/" \
+              -H "Content-Type: application/json" -d `@-` \
+          | jq -r '.token'
         )"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/_publish_pd_store_server_reusable.yml around lines 500 -
509, The current auth_token curl invocation builds the JSON body via shell
string concatenation which can break if DOCKERHUB_USERNAME or DOCKERHUB_PASSWORD
contain special characters; change the payload construction to use jq to safely
create JSON (e.g. use jq -n --arg user "$DOCKERHUB_USERNAME" --arg pass
"$DOCKERHUB_PASSWORD" '{username:$user,password:$pass}') and pipe that output
into curl -d `@-` so the curl call in the auth_token assignment uses the
jq-generated JSON; update the auth_token block (the curl command that sets
auth_token and checks it) to use this jq-built body to avoid injection/escaping
issues.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/_publish_pd_store_server_reusable.yml:
- Around line 500-509: The current auth_token curl invocation builds the JSON
body via shell string concatenation which can break if DOCKERHUB_USERNAME or
DOCKERHUB_PASSWORD contain special characters; change the payload construction
to use jq to safely create JSON (e.g. use jq -n --arg user "$DOCKERHUB_USERNAME"
--arg pass "$DOCKERHUB_PASSWORD" '{username:$user,password:$pass}') and pipe
that output into curl -d `@-` so the curl call in the auth_token assignment uses
the jq-generated JSON; update the auth_token block (the curl command that sets
auth_token and checks it) to use this jq-built body to avoid injection/escaping
issues.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b195797c-b813-4ce8-834a-19217c5e5850

📥 Commits

Reviewing files that changed from the base of the PR and between 0a692b3 and f01a047.

📒 Files selected for processing (3)
  • .github/workflows/_publish_pd_store_server_reusable.yml
  • AGENTS.md
  • README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants