Skip to content

Add ARM runner support to stable workflow#26

Merged
toshi0806 merged 3 commits into
mainfrom
fix/stable-workflow-arm-runner-v2
Oct 21, 2025
Merged

Add ARM runner support to stable workflow#26
toshi0806 merged 3 commits into
mainfrom
fix/stable-workflow-arm-runner-v2

Conversation

@toshi0806

Copy link
Copy Markdown
Member

🎯 Overview

安定版(5b1f1fe)をベースにARM runnerサポートを追加。BOLT最適化などの複雑な問題を避けて、シンプルで確実に動作するワークフローを提供。

📋 Changes

Workflow Improvements

  • Matrix strategy: AMD64とARM64を分離したビルド
  • ARM runner: ARM64用にarm-runnerを使用してネイティブビルド
  • Fallback support: QEMU使用のfallback機能も維持
  • Availability check: ARM runner使用時の通知機能

Configuration

  • actionlint.yaml: カスタムランナー用の設定追加
  • YAML compliance: yamllint/actionlint完全対応

🔧 Technical Details

Base Version

  • Ubuntu 22.04 (stable)
  • asdf-based language management
  • 動作確認済みの最後の安定版をベース

Build Strategy

strategy:
  matrix:
    include:
      - platform: linux/amd64
        runner: ubuntu-latest
      - platform: linux/arm64  
        runner: arm-runner

✅ Benefits

  1. 安定性: BOLT最適化問題を回避
  2. パフォーマンス: ARM64ネイティブビルド
  3. 互換性: 既存Dockerfileをそのまま使用
  4. 保守性: シンプルなワークフロー構造

🧪 Test Plan

  • AMD64ビルドテスト(ubuntu-latest)
  • ARM64ビルドテスト(arm-runner使用時)
  • ARM64ビルドテスト(QEMU fallback)
  • actionlint/yamllint検証完了

🎉 Ready for Production

このPRは本格運用準備が整った安定版です。

- Based on last stable version (5b1f1fe) to avoid BOLT issues
- Add matrix strategy for AMD64/ARM64 separate builds
- Use arm-runner for native ARM64 builds
- Add ARM runner availability check with notice
- Add actionlint.yaml config for custom runner validation
- Keep simple stable Dockerfile without complex optimizations
@toshi0806
toshi0806 requested a review from Copilot October 21, 2025 12:27

Copilot AI left a comment

Copy link
Copy Markdown

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 adds ARM runner support to the stable workflow by implementing a matrix build strategy that separates AMD64 and ARM64 builds. The changes enable native ARM64 builds using a custom arm-runner while maintaining QEMU fallback support for environments where the ARM runner is unavailable.

Key Changes:

  • Introduced matrix strategy to run AMD64 builds on ubuntu-latest and ARM64 builds on arm-runner
  • Added actionlint configuration to recognize the custom arm-runner label
  • Replaced custom build action with direct Docker build-push action using platform-specific builds

Reviewed Changes

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

File Description
.github/workflows/build-latest.yml Implemented matrix strategy for multi-architecture builds with ARM runner support and QEMU fallback
.github/actionlint.yaml Added configuration to allow custom arm-runner label in workflow validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread .github/workflows/build-latest.yml Outdated
Comment on lines +27 to +53
tags: |
ghcr.io/${{ github.repository_owner }}/atcoder-container:latest
ghcr.io/${{ github.repository_owner }}/atcoder-container:all
type=raw,value=latest
type=raw,value=all

Copilot AI Oct 21, 2025

Copy link

Choose a reason for hiding this comment

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

Both matrix jobs will push to the same tags (latest and all), causing the second job to overwrite the first job's image. For multi-architecture support, you should either use Docker manifest to combine both architectures under the same tags, or use architecture-specific tags (e.g., latest-amd64, latest-arm64) and then create a manifest list.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/build-latest.yml Outdated

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@v4

Copilot AI Oct 21, 2025

Copy link

Choose a reason for hiding this comment

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

The action reference was changed from a pinned SHA (actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11) to a mutable tag (@v4). Pinning to specific SHAs is a security best practice to prevent supply chain attacks. Consider using the SHA format with a comment indicating the version (e.g., actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1).

Suggested change
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/build-latest.yml Outdated

- name: Login to GitHub Container Registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
uses: docker/login-action@v3

Copilot AI Oct 21, 2025

Copy link

Choose a reason for hiding this comment

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

The action reference was changed from a pinned SHA (docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d) to a mutable tag (@v3). Pinning to specific SHAs is a security best practice. Consider reverting to the SHA format.

Suggested change
uses: docker/login-action@v3
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/build-latest.yml Outdated
Comment on lines +63 to +64
cache-from: type=gha
cache-to: type=gha,mode=max

Copilot AI Oct 21, 2025

Copy link

Choose a reason for hiding this comment

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

Each matrix job (AMD64 and ARM64) will write to the same GitHub Actions cache namespace, potentially causing cache conflicts or unnecessary cache invalidation. Consider adding a cache key suffix based on the platform to separate caches: cache-from: type=gha,scope=${{ matrix.platform }} and cache-to: type=gha,mode=max,scope=${{ matrix.platform }}.

Suggested change
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}

Copilot uses AI. Check for mistakes.
…he scope

- Add Docker manifest creation step to properly combine multi-arch images
- Pin all GitHub Actions to specific SHA for security (addresses comment #2448010099, #2448010127)
- Add platform-specific cache scope to avoid conflicts (addresses comment #2448010152)
- Use architecture-specific intermediate tags (latest-amd64, latest-arm64, all-amd64, all-arm64)
- Create final multi-arch manifest images with original tags (latest, all) (addresses comment #2448010076)
- Pass yamllint and actionlint validation
@toshi0806

Copy link
Copy Markdown
Member Author

✅ レビューコメント対応完了

Copilot からの4つの指摘事項に対応しました。

📝 対応内容

1. マルチアーキテクチャイメージのタグ衝突問題 (#2448010076)

問題: 各matrix jobが同じタグ (latest, all) にプッシュするため、後のジョブが前のジョブを上書きしていた

対応:

  • プラットフォーム固有の中間タグを導入 (latest-amd64, latest-arm64, all-amd64, all-arm64)
  • 新しい create-manifest ジョブを追加し、Docker manifestで複数アーキテクチャを統合
  • 最終的なマルチアーキテクチャイメージは元のタグ名 (latest, all) で公開

2. GitHub Actions のSHAピン留め (#2448010099, #2448010127)

問題: セキュリティベストプラクティスとして、可変タグ (@v4) ではなく特定のSHAでアクションをピン留めすべき

対応:

  • すべてのGitHub Actionsを特定のSHAでピン留め
    • actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 (v4.1.7)
    • docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf (v3.2.0)
    • docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db (v3.6.1)
    • docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 (v3.3.0)
    • docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 (v5.5.1)
    • docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 (v6.7.0)
  • バージョン番号はコメントで明記

3. キャッシュスコープの競合 (#2448010152)

問題: AMD64とARM64の両ジョブが同じGitHub Actionsキャッシュ名前空間を使用し、競合やキャッシュ無効化が発生する可能性

対応:

  • プラットフォーム別のキャッシュスコープを追加
    cache-from: type=gha,scope=\${{ matrix.platform }}
    cache-to: type=gha,mode=max,scope=\${{ matrix.platform }}

✨ 追加改善

  • yamllint と actionlint の検証をパス
  • コミットメッセージにIssue番号を含めて追跡可能に

🔄 ワークフローの動作

  1. Build Job: AMD64とARM64を並列ビルドし、アーキテクチャ固有のタグでプッシュ
  2. Create Manifest Job: ビルド完了後、Docker manifestで両アーキテクチャを統合し、最終タグを作成

これにより、マルチアーキテクチャイメージが正しく構築され、ユーザーは docker pull ghcr.io/smkwlab/atcoder-container:latest で適切なアーキテクチャのイメージを自動的に取得できます。

@toshi0806
toshi0806 requested a review from Copilot October 21, 2025 13:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

# v3.2.0

- name: Set up Docker Buildx
# yamllint disable-line rule:line-length

Copilot AI Oct 21, 2025

Copy link

Choose a reason for hiding this comment

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

The yamllint disable comment is unnecessary as line 42 is only 74 characters long, well below typical line length limits (80 or 120 characters). This comment should be removed.

Suggested change
# yamllint disable-line rule:line-length

Copilot uses AI. Check for mistakes.
@toshi0806

Copy link
Copy Markdown
Member Author

📝 レビューコメント #2448325296 について

Copilotから「yamllint disable-line コメントは不要」という指摘がありましたが、この指摘は誤りです。

🔍 検証結果

$ sed -n '41p' .github/workflows/build-latest.yml | wc -c
82

実際の行の長さ: 82文字(改行を含む)
yamllintの制限: 80文字

したがって、# yamllint disable-line rule:line-length コメントは必要です。

📊 詳細

問題の行:

uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db

この行は、セキュリティベストプラクティスに従って特定のSHAでアクションをピン留めしているため、どうしても長くなります。以下の選択肢がありました:

  1. yamllint disable コメントを使用 (現在の実装)
  2. ❌ 可変タグに戻す (@v3) - セキュリティリスクがある
  3. ❌ 行を短縮する - SHAを削ることはできない

セキュリティを優先し、yamllint の例外を使用する方針を維持します。

Resolve conflict in build-latest.yml:
- Keep PR #26's multi-arch manifest approach
- Add date tag feature from main branch
- Update to use $GITHUB_OUTPUT instead of deprecated set-output
@toshi0806
toshi0806 merged commit 766371a into main Oct 21, 2025
1 of 4 checks passed
@toshi0806
toshi0806 deleted the fix/stable-workflow-arm-runner-v2 branch October 21, 2025 13:39
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.

2 participants