Skip to content

USHIFT-6806: AI Skill: Advisory Promotion — Errata Tool (Phase 3) - #256

Open
agullon wants to merge 5 commits into
openshift-eng:mainfrom
agullon:USHIFT-6806
Open

USHIFT-6806: AI Skill: Advisory Promotion — Errata Tool (Phase 3)#256
agullon wants to merge 5 commits into
openshift-eng:mainfrom
agullon:USHIFT-6806

Conversation

@agullon

@agullon agullon commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What

Adds Errata Tool RPM advisory validation to the advisory-promotion skill (Phase 3). The skill now checks both Konflux bootc advisories (existing) and Errata Tool RPM advisories (new) when invoked.

Jira: USHIFT-6806

Why

QE sign-off on RPM advisories requires manually verifying advisory state in the Errata Tool — correct type, QA ownership, bugs verified, RPMs present, CDN push done, etc. This automates those checks into a single command, reducing the release manager's manual work.

How it works

The skill calls the Errata Tool REST API (Kerberos/GSSAPI auth) and runs 9 checks:

Check What it verifies
et_advisory_exists Advisory found in ET
et_advisory_type RHEA for GA, RHBA/RHSA for z-stream
et_qa_owner QA ownership set (not default)
et_bugs_verified All OCPBUGS in accepted state (Verified/Closed)
et_rpms_present All packages from microshift.spec found in ET builds
et_rpms_product_listed RPMs mapped to product version listings
et_cdn_staging CDN staging push completed
et_cat_tests RHN QA testing passed (rhnqa field)
et_status_rel_prep Advisory reached REL_PREP or later

The expected RPM list comes from the spec file on release-{minor}. The found RPMs come from the ET builds response (variant_arch data). The advisory ID is provided via --errata or auto-discovered from ocp-build-data/releases.yml.

Usage

# Bootc + Errata checks (advisory auto-discovered)
/microshift-release:advisory-promotion 4.22.7

# Explicit advisory ID
/microshift-release:advisory-promotion 4.22.7 --errata 170194

# Bootc only (same as before)
/microshift-release:advisory-promotion 4.22.7 --prod

Files

File Purpose
lib/errata.py ET REST API client — lazy imports so tests run without requests_gssapi
errata_promotion.py 9 checks, formatting (text/markdown/JSON), CLI
errata_promotion.sh Bash wrapper (venv, deps)
test_errata_promotion.py 60 unit tests
SKILL.md Updated with --errata mode, --prod always on, verbatim output rule

Tested

  • 60 unit tests pass (system Python — no venv needed for test collection)
  • Live-tested against advisory 170194 (MicroShift 4.22.7, SHIPPED_LIVE) — all 9 checks pass
  • Existing 44 bootc advisory promotion tests still pass
  • Plugin version bumped 1.4.3 → 1.5.0

🤖 Generated with Claude Code

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: agullon

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 Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 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

Changes

Errata promotion validation

Layer / File(s) Summary
Errata Tool client and data normalization
plugins/microshift-release/scripts/lib/errata.py
Adds Kerberos-authenticated API access and helpers that normalize advisory, build, Jira, external-test, CDN, NVR, package, and bug data.
Promotion checks and orchestration
plugins/microshift-release/scripts/errata_promotion.py
Adds checks for advisory metadata, QA ownership, bugs, RPMs, product listings, CDN staging, CAT results, and advisory status.
CLI reporting and execution wrapper
plugins/microshift-release/scripts/errata_promotion.py, plugins/microshift-release/scripts/errata_promotion.sh
Adds version and argument validation, text, Markdown, and JSON reports, exit-status handling, virtual-environment setup, and dependency refresh logic.
Skill integration and validation
plugins/microshift-release/skills/advisory-promotion/SKILL.md, plugins/microshift-release/scripts/unit_tests/test_errata_promotion.py
Adds Errata Tool mode documentation and unit coverage for checks, data helpers, and report formatting.
Plugin version update
.claude-plugin/marketplace.json, plugins/microshift-release/.claude-plugin/plugin.json
Updates the plugin version from 1.4.3 to `1.5.0.

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

Possibly related PRs


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error lib/errata.py logs raw requests exceptions (%s, lines 53-56); these can include internal hostnames and full request URLs/paths. Do not log raw exceptions. Log a fixed, sanitized error with only the failure class or status, and keep endpoint details out of logs.
Ai-Attribution ⚠️ Warning AI use is explicit in the PR, and the tip commit uses Co-Authored-By: Claude Opus 4.6; no Assisted-by or Generated-by trailer is present. Replace the AI Co-Authored-By line with the required Red Hat Assisted-by or Generated-by trailer.
✅ Passed checks (9 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Weak-Crypto ✅ Passed Changed code uses HTTPS with requests-gssapi Kerberos authentication and contains no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed Changed files contain no container/Kubernetes manifests or flagged privilege settings; the wrapper only creates a user-local venv and runs Python without sudo or privilege escalation.
No-Hardcoded-Secrets ✅ Passed No hardcoded secrets found. Authentication uses environment-based Kerberos (GSSAPI) via requests_gssapi library. No API keys, passwords, tokens, base64-encoded secrets, or URLs with embedded creden...
No-Injection-Vectors ✅ Passed The pull request contains no injection vectors. Code uses safe HTTP API requests with proper URL encoding, regex-validated input, f-string formatting, and no eval/exec/shell=True/os.system/pickle/y...
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Errata Tool advisory promotion feature and its Phase 3 scope.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Aug 4, 2026
@agullon agullon changed the title feat: add Errata Tool RPM advisory checks to advisory-promotion skill USHIFT-6806: AI Skill: Advisory Promotion — Errata Tool (Phase 3) Aug 4, 2026
@agullon
agullon marked this pull request as draft August 4, 2026 09:26
@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 Aug 4, 2026

@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: 9

Caution

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

⚠️ Outside diff range comments (1)
plugins/microshift-release/skills/advisory-promotion/SKILL.md (1)

70-74: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use $PLUGIN_DIR for portable script paths.

SCRIPTS_DIR=plugins/microshift-release/scripts depends on the current working directory. The skill can fail when the agent starts outside the repository root.

Set SCRIPTS_DIR="$PLUGIN_DIR/scripts" and quote the path in each command.

As per path instructions, SKILL.md must use portable paths such as $PLUGIN_DIR.

Also applies to: 90-100

🤖 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 `@plugins/microshift-release/skills/advisory-promotion/SKILL.md` around lines
70 - 74, Update the SCRIPTS_DIR definition in SKILL.md to use the portable
"$PLUGIN_DIR/scripts" path, then replace the affected script command paths in
the referenced sections with the quoted SCRIPTS_DIR variable so they work from
any current working directory.

Source: Path instructions

🤖 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 `@plugins/microshift-release/scripts/errata_promotion.py`:
- Around line 162-177: Update the product-version validation loop to collect the
MicroShift NVR keys listed in each entry, then compare that set against nvrs
rather than passing when any listing exists. Return FAIL with the missing NVRs
when the difference is non-empty; otherwise retain the existing PASS result with
the sorted product versions. Add a test covering a partial product-version
listing.
- Around line 226-245: Update the external-test evaluation logic in the relevant
check function to require records for both CAT and rpmdiff and accept only their
explicit successful result states; treat missing, pending, unknown, skipped,
unrelated, or failed results as incomplete and return the appropriate WARN or
FAIL outcome instead of PASS. Remove the status-based PASS path for empty tests,
and update test_no_tests_rel_prep to assert the new behavior.
- Around line 411-418: Validate the positional advisory argument in the
argument-parsing flow before it is used to construct an API URL, accepting only
anchored numeric IDs or supported advisory-name formats and rejecting path
separators, query delimiters, control characters, and arbitrary text. Add
positive and negative tests covering each accepted format and representative
invalid inputs.
- Around line 183-204: Update check_cdn_staging to call the existing
errata.fetch_cdn_repos API and base PASS/FAIL on the returned CDN repository
state rather than advisory status or push_count. Require all expected staging
repositories to report a successful push, preserving the existing
unavailable-advisory and text-only skip behavior; apply the same validation to
the related logic in the later indicated section.
- Around line 294-306: Preserve the None result from fetch_jira_issues through
the orchestration flow by avoiding extract_bug_keys when jira_data is None,
while retaining normal bug-key extraction for successful Jira responses. Ensure
check_bugs_verified receives None and returns its WARN outcome rather than
treating the advisory as having no bugs, and add an orchestration test covering
a None Jira response.
- Around line 436-453: Update the output flow around the json_output branch so
JSON formatting is selected and printed without returning early. Move the common
any(r["status"] == "FAIL" for r in results) exit check after all output
branches, preserving verbose and short text formatting while ensuring failed
JSON checks exit with status 1.

In `@plugins/microshift-release/scripts/lib/errata.py`:
- Line 154: Update the loop over builds_data to iterate directly over its values
instead of unpacking the unused product_version key, while preserving the
existing build_entries processing and ensuring Ruff B007 passes.
- Line 15: Enable TLS certificate verification in the session configuration by
removing the _session.verify = False behavior and the corresponding
urllib3.disable_warnings call. Configure verification to use the trusted system
store or the Red Hat CA bundle, preserving secure HTTPS connections without
suppressing certificate warnings.

In `@plugins/microshift-release/skills/advisory-promotion/SKILL.md`:
- Line 3: Update the advisory-promotion command contract to support the --json
option everywhere: add [--json] to the argument-hint and include --json
pass-through in both execution templates, while preserving the existing version,
--prod, --verbose, and --errata options.

---

Outside diff comments:
In `@plugins/microshift-release/skills/advisory-promotion/SKILL.md`:
- Around line 70-74: Update the SCRIPTS_DIR definition in SKILL.md to use the
portable "$PLUGIN_DIR/scripts" path, then replace the affected script command
paths in the referenced sections with the quoted SCRIPTS_DIR variable so they
work from any current working directory.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 2b3cdf59-0d8b-47b4-b692-1941c49c49d0

📥 Commits

Reviewing files that changed from the base of the PR and between bff4144 and b13776f.

📒 Files selected for processing (5)
  • plugins/microshift-release/scripts/errata_promotion.py
  • plugins/microshift-release/scripts/errata_promotion.sh
  • plugins/microshift-release/scripts/lib/errata.py
  • plugins/microshift-release/scripts/unit_tests/test_errata_promotion.py
  • plugins/microshift-release/skills/advisory-promotion/SKILL.md

Comment thread plugins/microshift-release/scripts/errata_promotion.py
Comment thread plugins/microshift-release/scripts/errata_promotion.py
Comment thread plugins/microshift-release/scripts/errata_promotion.py Outdated
Comment thread plugins/microshift-release/scripts/errata_promotion.py Outdated
Comment thread plugins/microshift-release/scripts/errata_promotion.py
Comment thread plugins/microshift-release/scripts/errata_promotion.py
Comment thread plugins/microshift-release/scripts/lib/errata.py Outdated
Comment thread plugins/microshift-release/scripts/lib/errata.py Outdated
Comment thread plugins/microshift-release/skills/advisory-promotion/SKILL.md Outdated
@coderabbitai coderabbitai Bot removed the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Aug 4, 2026

@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 `@plugins/microshift-release/scripts/lib/errata.py`:
- Around line 75-108: Validate response shapes before mapping access: in
plugins/microshift-release/scripts/lib/errata.py:75-108, update _unwrap_advisory
to return None unless data, errata, and the selected advisory are dictionaries;
in plugins/microshift-release/scripts/lib/errata.py:166-212, return an empty
result for non-dictionary builds_data and treat non-dictionary variant_arch as
absent; in plugins/microshift-release/scripts/lib/errata.py:250-265, skip items
whose resolved jira_issue is not a dictionary. Add positive and negative tests
covering list, null, and scalar response shapes for each affected parsing path.
- Around line 255-266: The conditional check before bugs.append(bug) currently
accepts any non-empty key, but should only include Jira issues with keys
starting with the OCPBUGS prefix. Update the condition to verify that bug["key"]
starts with "OCPBUGS-" in addition to the existing truthiness check, ensuring
non-OCPBUGS linked issues are filtered out before being added to the bugs list.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: f02b09db-8da5-4a61-8290-734b32d22c1b

📥 Commits

Reviewing files that changed from the base of the PR and between e70dbdd and 184ded9.

📒 Files selected for processing (3)
  • plugins/microshift-release/scripts/errata_promotion.py
  • plugins/microshift-release/scripts/lib/errata.py
  • plugins/microshift-release/scripts/unit_tests/test_errata_promotion.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • plugins/microshift-release/scripts/unit_tests/test_errata_promotion.py
  • plugins/microshift-release/scripts/errata_promotion.py

Comment thread plugins/microshift-release/scripts/lib/errata.py
Comment thread plugins/microshift-release/scripts/lib/errata.py
USHIFT-6806

Add --errata <advisory_id> mode to the advisory-promotion skill.
Validates MicroShift RPM advisories in the Red Hat Errata Tool
before QE sign-off, covering:

- Advisory exists, correct type (RHEA/RHBA/RHSA), QA ownership set
- All OCPBUGS in Verified/Closed state
- All MicroShift RPMs present and mapped to product listings
- CDN staging push completed, RHN QA testing passed
- Advisory moved to REL_PREP

Authenticates via Kerberos (GSSAPI). Tested against real advisory
170194 (MicroShift 4.22.7).

Bump plugin version 1.4.3 → 1.5.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

pre-commit.check-secrets: ENABLED
@agullon agullon changed the title USHIFT-6806: AI Skill: Advisory Promotion — Errata Tool (Phase 3) feat: add Errata Tool RPM checks to advisory-promotion skill Aug 4, 2026

@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 `@plugins/microshift-release/scripts/lib/errata.py`:
- Around line 200-203: Update the nested loops in the variant_arch iteration to
use mapping values instead of binding the unused variant and arch keys, while
preserving the existing arches type check and rpm_list processing. Ensure the
Python passes Ruff B007.

In `@plugins/microshift-release/skills/advisory-promotion/SKILL.md`:
- Around line 171-183: Update the Errata Mode Checks documentation for
et_cat_tests and its associated example to reflect check_cat_tests behavior:
describe validation of the rhnqa, qa_complete, and advisory status fields rather
than counting CAT or rpmdiff records. Replace the unsupported output example
with an actual --errata result such as “RHN QA testing passed (rhnqa=1)”,
ensuring descriptions and expected output match the implementation.
- Around line 81-86: Update the argument-routing checks in advisory promotion to
detect when --prod appears alongside --errata and stop with a clear
unsupported-combination error before entering Errata mode. Preserve the existing
missing-advisory-ID validation and Bootc-mode behavior when --errata is absent.
- Around line 90-100: Update the command examples for advisory_promotion.sh and
errata_promotion.sh to quote the complete $SCRIPTS_DIR-based script paths, while
preserving the existing arguments and options.
🪄 Autofix

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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 2e6e3163-88e2-44eb-806f-1a22a0749afe

📥 Commits

Reviewing files that changed from the base of the PR and between 669d7c0 and a7bf0d2.

📒 Files selected for processing (7)
  • .claude-plugin/marketplace.json
  • plugins/microshift-release/.claude-plugin/plugin.json
  • plugins/microshift-release/scripts/errata_promotion.py
  • plugins/microshift-release/scripts/errata_promotion.sh
  • plugins/microshift-release/scripts/lib/errata.py
  • plugins/microshift-release/scripts/unit_tests/test_errata_promotion.py
  • plugins/microshift-release/skills/advisory-promotion/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • .claude-plugin/marketplace.json
  • plugins/microshift-release/.claude-plugin/plugin.json
  • plugins/microshift-release/scripts/unit_tests/test_errata_promotion.py
  • plugins/microshift-release/scripts/errata_promotion.sh

Comment thread plugins/microshift-release/scripts/lib/errata.py Outdated
Comment thread plugins/microshift-release/skills/advisory-promotion/SKILL.md
Comment thread plugins/microshift-release/skills/advisory-promotion/SKILL.md
Comment thread plugins/microshift-release/skills/advisory-promotion/SKILL.md Outdated
Auto-applied:
- errata_promotion.py:449: JSON output now exits non-zero on FAIL
- SKILL.md:3: added --json to argument-hint
- lib/errata.py:200: removed unused loop variables
- SKILL.md:183: aligned CAT check docs with rhnqa implementation

Co-Authored-By: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

pre-commit.check-secrets: ENABLED
@agullon

agullon commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed CodeRabbit findings:

Applied in 7e29f09:

  • errata_promotion.py: JSON output now exits non-zero on FAIL
  • SKILL.md: added --json to argument-hint, aligned CAT check docs with rhnqa implementation
  • lib/errata.py: removed unused loop variables

Deferred:

Dropped (summary pre-merge checks):

  • No-Sensitive-Data-In-Logs: matches existing codebase pattern (lib/brew.py, lib/artifacts.py)
  • Ai-Attribution: policy preference, not a code issue

agullon added 2 commits August 4, 2026 13:09
- Only include OCPBUGS-prefixed Jira issues in bug verification
- Return None (not empty list) when jira_issues key is missing from
  ET response, so check_bugs_verified reports WARN instead of false PASS

Co-Authored-By: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

pre-commit.check-secrets: ENABLED
- Make requests/requests_gssapi imports lazy so tests run with system Python
- Catch JSONDecodeError in _et_get (VPN captive portals return HTML 200)
- Differentiate VPN vs auth failures in check_auth logging
- Fix check_bugs_verified docstring and output: say "accepted state"
  not "Verified state" since Closed and Release Pending are also accepted
- Remove unused _EXPECTED_STATUS constant
- Document _jira_issues injection in fetch_advisory docstring

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

pre-commit.check-secrets: ENABLED
@agullon
agullon marked this pull request as ready for review August 4, 2026 11:25
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 4, 2026
@agullon agullon changed the title feat: add Errata Tool RPM checks to advisory-promotion skill USHIFT-6806: AI Skill: Advisory Promotion — Errata Tool (Phase 3) Aug 4, 2026
- Add blank lines before lists after bold text (MD032)
- Rename duplicate headings: "Bootc Mode" → "Bootc Mode Output",
  "Errata Mode" → "Errata Mode Output" in Output Format section (MD024)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

pre-commit.check-secrets: ENABLED
@agullon

agullon commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

/label tide/merge-method-squash

@openshift-ci openshift-ci Bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Aug 5, 2026
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. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant