Skip to content

Conversation

@joejstuart
Copy link
Contributor

@joejstuart joejstuart commented Jan 15, 2026

This PR adds Rego policy rules that generate warnings for volatile configuration rules with lifecycle events requiring attention. Volatile config rules (volatileConfig.include / volatileConfig.exclude) allow temporary exceptions to policy rules with time-based constraints, and these warnings help users proactively manage them.

https://issues.redhat.com/browse/EC-1616

This depends on conforma/cli#3077

Add default threshold of 30 days for volatile config expiration warnings.
This value can be overridden via ruleData in policy configuration.

Used by the upcoming volatile_config policy rules.
New library at policy/lib/volatile_config.rego provides:

- warning_threshold_days: configurable threshold from rule_data (default 30)
- days_until_expiration(rule): calculate days until effectiveUntil
- is_rule_applicable(rule, image_ref, digest, component): check if rule
  applies to current image via imageDigest, imageRef (deprecated),
  imageUrl prefix, or componentNames
- warning_category(rule): returns one of:
  - "invalid": unparseable dates
  - "pending": effectiveOn in future
  - "expired": effectiveUntil in past
  - "expiring": effectiveUntil within warning threshold
  - "no_expiration": active rule with no effectiveUntil

Comprehensive tests with 100% coverage.
New policy package at policy/release/volatile_config generates warnings
for volatile configuration rules that have lifecycle events:

- pending_rule: effectiveOn date is in the future
- expiring_rule: effectiveUntil within warning threshold (default 30 days)
- no_expiration: active rule with no effectiveUntil date set
- expired_rule: effectiveUntil date has passed
- invalid_config: date values cannot be parsed as RFC 3339

Warnings are only generated for rules applicable to the current image
based on imageDigest, imageRef (deprecated), imageUrl prefix, or
componentNames scoping.

All rules are included in 'minimal' and 'redhat' collections.

Comprehensive tests with 100% coverage.
@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
policy/lib/rule_data.rego 100.00% <ø> (ø)
policy/lib/volatile_config.rego 100.00% <100.00%> (ø)
policy/lib/volatile_config_test.rego 100.00% <100.00%> (ø)
...olicy/release/volatile_config/volatile_config.rego 100.00% <100.00%> (ø)
.../release/volatile_config/volatile_config_test.rego 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant