wip #2455

Merged
mfreeman451 merged 1 commit from refs/pull/2455/head into main 2025-11-23 18:02:59 +00:00
mfreeman451 commented 2025-11-23 18:02:45 +00:00 (Migrated from github.com)
Owner

Imported from GitHub pull request.

Original GitHub pull request: #1987
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1987
Original created: 2025-11-23T18:02:45Z
Original updated: 2025-11-23T18:03:57Z
Original head: carverauto/serviceradar:fix/rbe_rpm
Original base: main
Original merged: 2025-11-23T18:02:59Z by @mfreeman451

User description

IMPORTANT: Please sign the Developer Certificate of Origin

Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:

Signed-off-by: J. Doe <j.doe@domain.com>

Describe your changes

Code checklist before requesting a review

  • I have signed the DCO?
  • The build completes without errors?
  • All tests are passing when running make test?

PR Type

Enhancement, Bug fix


Description

  • Refactor RPM packaging to support fallback to local execution

  • Remove hardcoded remote cache disabling step

  • Add retry logic for remote packaging failures

  • Update Bazel RPM toolchain flag to use rules_pkg namespace


Diagram Walkthrough

flowchart LR
  A["Remote packaging attempt"] -->|Success| B["Publish packages"]
  A -->|Failure| C["Local packaging fallback"]
  C --> B
  D["Remove cache disable step"] -.-> A
  E["Update toolchain flags"] -.-> A

File Walkthrough

Relevant files
Enhancement
release.yml
Implement fallback mechanism for RPM packaging                     

.github/workflows/release.yml

  • Removed the separate step that disabled remote executor/cache settings
  • Refactored packaging logic into two functions: run_remote() and
    run_local()
  • Updated Bazel RPM toolchain flag from
    --//toolchains/rpm:is_rpmbuild_available=1 to
    --@rules_pkg//toolchains/rpm:is_rpmbuild_available=1
  • Added conditional retry logic to attempt local packaging if remote
    execution fails
+25/-17 

Imported from GitHub pull request. Original GitHub pull request: #1987 Original author: @mfreeman451 Original URL: https://github.com/carverauto/serviceradar/pull/1987 Original created: 2025-11-23T18:02:45Z Original updated: 2025-11-23T18:03:57Z Original head: carverauto/serviceradar:fix/rbe_rpm Original base: main Original merged: 2025-11-23T18:02:59Z by @mfreeman451 --- ### **User description** ## IMPORTANT: Please sign the Developer Certificate of Origin Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include a [DCO sign-off statement]( https://developercertificate.org/) indicating the DCO acceptance in one commit message. Here is an example DCO Signed-off-by line in a commit message: ``` Signed-off-by: J. Doe <j.doe@domain.com> ``` ## Describe your changes ## Issue ticket number and link ## Code checklist before requesting a review - [ ] I have signed the DCO? - [ ] The build completes without errors? - [ ] All tests are passing when running make test? ___ ### **PR Type** Enhancement, Bug fix ___ ### **Description** - Refactor RPM packaging to support fallback to local execution - Remove hardcoded remote cache disabling step - Add retry logic for remote packaging failures - Update Bazel RPM toolchain flag to use rules_pkg namespace ___ ### Diagram Walkthrough ```mermaid flowchart LR A["Remote packaging attempt"] -->|Success| B["Publish packages"] A -->|Failure| C["Local packaging fallback"] C --> B D["Remove cache disable step"] -.-> A E["Update toolchain flags"] -.-> A ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>release.yml</strong><dd><code>Implement fallback mechanism for RPM packaging</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> .github/workflows/release.yml <ul><li>Removed the separate step that disabled remote executor/cache settings<br> <li> Refactored packaging logic into two functions: <code>run_remote()</code> and <br><code>run_local()</code><br> <li> Updated Bazel RPM toolchain flag from <br><code>--//toolchains/rpm:is_rpmbuild_available=1</code> to <br><code>--@rules_pkg//toolchains/rpm:is_rpmbuild_available=1</code><br> <li> Added conditional retry logic to attempt local packaging if remote <br>execution fails</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/1987/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34">+25/-17</a>&nbsp; </td> </tr> </table></td></tr></tr></tbody></table> </details> ___
qodo-code-review[bot] commented 2025-11-23 18:03:02 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1987#issuecomment-3568202247
Original created: 2025-11-23T18:03:02Z

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Insecure local fallback

