Skip to content

ART-19542: Remove deprecated separate golang branch logic, always use monobranch#3136

Draft
kopero2000 wants to merge 7 commits into
openshift-eng:mainfrom
kopero2000:cleanup-logic-for-seperate-golang-versions
Draft

ART-19542: Remove deprecated separate golang branch logic, always use monobranch#3136
kopero2000 wants to merge 7 commits into
openshift-eng:mainfrom
kopero2000:cleanup-logic-for-seperate-golang-versions

Conversation

@kopero2000

@kopero2000 kopero2000 commented Jul 9, 2026

Copy link
Copy Markdown

Summary

This PR removes the deprecated separate golang branch logic from the update-golang pipeline and makes it always use the unified golang monobranch layout. Additionally, it implements support for golang RPM signing and plashet workflow with the monobranch (ART-21532).

Changes

Update Golang Pipeline (update_golang.py)

  • Added deprecation warning: When --use-new-golang-branch flag is not set (default), a warning is logged directing users to the golang monobranch
  • Removed get_golang_branch() method: No longer needed since we always use 'golang' monobranch
  • Simplified _get_doozer_var_args(): Always returns MAJOR/MINOR OCP version variables (needed for monobranch template substitution)
  • Simplified _get_doozer_group_and_image(): Always uses GOLANG_DATA_BRANCH = 'golang' and versioned image keys
  • Simplified verify_golang_builder_repo(): Always checks the 'golang' monobranch
  • Simplified should_sign_golang_rpm(): Always reads from 'golang' monobranch group.yml
  • Fixed _build_golang_plashets(): Now uses monobranch and passes OCP version for MAJOR/MINOR variable resolution
  • Updated CLI help text: Marked --use-new-golang-branch as deprecated

Plashet Support for Monobranch (ART-21532 fix)

  • plashets.py: Added version parameter to build_plashets() and build_plashet_from_tags() functions
  • build_plashets.py: Added --version CLI option and passed through to BuildPlashetsPipeline
  • jenkins.py: Added VERSION parameter support to start_build_plashets() function
  • Variable injection: When version is provided, the plashet build now injects --var MAJOR=X --var MINOR=Y before the --group argument, allowing doozer to resolve template placeholders in the monobranch group.yml

Test Updates

  • Removed test_get_golang_branch (method no longer exists)
  • Updated test_get_doozer_var_args to expect vars are always returned
  • Updated test_rebase_brew to expect monobranch group name and --var arguments
  • Updated test_returns_true_when_config_set and related tests to expect ref='golang' instead of separate branch names
  • Updated test_triggers_jenkins_for_each_el_version to verify VERSION parameter is passed

Backward Compatibility

The --use-new-golang-branch parameter is kept to:

  1. Show deprecation warnings to users still using the old default
  2. Maintain CLI compatibility (no breaking changes)

The flag is now effectively ignored - the pipeline always uses the monobranch approach.

Unused --var arguments passed to doozer are harmless - they're simply ignored if the group.yml doesn't have corresponding template placeholders, making this change safe for both old and new branch layouts.

Testing

  • All unit tests pass (82 passed)
  • Verified deprecation warning appears when flag is not set
  • Plashet build now passes VERSION parameter with MAJOR/MINOR vars
  • Confirmed unused vars don't cause errors in doozer

Related Issues

Summary by CodeRabbit

  • New Features
    • Plashet builds now accept an explicit --version and can override the default OCP version to derive major/minor values for configuration.
  • Bug Fixes
    • Golang plashet triggering, signing, and builder configuration now consistently use the unified golang layout for more reliable version/template resolution.
    • Plashet Doozer configuration now supports passing additional variables to group config loading.
  • Deprecation
    • The --use-new-golang-branch option is deprecated: a warning is emitted and the flag is ignored.
  • Chores
    • Updated the Jenkins job path used for plashet builds.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 9, 2026
@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign thegreyd for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The Golang update pipeline now uses the unified golang data branch for configuration, validation, Doozer setup, and plashet triggering. Version data is threaded through plashet builds so MAJOR/MINOR and Jenkins version parameters reach downstream commands.

Changes

Golang monobranch and plashet flow

Layer / File(s) Summary
Unified Golang pipeline behavior
pyartcd/pyartcd/pipelines/update_golang.py, pyartcd/tests/pipelines/test_update_golang.py
The pipeline uses the golang branch and group, supplies MAJOR/MINOR variables, passes version data to Jenkins, and updates tests for monobranch behavior.
Version-aware plashet build
pyartcd/pyartcd/pipelines/build_plashets.py, pyartcd/pyartcd/plashets.py, pyartcd/pyartcd/util.py
CLI and pipeline version parameters are propagated into group configuration and Doozer commands as conditional MAJOR/MINOR variables.
Jenkins parameter wiring
pyartcd/pyartcd/jenkins.py
The plashet job path changes, and Jenkins receives VERSION and OVERRIDE_OCP_VERSION parameters.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant UpdateGolangPipeline
  participant Jenkins
  participant BuildPlashetsPipeline
  participant Doozer
  UpdateGolangPipeline->>Jenkins: Start plashet with group golang and VERSION
  Jenkins->>BuildPlashetsPipeline: Pass VERSION and OVERRIDE_OCP_VERSION
  BuildPlashetsPipeline->>Doozer: Resolve group configuration with MAJOR and MINOR
Loading

Possibly related PRs

Suggested labels: lgtm, tide/merge-method-squash

Suggested reviewers: ashwindasr, thegreyd

🚥 Pre-merge checks | ✅ 9 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Ai-Attribution ⚠️ Warning Relevant commits use Co-Authored-By trailers for Claude/Cursor; no Assisted-by/Generated-by Red Hat attribution was found. Replace AI Co-Authored-By trailers with Assisted-by: or Generated-by: Red Hat attribution, or remove them if AI tools weren’t actually used.
✅ Passed checks (9 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 PR’s main change: removing deprecated separate Golang branch logic in favor of the unified monobranch.
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.
No-Weak-Crypto ✅ Passed Changed files add no crypto primitives or secret comparisons; searches for MD5/SHA1/DES/RC4/3DES/Blowfish/ECB and hashlib/hmac/secrets returned nothing.
Container-Privileges ✅ Passed PR only changes doozer Python logic; no container/K8s manifest changes or added privileged/hostNetwork/etc. settings were found.
No-Sensitive-Data-In-Logs ✅ Passed New/changed logs only emit a deprecation notice, build status, timestamps, and command strings with version/group data; no secrets, PII, or keys are logged.
No-Hardcoded-Secrets ✅ Passed No hardcoded secrets, embedded credentials, or secret-like literals were added; password/token use remains env-based.
No-Injection-Vectors ✅ Passed New code uses argv lists and yaml.safe_load; I found no shell/eval/SQL/os.system/dangerous HTML patterns in the touched changes.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@pyartcd/pyartcd/pipelines/update_golang.py`:
- Around line 1044-1046: Update the `test_get_doozer_var_args` expectations to
match `_get_doozer_var_args` in `update_golang.py`, which now always returns the
`--var MAJOR=...` and `--var MINOR=...` arguments regardless of
`use_new_golang_branch`. Adjust the test in `test_update_golang.py` so the
default case no longer expects an empty list and both branches assert the
unconditional var output from `UpdateGolangPipeline._get_doozer_var_args`.
🪄 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: Repository: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f6d02e31-482f-400f-9c62-b891e5ff4285

📥 Commits

Reviewing files that changed from the base of the PR and between 420e6df and bb664f4.

📒 Files selected for processing (1)
  • pyartcd/pyartcd/pipelines/update_golang.py

Comment thread pyartcd/pyartcd/pipelines/update_golang.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pyartcd/pyartcd/jenkins.py (1)

776-790: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Pass version= to start_build_plashets
VERSION=self.ocp_version never reaches the new version parameter, and start_build does not accept arbitrary kwargs, so this path raises TypeError before VERSION is added to Jenkins params. Switch the call site to version=self.ocp_version.

🤖 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 `@pyartcd/pyartcd/jenkins.py` around lines 776 - 790, The start_build_plashets
call path is not passing the new version argument, so VERSION never makes it
into the Jenkins params and the call can fail before that point. Update the call
site that invokes start_build_plashets to pass version=self.ocp_version
explicitly, and verify the start_build_plashets function’s version parameter is
used instead of relying on kwargs from start_build.
🧹 Nitpick comments (2)
pyartcd/pyartcd/plashets.py (2)

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

build_plashet_from_tags docstring not updated for the new version parameter.

Unlike build_plashets (line 231), the docstring for build_plashet_from_tags wasn't updated to document the new version param.

🤖 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 `@pyartcd/pyartcd/plashets.py` around lines 406 - 430, The
`build_plashet_from_tags` docstring is missing documentation for the new
`version` parameter, unlike `build_plashets`. Update the docstring in
`build_plashet_from_tags` to include `version` alongside the existing
parameters, keeping the description consistent with the function signature and
related plashet builder documentation.

439-446: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Unguarded version.split('.') unpack can crash on malformed input.

If version doesn't split into exactly two dot-separated parts (e.g. an accidental 4.18.2 or trailing garbage from CLI/Jenkins input), major, minor = version.split('.') raises an unhandled ValueError, aborting the plashet build. This mirrors the same fragile pattern already used in _get_doozer_var_args (update_golang.py), so consider centralizing MAJOR/MINOR parsing (e.g. a small shared parse_major_minor(version) helper with a clear error message) instead of duplicating the unguarded split logic across files.

🛡️ Proposed guard
     if version:
-        major, minor = version.split('.')
+        parts = version.split('.')
+        if len(parts) != 2:
+            raise ValueError(f"Expected version in MAJOR.MINOR format, got: {version!r}")
+        major, minor = parts
         cmd.extend(['--var', f'MAJOR={major}', '--var', f'MINOR={minor}'])
🤖 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 `@pyartcd/pyartcd/plashets.py` around lines 439 - 446, The MAJOR/MINOR
extraction in plashets command assembly is using an unguarded version.split('.')
unpack that can raise ValueError on malformed input. Update the logic around the
version handling in plashets.py to validate the version format before unpacking,
and reuse a shared helper such as parse_major_minor(version) if available or
create one so the parsing and error message are consistent with
_get_doozer_var_args in update_golang.py. Ensure the helper returns or raises a
clear, user-facing error when the version is not exactly major.minor.
🤖 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.

Outside diff comments:
In `@pyartcd/pyartcd/jenkins.py`:
- Around line 776-790: The start_build_plashets call path is not passing the new
version argument, so VERSION never makes it into the Jenkins params and the call
can fail before that point. Update the call site that invokes
start_build_plashets to pass version=self.ocp_version explicitly, and verify the
start_build_plashets function’s version parameter is used instead of relying on
kwargs from start_build.

---

Nitpick comments:
In `@pyartcd/pyartcd/plashets.py`:
- Around line 406-430: The `build_plashet_from_tags` docstring is missing
documentation for the new `version` parameter, unlike `build_plashets`. Update
the docstring in `build_plashet_from_tags` to include `version` alongside the
existing parameters, keeping the description consistent with the function
signature and related plashet builder documentation.
- Around line 439-446: The MAJOR/MINOR extraction in plashets command assembly
is using an unguarded version.split('.') unpack that can raise ValueError on
malformed input. Update the logic around the version handling in plashets.py to
validate the version format before unpacking, and reuse a shared helper such as
parse_major_minor(version) if available or create one so the parsing and error
message are consistent with _get_doozer_var_args in update_golang.py. Ensure the
helper returns or raises a clear, user-facing error when the version is not
exactly major.minor.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: da678086-e0db-4c3f-b17a-e9481182fea8

📥 Commits

Reviewing files that changed from the base of the PR and between bb664f4 and 7fbcce7.

📒 Files selected for processing (5)
  • pyartcd/pyartcd/jenkins.py
  • pyartcd/pyartcd/pipelines/build_plashets.py
  • pyartcd/pyartcd/pipelines/update_golang.py
  • pyartcd/pyartcd/plashets.py
  • pyartcd/tests/pipelines/test_update_golang.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyartcd/pyartcd/pipelines/update_golang.py

@kopero2000 kopero2000 changed the title Remove deprecated separate golang branch logic, always use monobranch ART-19542: Remove deprecated separate golang branch logic, always use monobranch Jul 9, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 9, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 9, 2026

Copy link
Copy Markdown

@kopero2000: This pull request references ART-19542 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the ticket to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

This PR removes the deprecated separate golang branch logic from the update-golang pipeline and makes it always use the unified golang monobranch layout.

Changes

  • Added deprecation warning: When --use-new-golang-branch flag is not set (default), a warning is logged directing users to the golang monobranch
  • Removed get_golang_branch() method: No longer needed since we always use 'golang' monobranch
  • Simplified _get_doozer_var_args(): Always returns MAJOR/MINOR OCP version variables
  • Simplified _get_doozer_group_and_image(): Always uses GOLANG_DATA_BRANCH = 'golang' and versioned image keys
  • Simplified verify_golang_builder_repo(): Always checks the 'golang' monobranch
  • Simplified should_sign_golang_rpm(): Always reads from 'golang' monobranch group.yml
  • Updated CLI help text: Marked --use-new-golang-branch as deprecated

Backward Compatibility

The --use-new-golang-branch parameter is kept to:

  1. Show deprecation warnings to users still using the old default
  2. Maintain CLI compatibility (no breaking changes)

The flag is now effectively ignored - the pipeline always uses the monobranch approach.

Testing

  • Verify the deprecation warning appears when flag is not set
  • Test golang update pipeline with monobranch layout
  • Ensure all RHEL versions work correctly

Related

Summary by CodeRabbit

  • Bug Fixes
  • Unified Go gopipeline branch/layout handling to consistently use the shared golang data branch for signing and builder validation.
  • Updated golang RPM signing and plashet triggering to reference monobranch golang configuration, with correct MAJOR/MINOR resolution.
  • Deprecated --use-new-golang-branch; it’s now ignored and emits a deprecation warning when not enabled.
  • New Features
  • Added optional --version support for plashet builds, propagating VERSION through Jenkins and injecting MAJOR/MINOR into the doozer command when provided.

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 coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@pyartcd/pyartcd/jenkins.py`:
- Around line 788-789: Only include the VERSION entry in the parameter mapping
built by the relevant Jenkins helper when version is not None; preserve
OVERRIDE_OCP_VERSION and existing behavior for callers that omit version, so
urlencode() never emits VERSION=None.
🪄 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: Repository: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ed97b025-30f2-432e-9443-048b1b99294f

📥 Commits

Reviewing files that changed from the base of the PR and between 7fbcce7 and 444a1ca.

📒 Files selected for processing (5)
  • pyartcd/pyartcd/jenkins.py
  • pyartcd/pyartcd/pipelines/build_plashets.py
  • pyartcd/pyartcd/pipelines/update_golang.py
  • pyartcd/pyartcd/plashets.py
  • pyartcd/tests/pipelines/test_update_golang.py
🚧 Files skipped from review as they are similar to previous changes (4)
  • pyartcd/tests/pipelines/test_update_golang.py
  • pyartcd/pyartcd/plashets.py
  • pyartcd/pyartcd/pipelines/update_golang.py
  • pyartcd/pyartcd/pipelines/build_plashets.py

Comment thread pyartcd/pyartcd/jenkins.py Outdated
Comment on lines +788 to +789
'OVERRIDE_OCP_VERSION': override_ocp_version,
'VERSION': version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Find all callers of start_build_plashets to verify whether version is always provided.

rg -n -A5 'start_build_plashets' --type py pyartcd/

Repository: openshift-eng/art-tools

Length of output: 12023


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== start_build_plashets definition =="
sed -n '776,805p' pyartcd/pyartcd/jenkins.py

echo
echo "== build_microshift_bootc caller =="
sed -n '500,530p' pyartcd/pyartcd/pipelines/build_microshift_bootc.py

echo
echo "== scan_plashet_rpms caller =="
sed -n '295,320p' pyartcd/pyartcd/pipelines/scan_plashet_rpms.py

echo
echo "== ocp caller =="
sed -n '790,812p' pyartcd/pyartcd/pipelines/ocp.py

echo
echo "== ocp4_konflux caller =="
sed -n '1010,1030p' pyartcd/pyartcd/pipelines/ocp4_konflux.py

echo
echo "== update_golang caller =="
sed -n '612,632p' pyartcd/pyartcd/pipelines/update_golang.py

Repository: openshift-eng/art-tools

Length of output: 6187


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== start_build implementation =="
sed -n '330,375p' pyartcd/pyartcd/jenkins.py

echo
echo "== Jenkins client usage/search =="
rg -n "build_params|invoke\\(" pyartcd/pyartcd -g '*.py'

echo
echo "== Any explicit handling of None params =="
rg -n "None.*VERSION|VERSION.*None|bool.*build_params|clean.*params" pyartcd/pyartcd -g '*.py'

Repository: openshift-eng/art-tools

Length of output: 1915


🌐 Web query:

python-jenkins build_params None invoke build parameter serialization

💡 Result:

In the python-jenkins library, the build_job(name, parameters=None, token=None) method handles parameter serialization by converting the provided dictionary or list of tuples into a URL-encoded string [1][2]. When you invoke build_job with the parameters argument, the library internally calls build_job_url, which performs the following logic [2]: 1. Serialization: It uses urllib.urlencode to convert the parameters dictionary (or list of two-membered tuples) into a standard URL-encoded query string [2]. 2. Endpoint Selection: - If parameters are provided (i.e., parameters is not None), the library targets the buildWithParameters endpoint [2]. - If parameters is None, it targets the standard build endpoint [2]. 3. Execution: The resulting URL (including the query string if parameters are present) is requested using the internal jenkins_open method [2]. Key technical considerations: - Data Structure: The parameters argument must be a dict or a list of two-membered tuples [1][2]. Using a list of tuples is specifically recommended when you need to supply multiple values for parameters with multi-select options [1]. - Job Configuration: The Jenkins job itself must be configured to accept parameters [3][4]. If you pass parameters to a job that is not configured to accept them, Jenkins will return an error (typically a 500 status code or a javax.servlet.ServletException) [3][4]. - API Behavior: Because build_job relies on URL serialization, ensure that your parameter values are compatible with URL encoding [2]. If a job requires complex data or large payloads, this standard URL-based triggering mechanism may be insufficient, as it is designed for simple key-value parameter pairs [2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from urllib.parse import urlencode

cases = [
    {"VERSION": None},
    {"OVERRIDE_OCP_VERSION": False},
    {"OVERRIDE_OCP_VERSION": True},
    {"VERSION": "4.18"},
]
for case in cases:
    print(case, "->", urlencode(case))
PY

Repository: openshift-eng/art-tools

Length of output: 353


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "build-plashets|BUILD_PLASHETS|VERSION" -g '*.yml' -g '*.yaml' -g '*.groovy' -g '*.jenkins*' -g '*.xml' -g '*.py' pyartcd .claude .

Repository: openshift-eng/art-tools

Length of output: 1969


Only add VERSION when a version is set. In pyartcd/pyartcd/jenkins.py:788-789, urlencode() turns None into the literal VERSION=None, so callers that omit version now send a bogus parameter instead of omitting it. That changes the previous behavior and can break plashet builds.

🤖 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 `@pyartcd/pyartcd/jenkins.py` around lines 788 - 789, Only include the VERSION
entry in the parameter mapping built by the relevant Jenkins helper when version
is not None; preserve OVERRIDE_OCP_VERSION and existing behavior for callers
that omit version, so urlencode() never emits VERSION=None.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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 `@pyartcd/pyartcd/plashets.py`:
- Around line 259-260: Validate the format of version in the
override_ocp_version handling before unpacking it: split on “.” and require
exactly two non-empty components, otherwise raise a clear ValueError describing
the expected major.minor format. Update the logic around the existing version
processing in plashets.py so valid values still assign major and minor safely.
- Around line 259-261: The MAJOR extra variable in the override OCP version
handling incorrectly includes a literal dollar sign. Update the version parsing
block to construct MAJOR from the parsed major value without "$", matching the
existing MINOR assignment and ensuring doozer receives the numeric version.

In `@pyartcd/pyartcd/util.py`:
- Line 85: Replace the mutable default for extra_vars with a None default and
annotate it as List[str] | None in the affected function; initialize it to an
empty list inside the function before use, preserving existing behavior and
satisfying Ruff B006.
- Around line 92-94: Reorder the argument construction in the affected utility
command so the `group` value immediately follows `"--group"`, then append each
`--var` and its corresponding `extra_vars` value. Update the list expression
around the command-building logic to ensure `doozer` parses the group correctly
when extra variables are present.
🪄 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: Repository: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7c427cf9-93a8-460f-93d6-35c393231da9

📥 Commits

Reviewing files that changed from the base of the PR and between 444a1ca and 4084a24.

📒 Files selected for processing (2)
  • pyartcd/pyartcd/plashets.py
  • pyartcd/pyartcd/util.py

Comment on lines +259 to +260
if(override_ocp_version and version):
major, minor = version.split('.')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

version.split('.') will crash on versions with ≠2 components.

major, minor = version.split('.') raises ValueError if version has more or fewer than 2 dot-separated parts (e.g., "4.18.0" → too many values to unpack; "4" → not enough values to unpack). The docstring says version is e.g. '4.18', but there's no validation. A caller passing a three-part version would get an opaque unpacking error.

🛡️ Proposed fix — validate version format
 if(override_ocp_version and version):
-    major, minor = version.split('.')
+    parts = version.split('.')
+    if len(parts) != 2:
+        raise ValueError(f"version must be in X.Y format, got: {version}")
+    major, minor = parts
     extra_vars = [f"MAJOR={major}", f"MINOR={minor}"]
📝 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
if(override_ocp_version and version):
major, minor = version.split('.')
if(override_ocp_version and version):
parts = version.split('.')
if len(parts) != 2:
raise ValueError(f"version must be in X.Y format, got: {version}")
major, minor = parts
extra_vars = [f"MAJOR={major}", f"MINOR={minor}"]
🤖 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 `@pyartcd/pyartcd/plashets.py` around lines 259 - 260, Validate the format of
version in the override_ocp_version handling before unpacking it: split on “.”
and require exactly two non-empty components, otherwise raise a clear ValueError
describing the expected major.minor format. Update the logic around the existing
version processing in plashets.py so valid values still assign major and minor
safely.

Comment on lines +259 to +261
if(override_ocp_version and version):
major, minor = version.split('.')
extra_vars = [f"MAJOR=${major}", f"MINOR={minor}"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether build_plashet_from_tags (lines ~448-456) has the same $ bug
sed -n '430,470p' pyartcd/pyartcd/plashets.py

Repository: openshift-eng/art-tools

Length of output: 1333


Remove the literal $ from the MAJOR f-string. f"MAJOR=${major}" passes MAJOR=$4 to doozer; it should be MAJOR=4, otherwise version-based plashet path construction breaks when override_ocp_version is set.

🤖 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 `@pyartcd/pyartcd/plashets.py` around lines 259 - 261, The MAJOR extra variable
in the override OCP version handling incorrectly includes a literal dollar sign.
Update the version parsing block to construct MAJOR from the parsed major value
without "$", matching the existing MINOR assignment and ensuring doozer receives
the numeric version.

Comment thread pyartcd/pyartcd/util.py
env=None,
doozer_data_path: str = constants.OCP_BUILD_DATA_URL,
doozer_data_gitref: str = '',
extra_vars: List=[]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Mutable default argument extra_vars: List=[] — use None instead.

Ruff B006 flags this. Although the function only reads extra_vars (no mutation), mutable defaults are a well-known Python anti-pattern. Since the project targets Python 3.11, List[str] | None is valid syntax.

♻️ Proposed fix — use None default with in-function initialization
-    extra_vars: List=[]
+    extra_vars: List[str] | None = None
 ) -> Dict:
+    if extra_vars is None:
+        extra_vars = []
     if doozer_data_gitref:
📝 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
extra_vars: List=[]
extra_vars: List[str] | None = None
) -> Dict:
if extra_vars is None:
extra_vars = []
if doozer_data_gitref:
🧰 Tools
🪛 Ruff (0.15.20)

[warning] 85-85: Do not use mutable data structures for argument defaults

Replace with None; initialize within function

(B006)

🤖 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 `@pyartcd/pyartcd/util.py` at line 85, Replace the mutable default for
extra_vars with a None default and annotate it as List[str] | None in the
affected function; initialize it to an empty list inside the function before
use, preserving existing behavior and satisfying Ruff B006.

Source: Linters/SAST tools

Comment thread pyartcd/pyartcd/util.py
Comment on lines 92 to 94
"--group",
*[param for extra_var in extra_vars for param in ['--var', extra_var]],
group,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify doozer's --group argument parser definition (nargs vs standard store)
rg -n "add_argument.*--group" doozer/ --type=py -C2
# Also check --var definition
rg -n "add_argument.*--var" doozer/ --type=py -C2

Repository: openshift-eng/art-tools

Length of output: 161


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- util.py around reported lines ---'
sed -n '1,180p' pyartcd/pyartcd/util.py | cat -n

echo '--- search load_group_config usage/tests ---'
rg -n "load_group_config|config:read-group|--group|--var" pyartcd/ -g '*.py' -C 2

Repository: openshift-eng/art-tools

Length of output: 50380


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- doozer --group / --var definitions ---'
rg -n '`@click`\.option\(|add_argument\(' doozer -g '*.py' -C 2 | rg -n --context 0 --no-heading '--group|--var|config:read-group|context_settings|allow_interspersed_args'

echo '--- doozer command entrypoints mentioning config:read-group ---'
rg -n 'config:read-group|read-group' doozer -g '*.py' -C 3

Repository: openshift-eng/art-tools

Length of output: 679


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- locate doozer CLI entrypoint files ---'
git ls-files doozer | rg '(^|/)cli/|__main__\.py$|main\.py$|click|argparse'

echo '--- search for click group/parser settings ---'
rg -n --fixed-strings 'allow_interspersed_args' doozer -g '*.py' -C 2 || true
rg -n --fixed-strings 'ignore_unknown_options' doozer -g '*.py' -C 2 || true

echo '--- search for --var and config:read-group definitions ---'
rg -n -- '--var|config:read-group|click\.group|click\.option\(\s*[\'"]--group|click\.option\(\s*[\'"]--var' doozer -g '*.py' -C 3 || true

Repository: openshift-eng/art-tools

Length of output: 3087


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- AST outline of doozer CLI entrypoints ---'
ast-grep outline doozer/doozerlib/cli/__init__.py --view expanded || true
ast-grep outline doozer/doozerlib/cli/__main__.py --view expanded || true
ast-grep outline doozer/doozerlib/cli/cli_opts.py --view expanded || true
ast-grep outline doozer/doozerlib/cli/config.py --view expanded || true

echo '--- search for var/group/config:read-group with safe quoting ---'
rg -n --fixed-strings '--var' doozer/doozerlib/cli -g '*.py' -C 3 || true
rg -n --fixed-strings 'config:read-group' doozer/doozerlib/cli -g '*.py' -C 3 || true
rg -n --fixed-strings '--group' doozer/doozerlib/cli/cli_opts.py doozer/doozerlib/cli/config.py -g '*.py' -C 3 || true

Repository: openshift-eng/art-tools

Length of output: 5515


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- root CLI options around group setup ---'
sed -n '200,280p' doozer/doozerlib/cli/__init__.py | cat -n

echo '--- cli options defaults/definitions ---'
sed -n '1,120p' doozer/doozerlib/cli/cli_opts.py | cat -n

echo '--- exact --var and --group option definitions in doozer CLI ---'
rg -n --fixed-strings -- '--var' doozer/doozerlib/cli -g '*.py' -C 3 || true
rg -n --fixed-strings -- '--group' doozer/doozerlib/cli/__init__.py doozer/doozerlib/cli/cli_opts.py -C 3 || true

python3 - <<'PY'
import click

`@click.group`(context_settings=dict(help_option_names=['-h', '--help']))
`@click.option`('--group')
`@click.option`('--var', multiple=True)
def cli(group, var):
    click.echo(f'group={group!r} var={var!r}')

`@cli.command`()
def config():
    pass

# Exercise argv shapes relevant to the review comment.
for argv in [
    ['--group', '--var', 'MAJOR=4', '--var', 'MINOR=18', 'golang', 'config'],
    ['--group', 'golang', '--var', 'MAJOR=4', '--var', 'MINOR=18', 'config'],
    ['--group=golang', '--var', 'MAJOR=4', '--var', 'MINOR=18', 'config'],
]:
    try:
        rv = cli.main(args=argv, prog_name='doozer', standalone_mode=False)
        print('argv', argv, '-> ok')
    except Exception as e:
        print('argv', argv, '->', type(e).__name__, e)
PY

Repository: openshift-eng/art-tools

Length of output: 7399


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- root CLI options around group setup ---'
sed -n '200,280p' doozer/doozerlib/cli/__init__.py | cat -n

echo '--- cli options defaults/definitions ---'
sed -n '1,120p' doozer/doozerlib/cli/cli_opts.py | cat -n

echo '--- exact --var and --group option definitions in doozer CLI ---'
rg -n --fixed-strings -- '--var' doozer/doozerlib/cli -g '*.py' -C 3 || true
rg -n --fixed-strings -- '--group' doozer/doozerlib/cli/__init__.py doozer/doozerlib/cli/cli_opts.py -C 3 || true

python3 - <<'PY'
import click

`@click.group`(context_settings=dict(help_option_names=['-h', '--help']))
`@click.option`('--group')
`@click.option`('--var', multiple=True)
def cli(group, var):
    click.echo(f'group={group!r} var={var!r}')

`@cli.command`()
def config():
    pass

for argv in [
    ['--group', '--var', 'MAJOR=4', '--var', 'MINOR=18', 'golang', 'config'],
    ['--group', 'golang', '--var', 'MAJOR=4', '--var', 'MINOR=18', 'config'],
    ['--group=golang', '--var', 'MAJOR=4', '--var', 'MINOR=18', 'config'],
]:
    try:
        cli.main(args=argv, prog_name='doozer', standalone_mode=False)
        print('argv', argv, '-> ok')
    except Exception as e:
        print('argv', argv, '->', type(e).__name__, e)
PY

Repository: openshift-eng/art-tools

Length of output: 7399


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- callers passing extra_vars to load_group_config ---'
rg -n --fixed-strings 'extra_vars=' pyartcd doozer -g '*.py' -C 2 || true

echo '--- direct load_group_config calls ---'
rg -n --fixed-strings 'load_group_config(' pyartcd -g '*.py' -C 2 || true

Repository: openshift-eng/art-tools

Length of output: 10593


Move --var after the --group value. doozer reads --group’s value immediately, so this order shifts --var into the group slot and breaks the command whenever extra_vars is set.

🤖 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 `@pyartcd/pyartcd/util.py` around lines 92 - 94, Reorder the argument
construction in the affected utility command so the `group` value immediately
follows `"--group"`, then append each `--var` and its corresponding `extra_vars`
value. Update the list expression around the command-building logic to ensure
`doozer` parses the group correctly when extra variables are present.

Source: Linters/SAST tools

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@pyartcd/pyartcd/jenkins.py`:
- Around line 788-791: Remove the hardcoded developer branch value from
ART_TOOLS_COMMIT, or source it from an appropriate configurable or dynamically
determined value. Update the parameter construction in the relevant Jenkins
build function to include VERSION only when version is not None, preventing
urlencode() from emitting VERSION=None.
- Line 48: Change the BUILD_PLASHETS constant back to the shared Jenkins job
identifier aos-cd-builds/build%2Fbuild-plashets instead of the personal
hack/bvizi namespace.
🪄 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: Repository: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ff668231-8cb8-41c8-919f-c67c95756f82

📥 Commits

Reviewing files that changed from the base of the PR and between 4084a24 and 5f91396.

📒 Files selected for processing (1)
  • pyartcd/pyartcd/jenkins.py

CINCINNATI_PRS = 'aos-cd-builds/build%2Fcincinnati-prs'
RHCOS_SYNC = 'aos-cd-builds/build%2Frhcos_sync'
BUILD_PLASHETS = 'aos-cd-builds/build%2Fbuild-plashets'
BUILD_PLASHETS = 'hack/bvizi/build%2Fbuild-plashets'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the Jenkins helper and nearby context
sed -n '1,120p' pyartcd/pyartcd/jenkins.py

# Find all references to the job constant and related plashet build logic
rg -n "BUILD_PLASHETS|build-plashets|hack/bvizi|aos-cd-builds" pyartcd -S

# Show the current diff for the file, limited to the relevant hunks
git diff -- pyartcd/pyartcd/jenkins.py

Repository: openshift-eng/art-tools

Length of output: 9788


Change BUILD_PLASHETS back to the shared Jenkins job. hack/bvizi/build%2Fbuild-plashets is a personal namespace and will route plashet triggers to the wrong job; this should stay under aos-cd-builds/build%2Fbuild-plashets.

🤖 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 `@pyartcd/pyartcd/jenkins.py` at line 48, Change the BUILD_PLASHETS constant
back to the shared Jenkins job identifier aos-cd-builds/build%2Fbuild-plashets
instead of the personal hack/bvizi namespace.

Comment on lines +788 to +791
'OVERRIDE_OCP_VERSION': override_ocp_version,
'VERSION': version,
'ART_TOOLS_COMMIT': "kopero2000@cleanup-logic-for-seperate-golang-versions",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Remove hardcoded developer branch reference and conditionally include VERSION.

Two issues in this segment:

  1. ART_TOOLS_COMMIT is hardcoded to "kopero2000@cleanup-logic-for-seperate-golang-versions" — this forces all plashet builds to use a specific developer's uncommitted branch. This looks like a development artifact that was accidentally left in. It should either be removed, made configurable, or set dynamically.

  2. VERSION is unconditionally included even when version is Noneurlencode() serializes None as the literal string "None", sending VERSION=None to Jenkins. Callers that omit version (e.g., non-golang plashet builds) will now send a bogus parameter that can break builds. This was flagged in a previous review and remains unaddressed.

🔧 Proposed fix
     'DRY_RUN': dry_run,
     'OVERRIDE_OCP_VERSION': override_ocp_version,
-    'VERSION': version,
-    'ART_TOOLS_COMMIT': "kopero2000@cleanup-logic-for-seperate-golang-versions",
+    'ART_TOOLS_COMMIT': art_tools_commit,  # or remove entirely
 }
+if version is not None:
+    params['VERSION'] = version
🤖 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 `@pyartcd/pyartcd/jenkins.py` around lines 788 - 791, Remove the hardcoded
developer branch value from ART_TOOLS_COMMIT, or source it from an appropriate
configurable or dynamically determined value. Update the parameter construction
in the relevant Jenkins build function to include VERSION only when version is
not None, preventing urlencode() from emitting VERSION=None.

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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.

2 participants