Releasing collections with release branches
Collections MUST follow the semantic versioning rules. See Releasing collections for high-level details.
Release planning and announcement
Announce your intention to release the collection in a corresponding pinned release issue/community pinboard of the collection and in the
#ansible-communityMatrix/IRC channel. Repeat the announcement in any other dedicated channels if they exist.Ensure all the other repository maintainers are informed about the time of the following release.
Releasing major collection versions
The new version is assumed to be X.0.0.
Make sure that
galaxy.ymlcontains the correct version numberX.0.0. If that is not the case, create a PR to update it. This will make sanity tests fail for all deprecations that have to be removed inX.0.0, so this is potentially a lot of work and should have been done weeks before the major release.Check the collection for deprecations that are planned for removal in the major release that were not reported by the sanity tests. Use past changelogs or run
grep -r `X.0.0` plugins/in the repository.If you are going to release the
community.generalandcommunity.networkcollections, create a newbackport-Xlabel in the corresponding repositories. Copy the styles and descriptions from the corresponding existing labels.Ensure you are in a default branch in your local fork. These examples use
main.
git status git checkout main # if needed
Update your local fork:
git pull --rebase upstream main
Creating the release branch
Create a branch
stable-X. ReplaceXwith a correct number and push it to the upstream repository, NOT to theorigin.:
git branch stable-X main git push upstream stable-X
Create and checkout to another branch from the
mainbranch:
git checkout -b update_repo
Update the version in
galaxy.ymlin the branch to the next expected version, for example,X.1.0.
Creating the changelogs
Replace
changelogs/changelog.ymlwith:
ancestor: X.0.0 releases: {}
Remove all changelog fragments from
changelogs/fragments/. Removing the changelog fragments ensures that every major release has a changelog describing changes since the last major release.Add and commit all the changes made. Push the branch to the
originrepository.Create a pull request in the collection repository. If CI tests pass, merge the pull request since the
mainbranch is expecting changes for the next minor/major versionsSwitch to the
stable-Xbranch.In the
stable-Xbranch, verify thatgalaxy.ymlcontains the correct version numberX.0.0.In the
stable-Xbranch, ensure thatchangelogs/changelog.ymlcontains a correct ancestor’s version:
ancestor: X-1.0.0 releases: {}
In the
stable-Xbranch, add a changelog fragmentchangelogs/fragments/X.0.0.ymlwith the content:
release_summary: |- Write some text here that should appear as the release summary for this version. The format is reStructuredText, but not a list as for regular changelog fragments. This text will be inserted into the changelog.For example:
release_summary: This is release 2.0.0 of ``community.foo``, released on YYYY-MM-DD.
In the
stable-Xbranch, generate the changelogs:
antsibull-changelog release --cummulative-release
In the
stable-Xbranch, verify that theCHANGELOG.rstlooks as expected.In the
stable-Xbranch, updateREADME.mdso that the changelog link points to/tree/stable-X/and no longer to/tree/main/, and change badges respectively, for example, in case of AZP, add?branchName=stable-Xto the AZP CI badge (https://dev.azure.com/ansible/community.xxx/_apis/build/status/CI?branchName=stable-X).In the
stable-Xbranch, add, commit, and push changes toREADME.md,CHANGELOG.rstandchangelogs/changelog.yaml, and potentially deleted/archived fragments to the upstream repository, NOT to theorigin.
Publishing the collection
In the
stable-Xbranch, add an annotated tag to the last commit with the collection versionX.0.0. Pushing this tag to theupstreamrepository will make Zuul publish the collection on Ansible Galaxy.
git tag -n # see current tags and their comments git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.0.0" git push upstream NEW_VERSION
If the collection uses Zuul for publishing its releases, wait until the new version is published on the collection’s Ansible Galaxy page. It will appear in a list of tarballs available to download.
If the release tarball did not appear within several hours after pushing the tag, try to re-tag the release commit and push the tag again. In the
stable-Xbranch being at the release commit:
git tag --delete NEW_VERSION git push upstream :NEW_VERSION git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.0.0" git push upstream NEW_VERSION
Add a GitHub release for the new tag. The title should be the version and content, such as -
See https://github.com/ansible-collections/community.xxx/blob/stable-X/CHANGELOG.rst for all changes.Announce the release through the Bullhorn Newsletter.
Announce the release in the pinned release issue/community pinboard of the collection and in the
#ansible-communityMatrix/Libera.Chat IRC channel.In the
stable-Xbranch, update the version ingalaxy.ymlto the next expected version, for example,X.1.0. Add, commit and push to the upstream repository.
Releasing minor collection versions
The new version is assumed to be X.Y.0. All changes that should go into it are expected to be previously backported from the default branch to the stable-X branch.
Creating the changelogs
In the
stable-Xbranch, make sure thatgalaxy.ymlcontains the correct version numberX.Y.0. If not, update it.In the
stable-Xbranch, add a changelog fragmentchangelogs/fragments/X.Y.0.ymlwith content:
release_summary: |- Write some text here that should appear as the release summary for this version. The format is reStructuredText, but not a list as for regular changelog fragments. This text will be inserted into the changelog.
In the
stable-Xbranch, run:
antsibull-changelog release
In the
stable-Xbranch, verify thatCHANGELOG.rstlooks as expected.In the
stable-Xbranch, add, commit, and push changes toCHANGELOG.rstandchangelogs/changelog.yaml, and potentially deleted/archived fragments to the upstream repository, NOT to the origin.
Publishing the collection
In the
stable-Xbranch, add an annotated tag to the last commit with the collection versionX.Y.0. Pushing this tag to theupstreamrepository will make Zuul publish the collection on Ansible Galaxy.
git tag -n # see current tags and their comments git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.1.0" git push upstream NEW_VERSION
Wait until the new version is published on the collection’s Ansible Galaxy page. The published version will appear in a list of tarballs available to download.
Add a GitHub release for the new tag. The title should be the version and content, such as -
See https://github.com/ansible-collections/community.xxx/blob/stable-X/CHANGELOG.rst for all changes.Announce the release through the Bullhorn Newsletter.
Announce the release in the pinned release issue/community pinboard of the collection and in the
#ansible-communityMatrix/IRC channel. Additionally, you can announce it using GitHub’s Releases system.In the
stable-Xbranch, update the version ingalaxy.ymlto the next expected version, for example, if you have releasedX.1.0, the next expected version could beX.2.0. Add, commit and push to the upstream repository.Checkout to the
mainbranch.In the
mainbranch:
If more minor versions are released before the next major version, update the version in
galaxy.ymltoX.(Y+1).0as well. Create a dedicated pull request and merge.If the next version will be a new major version, create a pull request where you update the version in
galaxy.ymlto(X+1).0.0. Note that the sanity tests will most likely fail since there will be deprecations with removal scheduled for(X+1).0.0, which are flagged by the tests.For every such deprecation, decide:
Whether to remove them now. For example, you remove the complete
modules/pluginsor you remove redirects.Whether to add ignore entries to the corresponding
tests/sanity/ignore-*.txtfile and create issues, for example for removed features inmodules/plugins.Once the CI tests pass, merge the pull request. Make sure that this pull request is merged not too much later after the release for
version_addedsanity tests not to expect the wrong version for the new feature pull request.
Note
It makes sense to already do some removals in the days before the release. These removals must happen in the main branch and must not be backported.
Releasing patch versions
The new version is assumed to be X.Y.Z, and the previous patch version is assumed to be X.Y.z with z < Z. z is frequently 0 since patch releases are uncommon.
Releasing when more minor versions are expected
Checkout the
X.Y.ztag.Update
galaxy.ymlso that the version isX.Y.Z. Add and commit.Cherry-pick all changes from
stable-Xthat were added afterX.Y.zand should go intoX.Y.Z.Add a changelog fragment
changelogs/fragments/X.Y.Z.ymlwith content:
release_summary: |- Write some text here that should appear as the release summary for this version. The format is reStructuredText but not a list as for regular changelog fragments. This text will be inserted into the changelog.Add to Git and commit.
Generate the changelogs.
antsibull-changelog release
Verify that
CHANGELOG.rstlooks as expected.Add and commit changes to
CHANGELOG.rstandchangelogs/changelog.yaml, and potentially deleted/archived fragments.
Publishing the collection
Add an annotated tag to the last commit with the collection version
X.Y.Z. Pushing this tag to theupstreamrepository will make Zuul publish the collection on Ansible Galaxy.
git tag -n # see current tags and their comments git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.1.1" git push upstream NEW_VERSION
Wait until the new version is published on the collection’s Ansible Galaxy page. It will appear in a list of tarballs available to download.
Add a GitHub release for the new tag. The title should be the version and content, such as -
See https://github.com/ansible-collections/community.xxx/blob/stable-X/CHANGELOG.rst for all changes.
Note
The data for this release is only contained in a tag, and not in a branch, in particular not in
stable-X. This is deliberate, since the next minor releaseX.(Y+1).0already contains the changes forX.Y.Zas well since these were cherry-picked fromstable-X.
Announce the release through the Bullhorn Newsletter.
Announce the release in the pinned release issue/community pinboard of the collection and in the
#ansible-communityMatrix/IRC channel <https://docs.ansible.com/ansible/devel/community/communication.html#real-time-chat>.
Releasing when no more minor versions are expected
In the
stable-Xbranch, make sure thatgalaxy.ymlcontains the correct version numberX.Y.Z. If not, update it!In the
stable-Xbranch, add a changelog fragmentchangelogs/fragments/X.Y.Z.ymlwith content:
release_summary: |- Write some text here that should appear as the release summary for this version. The format is reStructuredText, but not a list as for regular changelog fragments. This text will be inserted into the changelog.
Generate the changelogs in the
stable-Xbranch.
antsibull-changelog release
In the
stable-Xbranch, verify thatCHANGELOG.rstlooks as expected.In the
stable-Xbranch, add, commit, and push changes toCHANGELOG.rstandchangelogs/changelog.yaml, and potentially deleted/archived fragments to the upstream repository, NOT to the origin.
Publishing the collection
In the
stable-Xbranch, add an annotated tag to the last commit with the collection versionX.Y.Z. Pushing this tag to theupstreamrepository will make Zuul publish the collection on Ansible Galaxy.
git tag -n # see current tags and their comments git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.1.1" git push upstream NEW_VERSION
Wait until the new version is published on the collection’s Ansible Galaxy page. It will appear in a list of tarballs available to download.
Add a GitHub release for the new tag. Title should be the version and content, such as:
See https://github.com/ansible-collections/community.xxx/blob/stable-X/CHANGELOG.rst for all changes.Announce the release through the Bullhorn Newsletter.
Announce the release in the pinned issue/community pinboard of the collection and in the
#ansible-communityMatrix/IRC channel.