Description: The workflow retries local Bazel execution on remote failure without isolating or
hardening the runner (e.g., no sandbox/SELinux checks, no path restrictions), which could
allow unsafe package build scripts to execute with runner privileges and exfiltrate GitHub
secrets available to the job.
release.yml [257-281]

Referred Code
run_remote() {
  bazel run \
    --config=remote \
    --platforms=//build/platforms:linux_pkg_local \
    --@rules_pkg//toolchains/rpm:is_rpmbuild_available=1 \
    --stamp \
    //release:publish_packages \
    -- "${args[@]}"
}

run_local() {
  bazel run \
    --config=no_remote \
    --host_platform=@local_config_platform//:host \
    --platforms=//build/platforms:linux_pkg_local \
    --@rules_pkg//toolchains/rpm:is_rpmbuild_available=1 \
    --stamp \
    //release:publish_packages \
    -- "${args[@]}"
}



 ... (clipped 4 lines)
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
Action logging: The new workflow steps add remote/local packaging execution but do not introduce any audit
logging of critical actions or outcomes beyond a single generic echo on failure.

Referred Code
if ! run_remote; then
  echo "Remote packaging failed; retrying locally without remote executor/cache" >&2
  run_local
fi

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Limited retries: The workflow retries locally on remote failure but lacks explicit handling for local
failure (e.g., exit status check, contextual error message) and does not surface
actionable diagnostics.

Referred Code
if ! run_remote; then
  echo "Remote packaging failed; retrying locally without remote executor/cache" >&2
  run_local
fi

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
- Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/1987#issuecomment-3568202247 Original created: 2025-11-23T18:03:02Z --- ## PR Compliance Guide 🔍 <!-- https://github.com/carverauto/serviceradar/commit/29659b725ac94e06f995d73a64163ca3932531c0 --> Below is a summary of compliance checks for this PR:<br> <table><tbody><tr><td colspan='2'><strong>Security Compliance</strong></td></tr> <tr><td rowspan=1>⚪</td> <td><details><summary><strong>Insecure local fallback </strong></summary><br> <b>Description:</b> The workflow retries local Bazel execution on remote failure without isolating or <br>hardening the runner (e.g., no sandbox/SELinux checks, no path restrictions), which could <br>allow unsafe package build scripts to execute with runner privileges and exfiltrate GitHub <br>secrets available to the job.<br> <strong><a href='https://github.com/carverauto/serviceradar/pull/1987/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R257-R281'>release.yml [257-281]</a></strong><br> <details open><summary>Referred Code</summary> ```yaml run_remote() { bazel run \ --config=remote \ --platforms=//build/platforms:linux_pkg_local \ --@rules_pkg//toolchains/rpm:is_rpmbuild_available=1 \ --stamp \ //release:publish_packages \ -- "${args[@]}" } run_local() { bazel run \ --config=no_remote \ --host_platform=@local_config_platform//:host \ --platforms=//build/platforms:linux_pkg_local \ --@rules_pkg//toolchains/rpm:is_rpmbuild_available=1 \ --stamp \ //release:publish_packages \ -- "${args[@]}" } ... (clipped 4 lines) ``` </details></details></td></tr> <tr><td colspan='2'><strong>Ticket Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary>🎫 <strong>No ticket provided </strong></summary> - [ ] Create ticket/issue <!-- /create_ticket --create_ticket=true --> </details></td></tr> <tr><td colspan='2'><strong>Codebase Duplication Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary><strong>Codebase context is not defined </strong></summary> Follow the <a href='https://qodo-merge-docs.qodo.ai/core-abilities/rag_context_enrichment/'>guide</a> to enable codebase context checks. </details></td></tr> <tr><td colspan='2'><strong>Custom Compliance</strong></td></tr> <tr><td rowspan=4>🟢</td><td> <details><summary><strong>Generic: Meaningful Naming and Self-Documenting Code</strong></summary><br> **Objective:** Ensure all identifiers clearly express their purpose and intent, making code <br>self-documenting<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Secure Error Handling</strong></summary><br> **Objective:** To prevent the leakage of sensitive system information through error messages while <br>providing sufficient detail for internal debugging.<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Secure Logging Practices</strong></summary><br> **Objective:** To ensure logs are useful for debugging and auditing without exposing sensitive <br>information like PII, PHI, or cardholder data.<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Security-First Input Validation and Data Handling</strong></summary><br> **Objective:** Ensure all data inputs are validated, sanitized, and handled securely to prevent <br>vulnerabilities<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td rowspan=2>⚪</td> <td><details> <summary><strong>Generic: Comprehensive Audit Trails</strong></summary><br> **Objective:** To create a detailed and reliable record of critical system actions for security analysis <br>and compliance.<br> **Status:** <br><a href='https://github.com/carverauto/serviceradar/pull/1987/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R278-R281'><strong>Action logging</strong></a>: The new workflow steps add remote/local packaging execution but do not introduce any audit <br>logging of critical actions or outcomes beyond a single generic echo on failure.<br> <details open><summary>Referred Code</summary> ```yaml if ! run_remote; then echo "Remote packaging failed; retrying locally without remote executor/cache" >&2 run_local fi ``` </details> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td><details> <summary><strong>Generic: Robust Error Handling and Edge Case Management</strong></summary><br> **Objective:** Ensure comprehensive error handling that provides meaningful context and graceful <br>degradation<br> **Status:** <br><a href='https://github.com/carverauto/serviceradar/pull/1987/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R278-R281'><strong>Limited retries</strong></a>: The workflow retries locally on remote failure but lacks explicit handling for local <br>failure (e.g., exit status check, contextual error message) and does not surface <br>actionable diagnostics.<br> <details open><summary>Referred Code</summary> ```yaml if ! run_remote; then echo "Remote packaging failed; retrying locally without remote executor/cache" >&2 run_local fi ``` </details> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td align="center" colspan="2"> <!-- placeholder --> <!-- /compliance --update_compliance=true --> </td></tr></tbody></table> <details><summary>Compliance status legend</summary> 🟢 - Fully Compliant<br> 🟡 - Partial Compliant<br> 🔴 - Not Compliant<br> ⚪ - Requires Further Human Verification<br> 🏷️ - Compliance label<br> </details>
qodo-code-review[bot] commented 2025-11-23 18:03:57 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1987#issuecomment-3568203162
Original created: 2025-11-23T18:03:57Z

PR Code Suggestions

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add missing host platform flag

Add the missing --host_platform=@local_config_platform//:host flag to the
run_remote function to ensure correct toolchain resolution and prevent potential
build failures.

.github/workflows/release.yml [257-265]

           run_remote() {
         bazel run \
           --config=remote \
+          --host_platform=@local_config_platform//:host \
           --platforms=//build/platforms:linux_pkg_local \
           --@rules_pkg//toolchains/rpm:is_rpmbuild_available=1 \
           --stamp \
           //release:publish_packages \
           -- "${args[@]}"
       }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that the --host_platform flag was omitted from the new run_remote function. This flag was present in the original command and is crucial for correct toolchain resolution, making its absence a likely bug that could cause the remote build to fail.

High
High-level
Refactor duplicated logic into one function

The run_remote and run_local functions contain nearly identical bazel run
commands. These should be merged into a single parameterized function to reduce
redundancy and improve maintainability.

Examples:

.github/workflows/release.yml [257-276]
          run_remote() {
            bazel run \
              --config=remote \
              --platforms=//build/platforms:linux_pkg_local \
              --@rules_pkg//toolchains/rpm:is_rpmbuild_available=1 \
              --stamp \
              //release:publish_packages \
              -- "${args[@]}"
          }


 ... (clipped 10 lines)

Solution Walkthrough:

Before:

run_remote() {
  bazel run \
    --config=remote \
    --platforms=//build/platforms:linux_pkg_local \
    ...
    -- "${args[@]}"
}

run_local() {
  bazel run \
    --config=no_remote \
    --host_platform=@local_config_platform//:host \
    --platforms=//build/platforms:linux_pkg_local \
    ...
    -- "${args[@]}"
}

if ! run_remote; then
  run_local
fi

After:

run_packaging() {
  local mode=$1
  local bazel_args=()
  if [[ "$mode" == "local" ]]; then
    bazel_args+=("--config=no_remote" "--host_platform=@local_config_platform//:host")
  else
    bazel_args+=("--config=remote")
  fi

  bazel run \
    "${bazel_args[@]}" \
    --platforms=//build/platforms:linux_pkg_local \
    ...
    -- "${args[@]}"
}

if ! run_packaging "remote"; then
  echo "Remote packaging failed; retrying locally..." >&2
  run_packaging "local"
fi

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies significant code duplication between the run_remote and run_local functions, and refactoring them would improve the long-term maintainability of the workflow script.

Low
  • More
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/1987#issuecomment-3568203162 Original created: 2025-11-23T18:03:57Z --- ## PR Code Suggestions ✨ <!-- 29659b7 --> Explore these optional code suggestions: <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> <td> <details><summary>Add missing host platform flag</summary> ___ **Add the missing <code>--host_platform=@local_config_platform//:host</code> flag to the <br><code>run_remote</code> function to ensure correct toolchain resolution and prevent potential <br>build failures.** [.github/workflows/release.yml [257-265]](https://github.com/carverauto/serviceradar/pull/1987/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R257-R265) ```diff run_remote() { bazel run \ --config=remote \ + --host_platform=@local_config_platform//:host \ --platforms=//build/platforms:linux_pkg_local \ --@rules_pkg//toolchains/rpm:is_rpmbuild_available=1 \ --stamp \ //release:publish_packages \ -- "${args[@]}" } ``` `[To ensure code accuracy, apply this suggestion manually]` <details><summary>Suggestion importance[1-10]: 9</summary> __ Why: The suggestion correctly identifies that the `--host_platform` flag was omitted from the new `run_remote` function. This flag was present in the original command and is crucial for correct toolchain resolution, making its absence a likely bug that could cause the remote build to fail. </details></details></td><td align=center>High </td></tr><tr><td rowspan=1>High-level</td> <td> <details><summary>Refactor duplicated logic into one function</summary> ___ **The <code>run_remote</code> and <code>run_local</code> functions contain nearly identical <code>bazel run</code> <br>commands. These should be merged into a single parameterized function to reduce <br>redundancy and improve maintainability.** ### Examples: <details> <summary> <a href="https://github.com/carverauto/serviceradar/pull/1987/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R257-R276">.github/workflows/release.yml [257-276]</a> </summary> ```yaml run_remote() { bazel run \ --config=remote \ --platforms=//build/platforms:linux_pkg_local \ --@rules_pkg//toolchains/rpm:is_rpmbuild_available=1 \ --stamp \ //release:publish_packages \ -- "${args[@]}" } ... (clipped 10 lines) ``` </details> ### Solution Walkthrough: #### Before: ```yaml run_remote() { bazel run \ --config=remote \ --platforms=//build/platforms:linux_pkg_local \ ... -- "${args[@]}" } run_local() { bazel run \ --config=no_remote \ --host_platform=@local_config_platform//:host \ --platforms=//build/platforms:linux_pkg_local \ ... -- "${args[@]}" } if ! run_remote; then run_local fi ``` #### After: ```yaml run_packaging() { local mode=$1 local bazel_args=() if [[ "$mode" == "local" ]]; then bazel_args+=("--config=no_remote" "--host_platform=@local_config_platform//:host") else bazel_args+=("--config=remote") fi bazel run \ "${bazel_args[@]}" \ --platforms=//build/platforms:linux_pkg_local \ ... -- "${args[@]}" } if ! run_packaging "remote"; then echo "Remote packaging failed; retrying locally..." >&2 run_packaging "local" fi ``` <details><summary>Suggestion importance[1-10]: 6</summary> __ Why: The suggestion correctly identifies significant code duplication between the `run_remote` and `run_local` functions, and refactoring them would improve the long-term maintainability of the workflow script. </details></details></td><td align=center>Low </td></tr> <tr><td align="center" colspan="2"> - [ ] More <!-- /improve --more_suggestions=true --> </td><td></td></tr></tbody></table>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar!2455
No description provided.