Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Latest commit

 

History

History
263 lines (169 loc) · 15.8 KB

collection_requirements.rst

File metadata and controls

263 lines (169 loc) · 15.8 KB

Ansible Collections Checklist

This document is for maintainers of collections to provide them help, advice, and guidance on making sure their collections are correct.

Warning: Subject to frequent updates. This is a "living document", expect it to change as we progress with the Collections work over the next few months.

Note: Inclusion of a new collection in the Ansible package is ultimately at the discretion of the Ansible community review committee. Every rejected candidate will get feedback. Differences of opinion should be taken to the community irc meeting for discussion and a final vote.

As with any project it's very important that we get feedback from users, contributors and maintainers. We recognize that the move to Collections is a big change in how Ansible is developed and delivered.

Please raise feedback by:

Be sure you're subscribed to:

  • MUST have a publicly available issue tracker, that does not require a paid level of service to create an account or view issues.
  • Collections MUST have a Code of Conduct (CoC)
    • The collection's CoC MUST be compatible with the Ansible CoC
    • Collections SHOULD consider using the Ansible CoC if they do not have a CoC that they consider better
    • The Diversity and Inclusion working group may evaluate all CoCs and object to a collection's inclusion based on the CoCs contents
  • MUST be published to Ansible Galaxy.
  • The tags field MUST be set
  • Collection dependencies used are expected to be stable, hence MUST be set to '>=1.0.0'
    • This means that all collection dependencies have to specify lower bounds on the versions, and these lower bounds should be stable releases, and not versions of the form 0.x.y.
    • When creating new collections where collection dependencies are also under development, you need to watch out since Galaxy checks whether dependencies exist in the required versions:
      1. Assume that foo.bar depends on foo.baz
      2. First release foo.baz as 1.0.0.
      3. Then modify foo.bar's galaxy.yml to specify '>=1.0.0' for foo.baz
      4. Finally release foo.bar as 1.0.0

MUST have a README.md in the root of the Collection, see collection_template/README.md for an example.

Example: meta/runtime.yml

  • MUST define the minimum version of Ansible which this collection works with
    • If the collection works with Ansible 2.9, then this should be set to >=2.9.10
    • It's usually better to avoid adding <2.11 as a restriction, since this for example makes it impossible to use the collection with the current ansible-base devel branch (which has version 2.11.0.dev0)

All module and plugin DOCUMENTATION and RETURN MUST:

  • Use the FQCN for M(...) and - module: references of seealso subsections. See Linking within module documentation
  • Use the field version_added to document the version of the collection for which an option, module or plugin was added.
    • Use collection version numbers for version_added, and not Ansible version numbers or other unrelated version numbers.
    • If you for some reason really have to specify version numbers of Ansible or of another collection, you have to provide version_added_collection. We strongly recommend to NOT do this.
    • Not every option, module or plugin must have version_added. You should use it to mark when new content (modules, plugins, options) were added to the collection. The values are shown in the documentation, and this can be very useful for your users.

All module and plugin EXAMPLES MUST:

  • Use FQCN for module (or plugin) name.
  • For modules (or plugins) left in ansible-base use ansible.builtin. as a FQCN prefix, for example, ansible.builtin.template

Other items:

  • You MUST Use the FQCN for extends_documentation_fragment:, unless you are referring to doc_fragments from ansible-base
  • The CONTRIBUTING.md (or README.md) file MUST state what types of contributions (pull requests, feature requests, and so on) are accepted and any relevant contributor guidance. Issues (bugs and feature request) reports must always be accepted

Collections are required to include a changelog. To give a consistent feel for changelogs across collections and ensure changelogs exist for collections included in the ansible package we suggest you use antsibull-changelog to maintain and generate this but other options exist. Preferred (in descending order):

  1. Use antsibull-changelog (preferred)
  2. Provide changelogs/changelog.yaml in the correct format
  3. Provide a link to the changelog file (self-hosted) (not recommended)

Please note that the porting guide is compiled from changelogs/changelog.yaml (sections breaking_changes, major_changes, deprecated_features, removed_features). So if you use option 3, you will not be able to add something to the porting guide.

  • Collections MUST adhere to semantic versioning.
  • To preserve backward compatibility for users, every ansible minor version series (2.10.x) will keep the major version of a collection constant. If ansible 2.10.0 includes community.general 1.2.0, then each 2.10.x release will include the latest community.general 1.y.z release available at build time. Ansible 2.10.x will never include a community.general 2.y.x release, even if it is available. Major collection version changes will be included in the next ansible minor release (2.11.0, 2.12.0, and so on).
  • Therefore, please make sure that the current major release of your collection included in 2.10.0 receives at least bugfixes as long new 2.10.x releases are produced.
  • Since new minor releases are included, you can include new features, modules and plugins. You must make sure that you do not break backwards compatibility! (See semantic versioning.) This means in particular:
    • You can fix bugs in patch releases, but not add new features or deprecate things.
    • You can add new features and deprecate things in minor releases, but not remove things or change behavior of existing features.
    • You can only remove things or make breaking changes in major releases.
  • We recommend to make sure that if a deprecation is added in a collection version that is included in 2.10.x, but not in 2.10.0, that the removal itself will only happen in a collection version included in 2.12.0 or later, but not in a collection version included in 2.11.0.
  • Content moved from ansible/ansible that was scheduled for removal in 2.11 or later MUST NOT be removed in the current major release available when ansible 2.10.0 is released. Otherwise it would already be removed in 2.10, unexpectedly for users! Deprecation cycles can be shortened (since they are now uncoupled from ansible or ansible-base versions), but existing ones must not be unexpectedly terminated.
  • We recommend to announce your policy of releasing, versioning and deprecation to contributors and users in some way. For an example of how to do this, see the announcement in community.general. You could also do this in the README.

For collections under ansible-collections the repository SHOULD be named NAMESPACE.COLLECTION.

To create a new collection and corresponding repository, first, a new namespace in Galaxy has to be created via submitting Request a namespace.

Namespace limitations lists requirements for namespaces in Galaxy.

For collections created for working with a particular entity, they should contain the entity name, for example community.mysql.

For corporate maintained collections, the repository can be named COMPANY_NAME.PRODUCT_NAME, for example ibm.db2.

We should avoid FQCN / repository names:

  • which are unnecessary long: try to make it compact but clear
  • contain the same words / collocations in NAMESPACE and COLLECTION parts, for example my_system.my_system

At the moment, module_utils must be licensed under the BSD-2-clause or GPL-3.0-or-later license and all other content must be licensed under the GPL-3.0-or-later. We will have a list of other open source licenses which are allowed as soon as we get Red Hat's legal team to approve such a list for us.

This subsection is only for repositories under ansible-collections! Other collection repositories can also follow these guidelines, but do not have to.

All new repositories MUST have main as the default branch.

Existing repositories SHOULD be converted to use main

Repository Protections:

  • Allow merge commits: disallowed

Branch protections MUST be enforced:

  • Require linear history
  • Include administrators
  • You MUST run ansible-test sanity from the latest stable ansible-base/ansible-core branch.
  • You SHOULD suggest to additionally run ansible-test sanity from the ansible/ansible devel branch so that you find out about new linting requirements earlier.
  • The sanity tests MUST pass.
    • Adding some entries to the test/sanity/ignore*.txt file is an allowed method of getting them to pass, except cases listed below.
    • You SHOULD not have ignored test entries. A reviewer can manually evaluate and approve your collection if they deem an ignored entry to be valid.
    • You MUST not ignore the following validations. They must be fixed before approval:
      • validate-modules:doc-choices-do-not-match-spec
      • validate-modules:doc-default-does-not-match-spec
      • validate-modules:doc-missing-type
      • validate-modules:doc-required-mismatch
      • validate-modules:mutually_exclusive-unknown
      • validate-modules:nonexistent-parameter-documented
      • validate-modules:parameter-list-no-elements
      • validate-modules:parameter-type-not-in-doc
      • validate-modules:undocumented-parameter
    • All entries in ignores.txt MUST have a justification in a comment in the ignore.txt file for each entry. For example plugins/modules/docker_container.py use-argspec-type-path # uses colon-separated paths, can't use type=path.
    • Reviewers can block acceptance of a new collection if they don't agree with the ignores.txt entries.
  • You MUST run CI against each of the "major versions" (2.10, 2.11, 2.12, etc) of ansible-base/ansible-core that the collection supports. (Usually the HEAD of the stable-xxx branches.)
  • All CI tests MUST run against every pull request and SHOULD pass before merge.
  • All CI tests MUST pass for the commit that releases the collection.
  • All CI tests MUST run regularly (nightly, or at least once per week) to ensure that repos without regular commits are tested against the latest version of ansible-test from each ansible-base/ansible-core version tested.

All of the above can be achieved by using the following GitHub Action template, see this example.

FIXME to write a guide "How to write CI tests" (from scratch / add to existing) and put the reference here.

  • Working group page(s) on a corresponding wiki (if needed. Makes sense if there is a group of modules for working with one common entity, for example postgresql, zabbix, grafana, and so on.)
  • Issue for agenda (or pinboard if there aren't regular meetings) as pinned issue in the repository

All related entities must be moved / copied including:

  • related plugins/module_utils/ files (moving be sure it is not used by other modules, otherwise copy)
  • CI and unit tests
  • corresponding documentation fragments from plugins/doc_fragments

Also:

  • change M(), examples, seealso, extended_documentation_fragments to use actual FQCNs (in moved content and in other collections that have references to the content)
  • move all related issues / pull requests / wiki pages
  • look through docs/docsite directory of ansible-base GitHub repository (for example, using the grep command-line utility) to check if there are examples using the moved modules / plugins to update their FQCNs

See Migrating content to a different collection for complete details.

To be included in the ansible package, collections must meet the following criteria:

  • ansible-base's runtime.yml
  • After content is (moved out of community.general or community.network) OR new collection satisfies all the requirements