Skip to content

Flatten package names#1198

Merged
lcarva merged 1 commit intoconforma:mainfrom
lcarva:EC-864
Oct 21, 2024
Merged

Flatten package names#1198
lcarva merged 1 commit intoconforma:mainfrom
lcarva:EC-864

Conversation

@lcarva
Copy link
Copy Markdown
Contributor

@lcarva lcarva commented Oct 17, 2024

This commit changes the package name of all the policy rules to a single level, e.g. release.cve becomes cve. This better aligns with how these packages are used today. It moves the EC ecosystem closer to using package names as they are defined without having to rely on dynamically alterations to the package name.

All package shortening code is removed from this repository. The package name used is now an exact match to the value provided to the package keyword in the rego files. (Note that package shortening still exists in the EC CLI, but that is expected to be removed soon as well.)

The docs generation code is modified to take into account the file path of the policies in addition to its annotations. This is needed to distinguish between the policies in different directories.

The "Package full name" section from the docs is removed since it is now exactly the same as the value of "Package name".

Although policy rules under different directories are never used together, the tests in this repo load them all at once. As such, the package names have to be unique across the different directories. The one case where this caused a conflict was with
policy/build_task/labels and policy/release/labels. To mitigate this, policy/build_task/labels is renamed to
policy/build_task/build_labels. This is a breaking change but given that this policy is not widely used, this is ok.

Ref: EC-864

This commit changes the package name of all the policy rules to a single
level, e.g. `release.cve` becomes `cve`. This better aligns with how
these packages are used today. It moves the EC ecosystem closer to
using package names as they are defined without having to rely on
dynamically alterations to the package name.

All package shortening code is removed from this repository. The package
name used is now an exact match to the value provided to the `package`
keyword in the rego files. (Note that package shortening still exists in
the EC CLI, but that is expected to be removed soon as well.)

The docs generation code is modified to take into account the file path
of the policies in addition to its annotations. This is needed to
distinguish between the policies in different directories.

The "Package full name" section from the docs is removed since it is now
exactly the same as the value of "Package name".

Although policy rules under different directories are never used
together, the tests in this repo load them all at once. As such, the
package names have to be unique across the different directories. The
one case where this caused a conflict was with
`policy/build_task/labels` and `policy/release/labels`. To mitigate
this, `policy/build_task/labels` is renamed to
`policy/build_task/build_labels`. This is a breaking change but given
that this policy is not widely used, this is ok.

Ref: EC-864

Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
# required build type label.
#
package build_task.labels
package build_labels
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As mentioned in the description, this is a breaking change. That should be ok as, likely, the only place that uses it is here, and that references the bundle, not the package itself.

Copy link
Copy Markdown
Contributor

@zregvart zregvart left a comment

Choose a reason for hiding this comment

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

👍

@lcarva lcarva merged commit 6b0cdec into conforma:main Oct 21, 2024
@lcarva lcarva deleted the EC-864 branch October 21, 2024 18:12
simonbaird added a commit to simonbaird/conforma-policy that referenced this pull request May 2, 2025
The files being fixed here were using the old convention of nested
namespace package names, which we used to do, but stopped doing
in conforma#1198 .

The symptom is a little unexpected -- some missing
description/solution text in a violation report due to how the the
metadata lookup is done by the cli. This could actually could be a
separate bug, out of scope in this PR, but possibly in scope for
https://issues.redhat.com/browse/EC-945 which I am also looking
at currently.

Anyway, this change should be enough to fix EC-1233.

Note: The collection.rhtap_multi_ci change might not have any
impact, but I'll change it anyhow so it's consistent with the
others.

Ref: https://issues.redhat.com/browse/EC-1233
st3penta added a commit to st3penta/policy that referenced this pull request Feb 25, 2026
The conventions-check validation has been broken since PR 1198
when package names were flattened from policy.release.* to their
current flat structure. The validation was filtering for namespaces
starting with "data.policy" which no longer exist.

This updates the policy_rule_files function to filter by file path
instead of namespace prefix, and removes hardcoded "data.policy.release"
assumptions throughout the validation rules.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Ref: conforma#1198
Ref: https://issues.redhat.com/browse/EC-1671
st3penta added a commit to st3penta/policy that referenced this pull request Mar 6, 2026
The conventions-check validation has been broken since PR 1198
when package names were flattened from policy.release.* to their
current flat structure. The validation was filtering for namespaces
starting with "data.policy" which no longer exist.

This updates the policy_rule_files function to filter by file path
instead of namespace prefix, and removes hardcoded "data.policy.release"
assumptions throughout the validation rules.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Ref: conforma#1198
Ref: https://issues.redhat.com/browse/EC-1671
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