Skip to content

HIVE-2862: Build containers without python deps#2865

Open
suhanime wants to merge 2 commits intoopenshift:masterfrom
suhanime:HIVE-2862
Open

HIVE-2862: Build containers without python deps#2865
suhanime wants to merge 2 commits intoopenshift:masterfrom
suhanime:HIVE-2862

Conversation

@suhanime
Copy link
Contributor

@suhanime suhanime commented Mar 11, 2026

This change allows building the container images without the python dependencies that are getting harder to get by.

As a part of this change, version2.py is faithfully converted to a shell script of the same name.

Co-authored-by: Antoni Segura Puimedon antoni@redhat.com
Co-authored-by: Mark Old mold@redhat.com

Assisted-by: Claude Sonnet 4.5

Summary by CodeRabbit

  • Chores
    • Removed Python 3 and its bootstrap/install steps from the build/install sequence.
    • Replaced the Python-based version generation with a shell-script implementation, preserving version output format.
    • Updated build invocation to use the new shell-based version resolver while keeping other build behavior unchanged.

This change allows building the container images without the python
dependencies that are getting harder to get by.

As a part of this change, version2.py is faithfully converted to a shell
script of the same name.

Co-authored-by: Antoni Segura Puimedon <antoni@redhat.com>
Co-authored-by: Mark Old <mold@redhat.com>

Assisted-by: Claude Sonnet 4.5
@suhanime suhanime requested a review from 2uasimojo March 11, 2026 18:28
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 11, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 11, 2026

@suhanime: This pull request references HIVE-2862 which is a valid jira issue.

Details

In response to this:

This change allows building the container images without the python dependencies that are getting harder to get by.

As a part of this change, version2.py is faithfully converted to a shell script of the same name.

Co-authored-by: Antoni Segura Puimedon antoni@redhat.com
Co-authored-by: Mark Old mold@redhat.com

Assisted-by: Claude Sonnet 4.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: deec7e13-5382-4860-8d72-1d2697b57ef3

📥 Commits

Reviewing files that changed from the base of the PR and between 1bccef7 and 9b27aa8.

📒 Files selected for processing (1)
  • Makefile
🚧 Files skipped from review as they are similar to previous changes (1)
  • Makefile

Walkthrough

Replaces the Python-based Git versioning utility with a Bash implementation, removes Python bootstrap/install from build steps, and updates Makefile to call the new shell script for computing SOURCE_GIT_TAG. Docker and build-deps adjustments skip Python installation but preserve existing build commands.

Changes

Cohort / File(s) Summary
Docker / build deps
Dockerfile, hack/ubi-build-deps.sh
Removed Python/ensurepip bootstrap steps and removed python3 from dnf install list; other build steps, env vars, and make build calls unchanged.
Makefile
Makefile
Replaced Python-based computation of SOURCE_GIT_TAG (ensurepip + gitpython/pyyaml + hack/version2.py) with a direct shell invocation $(shell hack/version2.sh).
Versioning scripts
hack/version2.py, hack/version2.sh
Deleted hack/version2.py (Python implementation). Added hack/version2.sh implementing equivalent Git-aware versioning: branch detection (mce-X.Y/master/unknown), branch validation, commit resolution, commit counting, and semver output (v{PREFIX}.{COUNT}-{shortsha}).

Sequence Diagram(s)

sequenceDiagram
    participant Make as Makefile
    participant Script as hack/version2.sh
    participant Git as GitRepo
    participant Build as Docker/BuildEnv

    Make->>Script: invoke hack/version2.sh
    Script->>Git: resolve COMMIT (HEAD or provided)
    Script->>Git: discover/validate BRANCH (local/remotes)
    Script->>Git: compute COMMIT_COUNT and short SHA
    Script-->>Make: return version string (vX.Y.Z-shortsha)
    Make->>Build: use SOURCE_GIT_TAG in build (Dockerfile / make)
    Build-->Make: build artifacts
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 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 and specifically summarizes the main objective of the PR: removing Python dependencies from the build process.
Docstring Coverage ✅ Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%.
Stable And Deterministic Test Names ✅ Passed PR modifies only build infrastructure and utility files without changing any test files.
Test Structure And Quality ✅ Passed PR modifies only build infrastructure and scripts, with no changes to Ginkgo test code or test files.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 11, 2026

@suhanime: This pull request references HIVE-2862 which is a valid jira issue.

Details

In response to this:

This change allows building the container images without the python dependencies that are getting harder to get by.

As a part of this change, version2.py is faithfully converted to a shell script of the same name.

Co-authored-by: Antoni Segura Puimedon antoni@redhat.com
Co-authored-by: Mark Old mold@redhat.com

Assisted-by: Claude Sonnet 4.5

Summary by CodeRabbit

  • Chores
  • Removed Python 3 dependency from build process, including ensurepip bootstrap steps and Python package installations.
  • Migrated version generation logic from Python to shell script implementation, reducing external dependencies while maintaining version computation functionality.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
hack/version2.sh (1)

29-44: Consider adding level prefix to log messages.

The log function accepts a level parameter but doesn't include it in the output. This makes it harder to distinguish debug, info, warning, and fatal messages when reading logs.

♻️ Optional: Add level prefix to log output
 log() {
     local level="$1"
     shift
     local message="$*"
 
     if [[ "$MODE" == "standalone" ]]; then
-        echo "$message" >&2
+        echo "[$level] $message" >&2
     else
-        echo "$message"
+        echo "[$level] $message"
     fi
 
     if [[ "$level" == "fatal" ]]; then
         exit 1
     fi
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@hack/version2.sh` around lines 29 - 44, The log function currently accepts a
level parameter but prints only the message; update the log() function to prefix
printed output with the level (e.g., "[level] message") so callers can
distinguish debug/info/warn/fatal; preserve existing MODE logic (when
MODE=="standalone" write to stderr, otherwise stdout) and keep the exit behavior
when level == "fatal". Ensure you modify the log() implementation (references:
function name log, parameter level, variable MODE) to build and echo the
prefixed string rather than echoing just "$message".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@hack/version2.sh`:
- Around line 291-294: The version_string() function currently echoes
"v$(semver)" which duplicates the 'v' because the Makefile's SOURCE_GIT_TAG :=
v$(shell hack/version2.sh) also prepends a 'v'; fix by removing the leading 'v'
from version_string() so it echoes "$(semver)" (leave semver() behavior
unchanged), or alternatively remove the extra 'v' in the Makefile assignment to
avoid producing "vv..."—preferably update version_string() to return the raw
semver value to keep tag formatting centralized.

In `@Makefile`:
- Around line 83-85: SOURCE_GIT_TAG is being set to v$(shell hack/version2.sh)
which causes a double "v" when version_string() already emits a leading "v"; fix
by ensuring only one source of the "v" prefix: either remove the hardcoded "v"
in SOURCE_GIT_TAG or (preferred) change version_string() in hack/version2.sh to
return the version without a leading "v" so SOURCE_GIT_TAG remains v<version>.
Update the version_string() implementation accordingly and keep SOURCE_GIT_TAG
as-is to preserve the existing Makefile pattern.

---

Nitpick comments:
In `@hack/version2.sh`:
- Around line 29-44: The log function currently accepts a level parameter but
prints only the message; update the log() function to prefix printed output with
the level (e.g., "[level] message") so callers can distinguish
debug/info/warn/fatal; preserve existing MODE logic (when MODE=="standalone"
write to stderr, otherwise stdout) and keep the exit behavior when level ==
"fatal". Ensure you modify the log() implementation (references: function name
log, parameter level, variable MODE) to build and echo the prefixed string
rather than echoing just "$message".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d1df7309-73af-414c-9abb-ca8841a1c1a4

📥 Commits

Reviewing files that changed from the base of the PR and between a5d0850 and 1bccef7.

📒 Files selected for processing (5)
  • Dockerfile
  • Makefile
  • hack/ubi-build-deps.sh
  • hack/version2.py
  • hack/version2.sh
💤 Files with no reviewable changes (2)
  • Dockerfile
  • hack/version2.py

@openshift-ci openshift-ci bot requested review from dlom and jstuever March 11, 2026 18:33
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 11, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: suhanime

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2026
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 11, 2026

@suhanime: This pull request references HIVE-2862 which is a valid jira issue.

Details

In response to this:

This change allows building the container images without the python dependencies that are getting harder to get by.

As a part of this change, version2.py is faithfully converted to a shell script of the same name.

Co-authored-by: Antoni Segura Puimedon antoni@redhat.com
Co-authored-by: Mark Old mold@redhat.com

Assisted-by: Claude Sonnet 4.5

Summary by CodeRabbit

  • Chores
  • Removed Python 3 and its bootstrap/install steps from the build/install sequence.
  • Replaced the Python-based version generation with a shell-script implementation, preserving version output format.
  • Updated build invocation to use the new shell-based version resolver while keeping other build behavior unchanged.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 11, 2026

@suhanime: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/verify 9b27aa8 link true /test verify

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants