Skip to content

Generate collection documentation in build utility - #15143

Open
ggbecker wants to merge 6 commits into
ComplianceAsCode:masterfrom
ggbecker:build-collections-extra-patches
Open

ggbecker wants to merge 6 commits into
ComplianceAsCode:masterfrom
ggbecker:build-collections-extra-patches

Conversation

@ggbecker

Copy link
Copy Markdown
Member

Description:

  • Enhance the Ansible collection build utility to generate README, changelog, license, and Galaxy metadata files.
  • Add configurable author, license, installation server, documentation, and issue tracker metadata.
  • Add unit tests covering generated documentation, metadata, and runtime requirements.

Rationale:

  • Ensure generated collection artifacts are complete and ready for publication to Ansible Galaxy or Automation Hub.
  • Provide accurate installation, support, licensing, and compatibility information.

Review Hints:

  • Run pytest tests/unit/utils/test_ansible_roles_to_collection.py.
  • Review utils/ansible_roles_to_collection.py together with the release process documentation changes.
  • Verify that default Galaxy metadata remains unchanged and that Automation Hub options produce the expected collection metadata.

@ggbecker ggbecker added this to the 0.1.83 milestone Sep 25, 2026
@ggbecker ggbecker added the Infrastructure Our content build system label Sep 25, 2026
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Sep 25, 2026
@openshift-ci

openshift-ci Bot commented Sep 25, 2026

Copy link
Copy Markdown

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

@jan-cerny jan-cerny self-assigned this Sep 29, 2026
@ggbecker
ggbecker force-pushed the build-collections-extra-patches branch from cd59e95 to 29d3df4 Compare September 29, 2026 08:40
@ggbecker

ggbecker commented Sep 29, 2026 •

Copy link
Copy Markdown
Member Author

Ansible.posix is a supported module so we can use it as dependency. The roles and collection have been updated accordingly.

@ggbecker
ggbecker force-pushed the build-collections-extra-patches branch from 29d3df4 to 3ca3ad6 Compare September 29, 2026 10:10
Comment thread docs/release_process.md Outdated
Comment thread docs/release_process.md Outdated
@ggbecker
ggbecker force-pushed the build-collections-extra-patches branch from 3ca3ad6 to c3b940a Compare September 29, 2026 12:29
The HIPAA profile description contained a curly apostrophe (U+2019) in "individuals'". This trips the ansible-test no-smart-quotes sanity test when the profile description is rendered into the generated Ansible collection role READMEs, blocking Automation Hub certification.

Replace it with an ASCII apostrophe in every affected product profile: almalinux9, ol7, ol8, ol9, rhel8, rhel9, sle15.
Add utils/check_smart_quotes.py, which detects (and with --fix, replaces) Unicode smart quotes with their ASCII equivalents, mirroring the ansible-test no-smart-quotes sanity test that gates Automation Hub certification of the generated Ansible collection.

Register it as the test-check-smart-quotes CTest scoped to products/*/profiles (where the collection role READMEs are sourced from), plus a mypy check, following the existing utils/check_eof.py pattern.
@ggbecker
ggbecker force-pushed the build-collections-extra-patches branch from c3b940a to fb65c6e Compare October 1, 2026 11:23
The platform version emitted into each generated role's meta/main.yml was
derived with platform[-1], so 'rhel10' yielded '0' instead of the release,
and non-RHEL EL products fell back to a hardcoded '7' + '8'. Derive the
version from the trailing digits of the product id instead (rhel10 -> '10',
rhel8 -> '8', ol9 -> '9'). Also quote min_ansible_version and the platform
version in the meta template so they satisfy the Galaxy schema's string types.

The RHEL 10 value '10' is accurate but is not accepted by ansible-lint's
schema[meta] when the linter is pinned to the ansible-core 2.16 certification
floor (24.12.2), whose EL version enum caps at '9'. Accurate platform metadata
is preferred; the collection excludes only the RHEL 10 meta files from schema
validation (schema[meta] cannot be waived via skip_list).

The metadata template is filled by @Placeholder@ string substitution (including
structural tokens like @GALAXY_TAGS@) so it is not valid standalone YAML; add it
to .yamllint's ignore list so the changed-file yamllint CI check skips it.
The verification step flagged ansible.posix references as unrewritten
FQCNs, but ansible.posix is now a declared collection dependency and is
intentionally retained. Narrow the grep to the vendored collection
(community.general), which is the only FQCN that must be rewritten.
@ggbecker
ggbecker force-pushed the build-collections-extra-patches branch from fb65c6e to 5ea2690 Compare October 2, 2026 12:46
@ggbecker
ggbecker requested a review from jan-cerny October 2, 2026 12:46
@ggbecker
ggbecker marked this pull request as ready for review October 2, 2026 12:46
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Oct 2, 2026
Comment thread utils/ansible_roles_to_collection.py Outdated
--output-dir /tmp/collection \\
[--version 0.1.82] # defaults to the SSG project version from CMakeLists.txt \\
[--namespace redhatofficial] \\
[--target galaxy|hub] \\

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
[--target galaxy|hub] \\
[--target galaxy|hub] \\

Comment thread docs/release_process.md
documentation, issue tracker, author, and installation server automatically:

```bash
python3 utils/ansible_roles_to_collection.py \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does --galaxy-server need to be included in this command here or not?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In this case we are only building the collection to manually upload it later. At this moment we are not automatically pushing any collections to galaxy hub. We do it manually by uploading the final tar.gz file generated by this command.

Comment thread utils/ansible_roles_to_collection.py Outdated

## Support

This collection is maintained by Red Hat RHEL Security Content.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Who/what is "Red Hat RHEL Security Content"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd simply remove this line to not create more confusion.

Align the --target line in the usage docstring with the surrounding
options, and remove the inaccurate maintainer sentence from the
generated collection README Support section.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jan-cerny

Copy link
Copy Markdown
Member

/packit build

@jan-cerny jan-cerny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have verified that the tarball and collections can be generated using the steps in docs/release_process.md.

@jan-cerny

Copy link
Copy Markdown
Member

@ComplianceAsCode/suse-maintainers @ComplianceAsCode/oracle-maintainers Please take a look and review this PR, namely the changes in your profile files.

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

Thanks, LGTM 👍

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

LGTM, Thanks

This branch has not been deployed

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

Labels

Infrastructure Our content build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants