Skip to content

fix: ensure identical version across matrix builds#226

Merged
ggiguash merged 2 commits into
microshift-io:mainfrom
leelavg:fix-version-timestamp
Jul 6, 2026
Merged

fix: ensure identical version across matrix builds#226
ggiguash merged 2 commits into
microshift-io:mainfrom
leelavg:fix-version-timestamp

Conversation

@leelavg

@leelavg leelavg commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Generate build timestamp once in a pre-job and propagate it via BUILD_TIMESTAMP env var so all matrix runners (amd64, arm64) produce the same version string. Previously each runner called date(1) independently, causing the per-arch image tags to diverge and breaking the multi-arch manifest creation step.

Summary by CodeRabbit

  • Chores
    • Release workflows now compute a shared UTC build timestamp and use it consistently across release artifacts.
    • SRPM builds accept an optional timestamp override to help generate repeatable version numbers when desired.
    • The RPM version timestamp logic can now use the overridden value (when not building from a git tag), falling back to the prior UTC timestamp behavior.

Generate build timestamp once in a pre-job and propagate it via
BUILD_TIMESTAMP env var so all matrix runners (amd64, arm64) produce
the same version string. Previously each runner called date(1)
independently, causing the per-arch image tags to diverge and breaking
the multi-arch manifest creation step.

Signed-off-by: Leela Venkaiah G <leelavg@thoughtexpo.com>
@leelavg leelavg requested a review from a team as a code owner July 3, 2026 07:41
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

A release workflow job now computes a UTC build timestamp and passes it to build-microshift. The SRPM build path forwards that value into the container build, and build-rpms.sh uses it when forming MICROSHIFT_VERSION, with a UTC fallback if unset.

Changes

Build timestamp propagation

Layer / File(s) Summary
Generate and consume build timestamp
.github/workflows/release.yaml, src/image/build-rpms.sh
New generate-version job computes a UTC timestamp output; build-microshift depends on it and sets BUILD_TIMESTAMP; build-rpms.sh uses BUILD_TIMESTAMP with fallback to date -u +%Y%m%d%H%M.
Pass timestamp into SRPM build
Makefile, packaging/srpm.Containerfile
srpm now passes BUILD_TIMESTAMP as a podman build arg, and the containerfile declares ARG BUILD_TIMESTAMP.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GenerateVersion as generate-version job
  participant BuildMicroshift as build-microshift job
  participant SRPMBuild as srpm target
  participant Containerfile as packaging/srpm.Containerfile
  participant BuildRpms as build-rpms.sh

  GenerateVersion->>BuildMicroshift: provide build-timestamp output
  BuildMicroshift->>SRPMBuild: set BUILD_TIMESTAMP env var
  SRPMBuild->>Containerfile: pass --build-arg BUILD_TIMESTAMP
  Containerfile->>BuildRpms: expose BUILD_TIMESTAMP to container build
  BuildRpms->>BuildRpms: use BUILD_TIMESTAMP or fallback to date -u
Loading

Possibly related PRs

Suggested reviewers: ggiguash

🚥 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 clearly matches the main change: making matrix builds use one shared version timestamp so they produce identical versions.
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.
✨ 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.

@leelavg

leelavg commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

/hold

sample failure https://github.com/leelavg/microshift/actions/runs/28642468715/job/84945912204
will unhold after a successful build

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

🧹 Nitpick comments (1)
.github/workflows/release.yaml (1)

28-36: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add explicit permissions block to generate-version job.

Static analysis flags this job for using default (broad) permissions. Since it only computes and outputs a timestamp, scope it down.

🔒 Proposed fix
   generate-version:
     name: Generate build version
     runs-on: ubuntu-24.04
+    permissions:
+      contents: read
     outputs:
       build-timestamp: ${{ steps.timestamp.outputs.value }}
🤖 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 @.github/workflows/release.yaml around lines 28 - 36, The generate-version
job is relying on the workflow’s default GitHub token permissions even though it
only runs the timestamp step. Add an explicit permissions block to the
generate-version job in release.yaml and scope it to the minimum required access
(ideally none) so the Generate build version / timestamp step remains read-only
and cannot use broader defaults.

Source: Linters/SAST tools

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

Nitpick comments:
In @.github/workflows/release.yaml:
- Around line 28-36: The generate-version job is relying on the workflow’s
default GitHub token permissions even though it only runs the timestamp step.
Add an explicit permissions block to the generate-version job in release.yaml
and scope it to the minimum required access (ideally none) so the Generate build
version / timestamp step remains read-only and cannot use broader defaults.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bc200e8f-b705-4f75-8af0-b5a96e08fea1

📥 Commits

Reviewing files that changed from the base of the PR and between 36f9bbb and 13ecc26.

📒 Files selected for processing (2)
  • .github/workflows/release.yaml
  • src/image/build-rpms.sh

build-rpms.sh runs inside the srpm container image, so the host
environment variable is not inherited. Thread BUILD_TIMESTAMP through
as a podman --build-arg and declare it as ARG in the Containerfile
so the script picks it up instead of calling date(1) independently.

Signed-off-by: Leela Venkaiah G <leelavg@thoughtexpo.com>

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

🧹 Nitpick comments (1)
packaging/srpm.Containerfile (1)

86-86: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider grouping with other ARG declarations.

Functionally correct — BUILD_TIMESTAMP will be visible to build-rpms.sh on the next line. For consistency, other build args (USHIFT_GITREF, OKD_VERSION_TAG, etc.) are grouped near the top (Lines 10-23); grouping this one there too would improve readability, though its current placement next to its sole consumer is also reasonable.

🤖 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 `@packaging/srpm.Containerfile` at line 86, Move BUILD_TIMESTAMP into the
existing grouped ARG declarations near the top of the Containerfile alongside
USHIFT_GITREF, OKD_VERSION_TAG, and the other build args. Keep the build script
invocation in the same place, but declare BUILD_TIMESTAMP with the rest of the
inputs so the argument definitions stay consistent and easier to scan.
🤖 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.

Nitpick comments:
In `@packaging/srpm.Containerfile`:
- Line 86: Move BUILD_TIMESTAMP into the existing grouped ARG declarations near
the top of the Containerfile alongside USHIFT_GITREF, OKD_VERSION_TAG, and the
other build args. Keep the build script invocation in the same place, but
declare BUILD_TIMESTAMP with the rest of the inputs so the argument definitions
stay consistent and easier to scan.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7db447cb-5656-4ea5-8e0b-96b0ae3ba3c0

📥 Commits

Reviewing files that changed from the base of the PR and between 13ecc26 and 594cbef.

📒 Files selected for processing (2)
  • Makefile
  • packaging/srpm.Containerfile

@leelavg

leelavg commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@ggiguash ggiguash self-assigned this Jul 3, 2026
@ggiguash ggiguash merged commit 99d9d3f into microshift-io:main Jul 6, 2026
15 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.

2 participants