Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@albfan
Copy link
Contributor

@albfan albfan commented Sep 18, 2025

Description

On RHEL pre releases xlstproc is failing to install due to unsigned package libxslt

This provide a fallback to install unsigned package, and control if finally command is available

Summary by CodeRabbit

  • Bug Fixes

    • Test report generation no longer fails when a required system tool is missing; the script attempts installation with a retry and, if unavailable, falls back to writing raw results while issuing a warning.
    • Conditional transformation ensures JUnit output is produced when possible, improving reliability of e2e results.
  • Chores

    • Updated e2e build script to detect tool availability at runtime and apply transformation only when supported, simplifying control flow and removing the previous unconditional processing path.

@coderabbitai
Copy link

coderabbitai bot commented Sep 18, 2025

Walkthrough

Adds runtime detection and attempted installation of xsltproc via yum with a retry using --nogpgcheck. Introduces conditional JUnit generation: use xsltproc when available; otherwise, write a raw tail of results/e2e.results. Removes the prior unconditional xsltproc pipeline.

Changes

Cohort / File(s) Summary of Changes
E2E build script logic
images/build-e2e/lib/linux/run.sh
Added xsltproc presence check, yum-based install with retry and warning on failure; conditional transformation of results to JUnit or fallback to raw tail; removed previous unconditional xsltproc pipeline.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Runner as run.sh
    participant System as System Env
    participant Yum as yum
    participant xslt as xsltproc
    participant Files as results/e2e.results & junit.xml

    Runner->>System: Check xsltproc presence
    alt xsltproc missing
        Runner->>Yum: yum install xsltproc
        alt install fails
            Runner->>Yum: yum --nogpgcheck install xsltproc
            Note right of Runner: Warn if retry fails
        end
        Runner->>System: Re-check xsltproc
    end

    alt xsltproc available
        Runner->>xslt: Transform e2e.results -> JUnit via XSL
        xslt-->>Files: Write junit file
    else xsltproc unavailable
        Runner->>Files: Write raw tail of e2e.results to junit file
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

Hop hop, scripts refine their way,
If xsltproc’s gone astray—okay!
We yum and try, with GPG shoo,
Or tail the logs and push on through.
A bunny taps its CI drum:
“Transform if can, if not—still run!” 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description briefly states the problem and the fallback but does not follow the repository template: it omits required sections such as "Fixes"/related links, the "Type of change" checkboxes, a "Proposed changes" summary, concrete "Testing" steps, and the Contribution Checklist, and it contains a typo ("xlstproc" → "xsltproc") and minor grammar issues. Please update the PR to follow the template: add a "Fixes:" or "Relates to:" link if applicable, select the appropriate "Type of change" (likely Bug fix), add a short "Proposed changes" section summarizing the conditional xsltproc usage and the yum --nogpgcheck fallback, provide concrete "Testing" steps that reproduce and verify the behavior on RHEL pre-release and on systems without xsltproc, complete the Contribution Checklist, and fix the typo/grammar in the description.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[QE] manage absence of xml filter to process xml result" accurately summarizes the primary change: adding handling for the missing XML filter (xsltproc) when processing test results. It is concise, relevant to the changes in images/build-e2e/lib/linux/run.sh, and clear enough for a reviewer to understand the PR's intent.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci
Copy link

openshift-ci bot commented Sep 18, 2025

