Skip to content

Update build-and-publish.yml#2

Merged
AsamaSumer merged 1 commit into
masterfrom
AsamaSumer-patch-2
May 6, 2025
Merged

Update build-and-publish.yml#2
AsamaSumer merged 1 commit into
masterfrom
AsamaSumer-patch-2

Conversation

@AsamaSumer
Copy link
Copy Markdown

@AsamaSumer AsamaSumer commented May 6, 2025

Overview

What this PR does / why we need it

Special notes for your reviewer

Summary by CodeRabbit

  • Chores
    • Improved Docker image publishing process to support both AMD64 and ARM64 architectures.
    • Images are now tagged with architecture-specific suffixes and combined into unified multi-architecture tags for easier usage.

Signed-off-by: AsamaSumer <sumer@asama.ai>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2025

Walkthrough

The GitHub Actions workflow for building and publishing Docker images has been updated to explicitly support multi-architecture builds. Separate build-and-push steps are now included for AMD64 and ARM64 images, with architecture-specific tags. A new step creates and pushes Docker manifest lists aggregating these images under unified tags.

Changes

File(s) Change Summary
.github/workflows/build-and-publish.yml Refactored workflow to set up QEMU before Docker Buildx, added separate build-and-push steps for AMD64/ARM64 images, appended architecture suffixes to tags, and introduced steps to create and push multi-arch Docker manifests.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant QEMU
    participant Docker Buildx
    participant Docker Registry

    GitHub Actions->>QEMU: Set up QEMU for multi-arch builds
    GitHub Actions->>Docker Buildx: Set up Buildx builder
    GitHub Actions->>Docker Buildx: Build & push AMD64 image (tag: -amd64)
    Docker Buildx->>Docker Registry: Push amd64 image
    GitHub Actions->>Docker Buildx: Build & push ARM64 image (tag: -arm64)
    Docker Buildx->>Docker Registry: Push arm64 image
    GitHub Actions->>Docker Registry: Create & push multi-arch manifest (unified tags)
Loading

Poem

🐇
Two images built, one for each arch,
AMD and ARM now both can march.
Unified tags, a manifest new,
Multi-arch dreams are coming true!
In Docker clouds our bytes now dance—
A rabbit’s hop to global expanse!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@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.

Actionable comments posted: 0

🧹 Nitpick comments (4)
.github/workflows/build-and-publish.yml (4)

2-2: Remove trailing whitespace
Several lines contain trailing spaces and are causing YAML lint errors. Please strip all trailing spaces to satisfy yamllint and keep the file clean.

Also applies to: 7-7, 15-15, 32-32, 43-43, 55-55, 83-83, 94-94, 105-105, 112-112, 117-117, 120-120, 126-126

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 2-2: trailing spaces

(trailing-spaces)


84-94: Refactor AMD64 build tags for clarity
The inline comma-delimited tags expression works, but a YAML list is more readable and maintainable. For example:

-with:
-  context: .
-  platforms: linux/amd64
-  push: true
-  tags: ${{ steps.get_info.outputs.set_latest == 'true' && format('ghcr.io/{0}:{1}-amd64,ghcr.io/{0}:latest-amd64', steps.get_info.outputs.repo_name, steps.get_info.outputs.version) || format('ghcr.io/{0}:{1}-amd64', steps.get_info.outputs.repo_name, steps.get_info.outputs.version) }}
-  cache-from: type=gha,scope=amd64
-  cache-to: type=gha,mode=max,scope=amd64
+with:
+  context: .
+  platforms: linux/amd64
+  push: true
+  tags:
+    - ghcr.io/${{ steps.get_info.outputs.repo_name }}:${{ steps.get_info.outputs.version }}-amd64
+    - ghcr.io/${{ steps.get_info.outputs.repo_name }}:latest-amd64
+  cache-from: type=gha,scope=amd64
+  cache-to: type=gha,mode=max,scope=amd64
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 94-94: trailing spaces

(trailing-spaces)


95-105: Refactor ARM64 build tags for clarity
Mirror the AMD64 step by using a YAML list for tags, reducing expression complexity:

-with:
-  context: .
-  platforms: linux/arm64
-  push: true
-  tags: ${{ steps.get_info.outputs.set_latest == 'true' && format('ghcr.io/{0}:{1}-arm64,ghcr.io/{0}:latest-arm64', steps.get_info.outputs.repo_name, steps.get_info.outputs.version) || format('ghcr.io/{0}:{1}-arm64', steps.get_info.outputs.repo_name, steps.get_info.outputs.version) }}
-  cache-from: type=gha,scope=arm64
-  cache-to: type=gha,mode=max,scope=arm64
+with:
+  context: .
+  platforms: linux/arm64
+  push: true
+  tags:
+    - ghcr.io/${{ steps.get_info.outputs.repo_name }}:${{ steps.get_info.outputs.version }}-arm64
+    - ghcr.io/${{ steps.get_info.outputs.repo_name }}:latest-arm64
+  cache-from: type=gha,scope=arm64
+  cache-to: type=gha,mode=max,scope=arm64
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 105-105: trailing spaces

(trailing-spaces)


106-129: Simplify multi-arch workflow with a single Buildx step
Rather than separate AMD64/ARM64 builds and manual docker manifest commands, leverage Buildx’s built-in multi-platform support:

-# Build and push AMD64 image
-# Build and push ARM64 image
-# Create and push multi-arch manifest
+  - name: Build and push multi-arch image
+    uses: docker/build-push-action@v5
+    with:
+      context: .
+      platforms: linux/amd64,linux/arm64
+      push: true
+      tags:
+        - ghcr.io/${{ steps.get_info.outputs.repo_name }}:${{ steps.get_info.outputs.version }}
+        - ghcr.io/${{ steps.get_info.outputs.repo_name }}:latest

This single step automatically builds both architectures and pushes a combined manifest, making the workflow more concise.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 112-112: trailing spaces

(trailing-spaces)


[error] 117-117: trailing spaces

(trailing-spaces)


[error] 120-120: trailing spaces

(trailing-spaces)


[error] 126-126: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0120a0a and d676403.

📒 Files selected for processing (1)
  • .github/workflows/build-and-publish.yml (5 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/build-and-publish.yml

[error] 2-2: trailing spaces

(trailing-spaces)


[error] 7-7: trailing spaces

(trailing-spaces)


[error] 11-11: trailing spaces

(trailing-spaces)


[error] 15-15: trailing spaces

(trailing-spaces)


[error] 32-32: trailing spaces

(trailing-spaces)


[error] 43-43: trailing spaces

(trailing-spaces)


[error] 55-55: trailing spaces

(trailing-spaces)


[error] 83-83: trailing spaces

(trailing-spaces)


[error] 94-94: trailing spaces

(trailing-spaces)


[error] 105-105: trailing spaces

(trailing-spaces)


[error] 112-112: trailing spaces

(trailing-spaces)


[error] 117-117: trailing spaces

(trailing-spaces)


[error] 120-120: trailing spaces

(trailing-spaces)


[error] 126-126: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Artifacts / Container images (distroless)
  • GitHub Check: Artifacts / Container images (alpine)
  • GitHub Check: Test
🔇 Additional comments (1)
.github/workflows/build-and-publish.yml (1)

53-55: Enable QEMU before Buildx
Adding docker/setup-qemu-action@v3 ensures proper emulation for multi-architecture builds. Placement before docker/setup-buildx-action@v3 is correct.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 55-55: trailing spaces

(trailing-spaces)

@AsamaSumer AsamaSumer merged commit 44ac9ba into master May 6, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant