Skip to content

Add multi-arch build tooling for rebasebot image#36

Merged
mpryc merged 1 commit into
oadp-rebasebot:oadp-devfrom
Joeavaikath:build-rebasebot-image
Jun 9, 2026
Merged

Add multi-arch build tooling for rebasebot image#36
mpryc merged 1 commit into
oadp-rebasebot:oadp-devfrom
Joeavaikath:build-rebasebot-image

Conversation

@Joeavaikath

@Joeavaikath Joeavaikath commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds tools/build-rebasebot/ with a Containerfile, build script, and Makefile for building and pushing the quay.io/migtools/rebasebot:latest multi-arch container image (linux/amd64 + linux/arm64).
  • The build script clones the upstream openshift-eng/rebasebot source but uses our own Containerfile, so we control the build definition independently of upstream.
  • Usage: make build (dry run) or make push (build + push to quay.io).

Context

The upstream rebasebot repo has a Containerfile but no multi-arch build process or CI that publishes to quay.io/migtools/rebasebot. Previously the image was built and pushed manually with no repeatable process. This tooling captures the full multi-arch manifest workflow so it can be repeated whenever upstream changes land (e.g. openshift-eng/rebasebot#92).

Test plan

  • make build completes successfully, producing a manifest with both linux/amd64 and linux/arm64
  • podman run --rm quay.io/migtools/rebasebot:latest --help works on the built image
  • make push pushes successfully to quay.io (pending push access)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Added containerized build infrastructure for rebasebot, enabling automated multi-architecture image creation and publishing.
    • Includes Docker/Podman build and deployment automation supporting both ARM64 and AMD64 architectures.

Review Change Stack

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR introduces a complete container build infrastructure for rebasebot. It defines a UBI9-based Python 3.12 container image with multi-architecture support (amd64/arm64), provides a Bash script that orchestrates the Podman multi-arch build and optional registry push to quay.io, and wraps the automation with convenient Make targets for developers.

Changes

Container Build Pipeline

Layer / File(s) Summary
Container image specification
tools/build-rebasebot/Containerfile
Containerfile specifies a UBI9 Python 3.12 base with dynamic Go binary architecture selection, system dependencies, uv package manager, Python package installation from build context, and non-root user execution.
Build and push automation
tools/build-rebasebot/build.sh
build.sh script handles repository cloning/updating, commit identification, Podman manifest creation for both linux/amd64 and linux/arm64, manifest verification via podman manifest inspect, and conditional push to quay.io registry with --dry-run support.
Make targets for build workflow
tools/build-rebasebot/Makefile
Makefile provides build (dry-run) and push (registry push) targets that invoke build.sh with appropriate flags.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 A container builds up so neat,
With arms and aches both complete,
Multi-arch dreams in Podman's dance,
To quay.io they will advance,
No rabbit fears this build's great feat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add multi-arch build tooling for rebasebot image' accurately and concisely describes the main change: introducing multi-architecture container build tooling for the rebasebot image.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tools/build-rebasebot/build.sh`:
- Around line 7-38: Replace the fixed CLONE_DIR with a unique temporary
workspace created at runtime (use mktemp -d) and register a trap to remove it on
EXIT to avoid cross-run collisions; update usages of CLONE_DIR (the git
clone/fetch/checkout/reset blocks) to operate on this temp dir and ensure the
script still respects REBASEBOT_REPO, and remove reliance on a persistent
/tmp/rebasebot directory so concurrent runs won’t clobber each other.

In `@tools/build-rebasebot/Containerfile`:
- Around line 11-13: Update the Containerfile download block that uses
GO_VERSION and ARCH: after downloading /tmp/go.tar.gz with curl, also curl the
corresponding .sha256 file from
https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz.sha256, compute the
SHA-256 of /tmp/go.tar.gz (e.g., via sha256sum or shasum -a 256), compare it to
the expected digest from the downloaded .sha256 file, and abort the build (exit
non‑zero) if they differ; only proceed to tar -C /usr/local -xzf /tmp/go.tar.gz
and rm -f /tmp/go.tar.gz when the checksum matches, and ensure any temporary
checksum files are cleaned up on both success and failure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 626ec505-af35-49c9-aa9e-45e243e8fd45

📥 Commits

Reviewing files that changed from the base of the PR and between 6a47a94 and 92c1193.

📒 Files selected for processing (3)
  • tools/build-rebasebot/Containerfile
  • tools/build-rebasebot/Makefile
  • tools/build-rebasebot/build.sh

Comment on lines +7 to +38
CLONE_DIR="/tmp/rebasebot"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

DRY_RUN=false
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=true ;;
--help|-h)
echo "Usage: $0 [--dry-run]"
echo ""
echo "Build and push a multi-arch rebasebot container image."
echo ""
echo "Options:"
echo " --dry-run Build the image but don't push to quay.io"
echo " --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $arg"
exit 1
;;
esac
done

echo "==> Cloning/updating rebasebot source..."
if [[ -d "$CLONE_DIR" ]]; then
git -C "$CLONE_DIR" fetch origin
git -C "$CLONE_DIR" checkout main
git -C "$CLONE_DIR" reset --hard origin/main
else
git clone "$REBASEBOT_REPO" "$CLONE_DIR"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid shared /tmp/rebasebot; use an isolated temp workspace per run.

Line 7 creates cross-run state that can be clobbered by another invocation while this script is building/pushing. Make the clone directory unique and auto-cleaned.

Proposed fix
-CLONE_DIR="/tmp/rebasebot"
+CLONE_DIR="$(mktemp -d /tmp/rebasebot.XXXXXX)"
+trap 'rm -rf "$CLONE_DIR"' EXIT
@@
-echo "==> Cloning/updating rebasebot source..."
-if [[ -d "$CLONE_DIR" ]]; then
-    git -C "$CLONE_DIR" fetch origin
-    git -C "$CLONE_DIR" checkout main
-    git -C "$CLONE_DIR" reset --hard origin/main
-else
-    git clone "$REBASEBOT_REPO" "$CLONE_DIR"
-fi
+echo "==> Cloning rebasebot source..."
+git clone --depth 1 "$REBASEBOT_REPO" "$CLONE_DIR"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
CLONE_DIR="/tmp/rebasebot"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DRY_RUN=false
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=true ;;
--help|-h)
echo "Usage: $0 [--dry-run]"
echo ""
echo "Build and push a multi-arch rebasebot container image."
echo ""
echo "Options:"
echo " --dry-run Build the image but don't push to quay.io"
echo " --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $arg"
exit 1
;;
esac
done
echo "==> Cloning/updating rebasebot source..."
if [[ -d "$CLONE_DIR" ]]; then
git -C "$CLONE_DIR" fetch origin
git -C "$CLONE_DIR" checkout main
git -C "$CLONE_DIR" reset --hard origin/main
else
git clone "$REBASEBOT_REPO" "$CLONE_DIR"
fi
CLONE_DIR="$(mktemp -d /tmp/rebasebot.XXXXXX)"
trap 'rm -rf "$CLONE_DIR"' EXIT
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DRY_RUN=false
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=true ;;
--help|-h)
echo "Usage: $0 [--dry-run]"
echo ""
echo "Build and push a multi-arch rebasebot container image."
echo ""
echo "Options:"
echo " --dry-run Build the image but don't push to quay.io"
echo " --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $arg"
exit 1
;;
esac
done
echo "==> Cloning rebasebot source..."
git clone --depth 1 "$REBASEBOT_REPO" "$CLONE_DIR"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/build-rebasebot/build.sh` around lines 7 - 38, Replace the fixed
CLONE_DIR with a unique temporary workspace created at runtime (use mktemp -d)
and register a trap to remove it on EXIT to avoid cross-run collisions; update
usages of CLONE_DIR (the git clone/fetch/checkout/reset blocks) to operate on
this temp dir and ensure the script still respects REBASEBOT_REPO, and remove
reliance on a persistent /tmp/rebasebot directory so concurrent runs won’t
clobber each other.

Comment on lines +11 to +13
curl -fLsS -o /tmp/go.tar.gz "https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz" && \
tar -C /usr/local -xzf /tmp/go.tar.gz && \
rm -f /tmp/go.tar.gz && \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the Containerfile around the referenced lines
echo "=== tools/build-rebasebot/Containerfile (lines 1-80) ==="
sed -n '1,80p' tools/build-rebasebot/Containerfile | cat -n

echo
echo "=== tools/build-rebasebot/Containerfile (lines 80-200) ==="
sed -n '80,200p' tools/build-rebasebot/Containerfile | cat -n

echo
echo "=== Search repo for go checksum / sha256 verification ==="
rg -n "go.*(sha256|checksum|checksums|SIGNATURE|gpg|verify)" -S . || true

echo
echo "=== Search repo for go tarball download pattern ==="
rg -n "go\.dev/dl/go\$\{?GO_VERSION\}?\..*\.tar\.gz" -S tools/build-rebasebot/Containerfile . || true

Repository: oadp-rebasebot/oadp-rebase

Length of output: 1491


🌐 Web query:

Official Go downloads checksum file format for *.sha256 (e.g., go1.22.3.linux-amd64.tar.gz.sha256) and recommended verification approach

💡 Result:

Official Go download checksum files use the plain-text SHA-256 hex digest for the corresponding archive, published at a URL formed by appending “.sha256” to the archive filename (e.g., .sha256, such as https://dl.google.com/go/go1.22.3.linux-amd64.tar.gz.sha256) [1][2]. The checksum value is the expected hexadecimal hash with no additional checksum metadata in that file; Go’s own download verification code reads the entire “.sha256” response as text, trims whitespace, and compares it to the computed SHA-256 of the downloaded archive [1][2]. Recommended verification approach (practical): 1) Download the archive. 2) Download the matching “.sha256” file. 3) Compute SHA-256 of the archive and compare to the expected hex string. - Example (Linux/macOS): - sha256sum go1.22.3.linux-amd64.tar.gz - Compare the resulting 64-hex-character digest to the contents you got from go1.22.3.linux-amd64.tar.gz.sha256 [1][2]. Notes / security best practice: - SHA-256 verification checks integrity (detects tampering/corruption) but doesn’t by itself establish publisher identity; for stronger assurance, also verify Go’s cryptographic signatures (the “.asc” files) when available, in addition to checksum verification [3][4].

Citations:


Verify Go tarball integrity before extraction in tools/build-rebasebot/Containerfile.

curl downloads https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz and tar extracts it without any integrity validation. Add verification using the archive-specific .sha256 published by Go for the exact version/arch, compare the computed SHA-256 to the expected hex digest, and abort the build on mismatch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/build-rebasebot/Containerfile` around lines 11 - 13, Update the
Containerfile download block that uses GO_VERSION and ARCH: after downloading
/tmp/go.tar.gz with curl, also curl the corresponding .sha256 file from
https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz.sha256, compute the
SHA-256 of /tmp/go.tar.gz (e.g., via sha256sum or shasum -a 256), compare it to
the expected digest from the downloaded .sha256 file, and abort the build (exit
non‑zero) if they differ; only proceed to tar -C /usr/local -xzf /tmp/go.tar.gz
and rm -f /tmp/go.tar.gz when the checksum matches, and ensure any temporary
checksum files are cleaned up on both success and failure.

Comment thread tools/build-rebasebot/Containerfile
@mpryc mpryc merged commit 330c1ac into oadp-rebasebot:oadp-dev Jun 9, 2026
1 check 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.

2 participants