[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 cfergeau for approval. For more information see the Code Review Process.

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

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

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 (2)
images/build-e2e/lib/linux/run.sh (2)

64-65: Make init_line robust and quote paths.

If grep finds no header or multiple matches, init_line may be empty/invalid; tail will error. Also, quote file paths.

-init_line=$(grep -n '<?xml version="1.0" encoding="UTF-8"?>' results/e2e.results | awk '{split($0,n,":"); print n[1]}')
+init_line=$(grep -n -m1 $'^[[:space:]]*<\\?xml version="1\\.0" encoding="UTF-8"\\?>' "results/e2e.results" | cut -d: -f1)
+[ -n "$init_line" ] || init_line=1

Also applies to: 72-74


66-75: Optional: surface failures clearly and avoid silent pipe errors.

Consider set -euo pipefail near the top and redirect warnings to stderr to fail fast and aid debugging. If you prefer not to change global shell options, at least check xsltproc’s exit code and return non‑zero while still writing a valid JUnit.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 536cdb8 and 20480bc.

📒 Files selected for processing (1)
  • images/build-e2e/lib/linux/run.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: build (ubuntu-22.04, 1.24)
  • GitHub Check: build (ubuntu-latest, 1.24)
  • GitHub Check: build (macOS-13, 1.24)
  • GitHub Check: build-qe (linux, amd64)
  • GitHub Check: build-qe (darwin, amd64)
  • GitHub Check: build (macOS-14, 1.24)
  • GitHub Check: build-qe (linux, arm64)
  • GitHub Check: build-qe (darwin, arm64)
  • GitHub Check: build-qe (windows, amd64)
  • GitHub Check: build (ubuntu-latest, 1.24)
  • GitHub Check: build-installer (windows-2022, 1.24)
  • GitHub Check: build (macOS-14, 1.24)
  • GitHub Check: build (macOS-13, 1.24)
  • GitHub Check: verify-devcontainer
  • GitHub Check: build (windows-2022, 1.24)
  • GitHub Check: build (windows-2022, 1.24)
  • GitHub Check: Run OKD bundle with crc (1.24)
  • GitHub Check: Konflux kflux-prd-rh02 / crc-binary-on-pull-request

Comment on lines +66 to +68
then
sudo yum install -y xsltproc || sudo yum install -y --nogpgcheck xsltproc || echo "Warning: Failed to install xsltproc"
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Install the correct package; avoid sudo hangs; gate --nogpgcheck behind an opt‑in.

On RHEL, the xsltproc binary is provided by the libxslt package. yum install xsltproc commonly fails with “No match”. Also, sudo may not exist or can hang awaiting a TTY. Finally, installing with --nogpgcheck should be opt‑in to reduce supply‑chain risk.

Apply this diff to harden installation:

-then
-  sudo yum install -y xsltproc || sudo yum install -y --nogpgcheck xsltproc || echo "Warning: Failed to install xsltproc"
-fi
+then
+  # Choose package manager
+  PM=""
+  if command -v dnf &>/dev/null; then PM="dnf"; elif command -v yum &>/dev/null; then PM="yum"; fi
+  # Prefer running without sudo if already root; use non‑interactive sudo if available
+  SUDO=""
+  if [ "$EUID" -ne 0 ] && command -v sudo &>/dev/null; then SUDO="sudo -n"; fi
+  if [ -n "$PM" ]; then
+    # xsltproc is provided by libxslt on RHEL/Fedora
+    if ! $SUDO $PM -y install libxslt; then
+      if [ "${CRC_ALLOW_UNSIGNED:=}" = "1" ]; then
+        $SUDO $PM -y --nogpgcheck install libxslt || echo "Warning: Failed to install libxslt/xsltproc." >&2
+      else
+        echo "Warning: xsltproc missing and unsigned packages not allowed (set CRC_ALLOW_UNSIGNED=1 to allow pre-release unsigned install)." >&2
+      fi
+    fi
+  else
+    echo "Warning: No supported package manager found to install xsltproc." >&2
+  fi
+fi
📝 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
then
sudo yum install -y xsltproc || sudo yum install -y --nogpgcheck xsltproc || echo "Warning: Failed to install xsltproc"
fi
then
# Choose package manager
PM=""
if command -v dnf &>/dev/null; then PM="dnf"; elif command -v yum &>/dev/null; then PM="yum"; fi
# Prefer running without sudo if already root; use non‑interactive sudo if available
SUDO=""
if [ "$EUID" -ne 0 ] && command -v sudo &>/dev/null; then SUDO="sudo -n"; fi
if [ -n "$PM" ]; then
# xsltproc is provided by libxslt on RHEL/Fedora
if ! $SUDO $PM -y install libxslt; then
if [ "${CRC_ALLOW_UNSIGNED:=}" = "1" ]; then
$SUDO $PM -y --nogpgcheck install libxslt || echo "Warning: Failed to install libxslt/xsltproc." >&2
else
echo "Warning: xsltproc missing and unsigned packages not allowed (set CRC_ALLOW_UNSIGNED=1 to allow pre-release unsigned install)." >&2
fi
fi
else
echo "Warning: No supported package manager found to install xsltproc." >&2
fi
fi

Comment on lines +70 to 75
if command -v xsltproc &>/dev/null
then
tail -n +$init_line results/e2e.results | xsltproc filter.xsl - > results/$junitFilename
else
tail -n +$init_line results/e2e.results > results/$junitFilename
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Emit valid JUnit XML when xsltproc is unavailable.

Writing a raw tail into an .xml file produces invalid JUnit and can break report consumers. Generate a minimal, valid JUnit report embedding raw output in a failure message.

-if command -v xsltproc &>/dev/null
-then
-  tail -n +$init_line results/e2e.results | xsltproc filter.xsl - > results/$junitFilename
-else
-  tail -n +$init_line results/e2e.results > results/$junitFilename
-fi
+if command -v xsltproc &>/dev/null
+then
+  tail -n +${init_line:-1} "results/e2e.results" | xsltproc "filter.xsl" - > "results/$junitFilename"
+else
+  {
+    echo '<?xml version="1.0" encoding="UTF-8"?>'
+    echo '<testsuite name="crc-e2e" tests="1" failures="1">'
+    echo '  <testcase classname="crc.e2e" name="xsltproc-missing">'
+    echo '    <failure message="xsltproc not available; emitting raw results">'
+    echo '<![CDATA['
+    tail -n +${init_line:-1} "results/e2e.results"
+    echo ']]>'
+    echo '    </failure>'
+    echo '  </testcase>'
+    echo '</testsuite>'
+  } > "results/$junitFilename"
+fi
🤖 Prompt for AI Agents
In images/build-e2e/lib/linux/run.sh around lines 70 to 75, when xsltproc is
missing the script currently writes raw tail output to results/$junitFilename
which is not valid JUnit XML; instead capture the tail output into a variable or
temp file, ensure results/ exists, and write a minimal valid JUnit XML file that
wraps the raw output (escaped or inside a CDATA) as the failure message—e.g.,
create a testsuite with tests="1" failures="1" and a single testcase whose
<failure> element contains the raw log, then write that XML to
results/$junitFilename so report consumers receive valid JUnit even without
xsltproc.

@openshift-ci
Copy link

openshift-ci bot commented Sep 18, 2025

@albfan: The following tests 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/security 20480bc link false /test security
ci/prow/e2e-crc 20480bc link true /test e2e-crc

Full PR test history. Your PR dashboard.

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.

then
sudo yum install -y xsltproc || echo "Warning: Failed to install xsltproc"
then
sudo yum install -y xsltproc || sudo yum install -y --nogpgcheck xsltproc || echo "Warning: Failed to install xsltproc"
Copy link
Member

Choose a reason for hiding this comment

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

why we want to have a non signed package installed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are waiting for pre release RHEL to confirm if recent non signed packages is a mistake.

This is just a workaround, but probably we will refuse this change

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