Skip to content

ART-21084: derive OKD enablement from group.yml okd.enabled#3096

Open
lgarciaaco wants to merge 1 commit into
openshift-eng:mainfrom
lgarciaaco:ART-21084-okd-enabled
Open

ART-21084: derive OKD enablement from group.yml okd.enabled#3096
lgarciaaco wants to merge 1 commit into
openshift-eng:mainfrom
lgarciaaco:ART-21084-okd-enabled

Conversation

@lgarciaaco

@lgarciaaco lgarciaaco commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Move OKD version enablement from the hardcoded OKD_ENABLED_VERSIONS list to okd.enabled in ocp-build-data group.yml. Pipelines read merged group config through doozer --variant=okd.

What changed

  • Remove OKD_ENABLED_VERSIONS from pyartcd/constants.py
  • Add is_okd_version_enabled(), get_okd_enabled_versions(), and okd_doozer_base_command() in pyartcd/util.py
  • okd-scan: skip when okd.enabled is false or missing (still needed for manual Jenkins runs)
  • okd-images-health: resolve --versions through the enablement gate; probe ACTIVE_OCP_VERSIONS when omitted; exit early when nothing is enabled
  • schedule-okd-scan: discover enabled versions from build-data when --version is omitted; filter explicit --version args; check enablement in run_for() before start_okd_scan_konflux so disabled versions do not spawn skipped build/okd-scan jobs
  • Validator: allow boolean okd.enabled under okd: in assembly_group_config.schema.json
  • Tests: unit coverage for disabled 4.23 path, scheduler gating, and util helpers; skip_rpms=False in test_ocp4_scan_konflux.py after rebase onto main (Add --skip-rpms parameter to ocp4-scan-konflux pipeline #3115)

Dependencies

  • ocp-build-data: #11402, #11403, #11404 (merged — okd.enabled: true on 4.21, 4.22, 5.0; 4.23 stays disabled)
  • aos-cd-jobs: #4742 (after this PR — removes okdVersions loop, calls schedule-okd-scan with no --version)

Validation

  • Unit tests: pytest pyartcd/tests/pipelines/test_okd_scan.py pyartcd/tests/pipelines/test_okd_images_health.py pyartcd/tests/pipelines/test_schedule_okd_scan.py pyartcd/tests/test_util.py
  • Jenkins okd-scan dry-runs: 4.23 skips (Fix ga check #763); 4.21 with build-data fork passes gate and scan-sources (set the major and minor value as class value #765)

Jira: ART-21084

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 24, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 24, 2026

Copy link
Copy Markdown

@lgarciaaco: This pull request references ART-21084 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 sub-task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Replace hardcoded OKD_ENABLED_VERSIONS with build-data okd.enabled lookups in OKD scan and health pipelines.

Problem

Before: Jenkins scheduled okd-scan for 4.23 while art-tools skipped it via a separate constant list.

After: artcd okd-scan and okd-images-health read group.yml okd.enabled; disabled versions skip with a build-data message.

Implementation Details

  • Add is_okd_version_enabled() and get_okd_enabled_versions() in pyartcd util
  • Extend ocp-build-data validator schema for okd.enabled
  • Update unit tests for disabled 4.23 path

Depends on ocp-build-data PRs adding okd.enabled: true on enabled branches.

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

@openshift-ci 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 Jun 24, 2026
@openshift-ci

openshift-ci Bot commented Jun 24, 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

@coderabbitai

coderabbitai Bot commented Jun 24, 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

Adds okd.enabled to the group config schema and replaces static OKD version gating with runtime group-config checks. The OKD scan and images health pipelines now resolve enablement through the new async helper, and tests were updated for the new flow.

Changes

OKD enablement flow

Layer / File(s) Summary
Schema and validation
ocp-build-data-validator/validator/json_schemas/assembly_group_config.schema.json, ocp-build-data-validator/tests/test_schema/test_group_schema.py
Adds okd.enabled as a boolean field in the group config schema and adds validation coverage for valid and invalid values.
Runtime enablement helper
pyartcd/pyartcd/util.py, pyartcd/tests/test_util.py
Adds an async helper that checks okd.enabled through doozer runtime and verifies the helper with unit tests.
OKD scan gating
pyartcd/pyartcd/pipelines/okd_scan.py, pyartcd/tests/pipelines/test_okd_scan.py
Replaces static OKD version checks with the async enablement helper and updates scan tests to mock it.
Images health version resolution
pyartcd/pyartcd/pipelines/okd_images_health.py, pyartcd/tests/pipelines/test_okd_images_health.py
Stores the raw versions argument, resolves enabled versions during run(), and adds tests for filtered and empty version inputs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • fgallott

Important

Pre-merge checks failed

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

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Container-Privileges ❌ Error The commit adds Tekton task manifests with securityContext.privileged: true and runAsUser: 0, which the check forbids. Remove privileged/root settings from those manifests or add a documented justification/exemption if they are unavoidable.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (9 passed)
Check name Status Explanation
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 Touched files add OKD enablement checks/tests only; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret-comparison code is present.
No-Sensitive-Data-In-Logs ✅ Passed Changed logs only mention version/group and a generic build-data hint; no passwords, tokens, PII, internal hostnames, or customer data are logged.
No-Hardcoded-Secrets ✅ Passed Diff scan found no API keys, tokens, passwords, private keys, embedded-credential URLs, or long base64 literals in the changed files.
No-Injection-Vectors ✅ Passed No flagged injection patterns appear in the changed paths; new doozer invocations use argument lists, not shell strings.
Ai-Attribution ✅ Passed No AI-tool use was mentioned in the reachable PR commit message, and no Assisted-by/Generated-by/Co-Authored-By trailer was present.
Title check ✅ Passed The title clearly matches the main change: deriving OKD enablement from group.yml okd.enabled instead of a hardcoded list.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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: 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/pipelines/okd_images_health.py`:
- Around line 48-55: In okd_images_health.py, the run() flow in the OKD images
health pipeline should stop when no enabled versions are resolved. After the
versions are set via the _versions_param branch or
util.get_okd_enabled_versions(), add an early skip/return path in run() for the
empty self.versions case so the notification block is not reached and false “all
healthy” messages are not emitted.

In `@pyartcd/pyartcd/pipelines/okd_scan.py`:
- Around line 91-94: Move the _check_params() validation ahead of the
is_okd_version_enabled() lookup in okd_scan.py so the trust-boundary check runs
before any build-data access; keep the early build-data gating in the same
method that currently performs the version check, and ensure self.data_path and
self.data_gitref are only dereferenced after parameters have been validated.
🪄 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: 297d91e9-6147-4ca9-9308-2c34a6cf3137

📥 Commits

Reviewing files that changed from the base of the PR and between f96dc5f and 2ab32d3.

📒 Files selected for processing (9)
  • ocp-build-data-validator/tests/test_schema/test_group_schema.py
  • ocp-build-data-validator/validator/json_schemas/assembly_group_config.schema.json
  • pyartcd/pyartcd/constants.py
  • pyartcd/pyartcd/pipelines/okd_images_health.py
  • pyartcd/pyartcd/pipelines/okd_scan.py
  • pyartcd/pyartcd/util.py
  • pyartcd/tests/pipelines/test_okd_images_health.py
  • pyartcd/tests/pipelines/test_okd_scan.py
  • pyartcd/tests/test_util.py

Comment thread pyartcd/pyartcd/pipelines/okd_images_health.py
Comment thread pyartcd/pyartcd/pipelines/okd_scan.py Outdated

@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.

♻️ Duplicate comments (2)
pyartcd/pyartcd/pipelines/okd_images_health.py (1)

79-90: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Return early when no OKD versions are resolved.

If _resolve_versions() returns [] (no --versions or every requested version is disabled), run() still falls through to the notification path and can emit a false “all healthy” message even though nothing was scanned.

Suggested fix
     async def run(self):
         self.versions = await self._resolve_versions()
+        if not self.versions:
+            self.runtime.logger.info("No enabled OKD versions to scan; skipping health check")
+            return
         await asyncio.gather(*(self.get_report(v) for v in self.versions))
         await asyncio.gather(*(self.get_rebase_failures(v) for v in self.versions))
         self.runtime.logger.info('Found %s concerns', len(self.report))
🤖 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/pipelines/okd_images_health.py` around lines 79 - 90, The
run() method in okd_images_health.Pipeline should stop before scanning or
notification when _resolve_versions() returns no versions. Add an early return
right after self._resolve_versions() if self.versions is empty, so the later
asyncio.gather calls and notify_release_channel/notify_okd_channel paths in
run() are skipped when nothing was resolved.
pyartcd/pyartcd/pipelines/okd_scan.py (1)

91-106: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Move _check_params() ahead of the build-data probe.

Line 92 still touches the caller-supplied build-data source before Line 106 enforces the non-dry-run restrictions, so a rejected custom data_path/data_gitref is consulted before the trust-boundary check runs.

Suggested fix
     async def run(self):
         """
         Main pipeline execution.
         """
         # If we get here, lock could be acquired
         self.skipped = False
+        self._check_params()
 
         # Early exit if version not enabled for OKD in build-data
         if not await util.is_okd_version_enabled(self.doozer_base_command):
             self.logger.info(
                 'Version %s is not enabled for OKD (set okd.enabled: true in group.yml on openshift-%s). Skipping scan.',
@@
-        self._check_params()
-
         # Scan for changes
         await self._scan_sources()

As per path instructions, "Validate at trust boundaries with allow-lists, not deny-lists".

🤖 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/pipelines/okd_scan.py` around lines 91 - 106, Move the
parameter validation in `OKDScanPipeline.run` so `_check_params()` runs before
any build-data access such as `util.is_okd_version_enabled()` or logging derived
from `data_path`/`data_gitref`. This ensures the trust-boundary check happens
first and rejected caller-supplied inputs are not consulted before validation;
keep the early exit and scan logging after `_check_params()` once the inputs are
accepted.

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.

Duplicate comments:
In `@pyartcd/pyartcd/pipelines/okd_images_health.py`:
- Around line 79-90: The run() method in okd_images_health.Pipeline should stop
before scanning or notification when _resolve_versions() returns no versions.
Add an early return right after self._resolve_versions() if self.versions is
empty, so the later asyncio.gather calls and
notify_release_channel/notify_okd_channel paths in run() are skipped when
nothing was resolved.

In `@pyartcd/pyartcd/pipelines/okd_scan.py`:
- Around line 91-106: Move the parameter validation in `OKDScanPipeline.run` so
`_check_params()` runs before any build-data access such as
`util.is_okd_version_enabled()` or logging derived from
`data_path`/`data_gitref`. This ensures the trust-boundary check happens first
and rejected caller-supplied inputs are not consulted before validation; keep
the early exit and scan logging after `_check_params()` once the inputs are
accepted.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 8f70c313-cd55-46bb-a3ce-9ff4413ebebd

📥 Commits

Reviewing files that changed from the base of the PR and between 2ab32d3 and 4740c26.

📒 Files selected for processing (6)
  • pyartcd/pyartcd/constants.py
  • pyartcd/pyartcd/pipelines/okd_images_health.py
  • pyartcd/pyartcd/pipelines/okd_scan.py
  • pyartcd/pyartcd/util.py
  • pyartcd/tests/pipelines/test_okd_images_health.py
  • pyartcd/tests/test_util.py
💤 Files with no reviewable changes (1)
  • pyartcd/pyartcd/constants.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.

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/util.py`:
- Around line 142-143: The `enabled` check in `util.py` is too permissive
because `bool(enabled)` treats non-boolean values like strings as truthy; update
the `enabled` handling in the version-check logic to only return true for the
literal boolean `True`, and treat `Missing`, `False`, and any other non-boolean
value as disabled. Keep the fix localized to the existing
`runtime.get_group_config().enabled` flow so the trust-boundary behavior in this
helper is strict and explicit.
🪄 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: 69a8cb77-9d7b-4613-b8ff-a69e89454d9c

📥 Commits

Reviewing files that changed from the base of the PR and between 4740c26 and 12ca3b1.

📒 Files selected for processing (4)
  • pyartcd/pyartcd/pipelines/okd_images_health.py
  • pyartcd/pyartcd/pipelines/okd_scan.py
  • pyartcd/pyartcd/util.py
  • pyartcd/tests/test_util.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyartcd/pyartcd/pipelines/okd_images_health.py

Comment thread pyartcd/pyartcd/util.py Outdated
@lgarciaaco
lgarciaaco marked this pull request as ready for review June 25, 2026 09:50
@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 Jun 25, 2026
@lgarciaaco

lgarciaaco commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Ran okd-scan dry-runs on Jenkins against lgarciaaco@[ART-21084](https://redhat.atlassian.net/browse/ART-21084)-okd-enabled plus the build-data fork branches. Short version: the enablement gate behaves the way we want.

4.23 skip (build #763)
Upstream build-data, no okd.enabled. Job succeeds and logs Version 4.23 is not enabled for OKD … Skipping scan. That's the negative path we needed.

4.21 happy path (build #765)
Params: DOOZER_DATA_PATH=https://github.com/lgarciaaco/ocp-build-data, DOOZER_DATA_GITREF=[ART-21084](https://redhat.atlassian.net/browse/ART-21084)-okd-enabled-4.21, IMAGE_LIST=ose-openshift-apiserver, DRY_RUN=true.

Passed the gate (Scanning OKD for version 4.21), scan-sources ran on ose-openshift-apiserver, reported changed: true, and logged that it would trigger a 4.21 okd build. DRY_RUN so nothing downstream actually fired. Title picked up [OKD SOURCE CHANGES].

Earlier failures (#762, #764) were bad distgit keys, not enablement: tools and openshift-apiserver aren't valid on 4.21. The yaml key is ose-openshift-apiserver. Worth fixing the README example when someone has a minute.

Local pyartcd tests still green (12 okd-related). Marking PRs ready for review.

@lgarciaaco
lgarciaaco force-pushed the ART-21084-okd-enabled branch from 5cc7840 to a0486e3 Compare June 25, 2026 10:01

@locriandev locriandev 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.

IIUC, with this change schedule_okd_scan will spawn a build/okd-scan job for each OCP version. Then, okd-scan will check for OKD enable status and skip if needed. This will produce a bunch of [skipped] Jenkins runs. I would rather move the enabled check to the scheduled pipeline, so that we'd trigger build/okd-scan only when actually needed

@openshift-ci

openshift-ci Bot commented Jul 1, 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 ask for approval from locriandev. 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

@lgarciaaco
lgarciaaco force-pushed the ART-21084-okd-enabled branch from a86f236 to 08bfbe5 Compare July 1, 2026 11:44
@openshift-eng openshift-eng deleted a comment from 0had3s Jul 1, 2026
Replace OKD_ENABLED_VERSIONS with build-data lookups via doozer
--variant=okd and config:read-group enabled. okd-scan and okd-images-health
skip disabled versions; schedule-okd-scan probes build-data and gates before
triggering build/okd-scan Jenkins jobs so disabled versions do not produce
skipped downstream runs.

Also add okd.enabled to ocp-build-data validator schema, discover enabled
versions when --version/--versions are omitted, and fix ocp4-scan-konflux unit
tests for the skip_rpms constructor arg after rebasing onto main.

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@lgarciaaco
lgarciaaco force-pushed the ART-21084-okd-enabled branch from 08bfbe5 to ce16ca5 Compare July 1, 2026 12:01
@lgarciaaco lgarciaaco changed the title ART-21084: feat(scanner): derive OKD version enablement from group.yml okd.enabled ART-21084: derive OKD enablement from group.yml okd.enabled Jul 1, 2026
@openshift-ci

openshift-ci Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

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

Test name Commit Details Required Rerun command
ci/prow/security ce16ca5 link false /test security

Full PR test history. Your PR dashboard.

Details

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

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 17, 2026
@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

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

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants