Skip to content

Commit

Permalink
Integrate antibull-changelog (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Sep 3, 2024
1 parent 7701110 commit a7873f5
Show file tree
Hide file tree
Showing 19 changed files with 104 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ testenv
testpass
testsecret
testuser
toctree
toxinidir
trustore
truststore
unshallow
12 changes: 12 additions & 0 deletions .config/manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@
.flake8
.gitignore
CHANGELOG.md
CHANGELOG.rst
CONTRIBUTING.md
FILES.json
LICENSE
MANIFEST.json
README.md
bindep.txt
changelogs/
changelogs/changelog.yaml
changelogs/config.yaml
changelogs/fragments/
changelogs/fragments/.gitkeep
changelogs/fragments/297-bug.yaml
docs/
docs/docsite/
docs/docsite/config.yml
docs/docsite/extra-docs.yml
extensions/
extensions/eda/
extensions/eda/plugins/
Expand Down Expand Up @@ -104,4 +115,5 @@ test_requirements.txt
tests/
tests/__init__.py
tests/integration/
tests/run-docs
tests/run-galaxy-importer
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ tests/integration/inventory
# Collection specific
changelogs/.plugin-cache.yaml
importer_result.json
docs/rst/CHANGELOG.md
CHANGELOG.md
CHANGELOG.rst
6 changes: 5 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@ repos:
name: build collection and verify manifest
entry: ./tests/run-galaxy-importer
language: python
always_run: true
pass_filenames: false
additional_dependencies:
- antsibull-changelog
- galaxy-importer
- setuptools # https://issues.redhat.com/browse/AAH-3375
- id: ansible-test-sanity
name: Run ansible-test sanity
entry: ansible-test sanity
Expand All @@ -147,7 +151,7 @@ repos:
name: pip-combile -> constraints.txt
alias: deps
always_run: true
entry: pip-compile --upgrade --no-annotate --strip-extras --unsafe-package=ansible-core --unsafe-package=setuptools --output-file=.config/constraints.txt .config/requirements.txt .config/requirements-test.txt .config/requirements-docs.txt
entry: pip-compile --upgrade --no-annotate --strip-extras --unsafe-package=ansible-core --unsafe-package=doctutils --unsafe-package=setuptools --output-file=.config/constraints.txt .config/requirements.txt .config/requirements-test.txt .config/requirements-docs.txt
files: ^.config\/.*requirements.*$
language: python
language_version: "3.9" # minimal we support officially
Expand Down
9 changes: 1 addition & 8 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,9 @@ build:
os: ubuntu-24.04
tools:
python: "3.12"
# When using commands we canon install apt_package due to
# https://github.com/readthedocs/readthedocs.org/issues/11219
# https://github.com/readthedocs/readthedocs.org/issues/9599
# apt_packages:
# - rsync
commands:
# Copy executable in the first directory in path, which happens to be writable on RTD
- mkdir -p ${PATH%%:*}
- cp docs/bin/rsync ${PATH%%:*}/
- rsync --version
- git fetch --unshallow || true
- pip install --user tox
- python3 -m tox -e docs
- mkdir -p $READTHEDOCS_OUTPUT
Expand Down
12 changes: 0 additions & 12 deletions CHANGELOG.md

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

This collection contains event source plugins, event filters and example rulebooks to be used with [ansible-rulebook](https://ansible-rulebook.readthedocs.io/en/stable/).

[![galaxy](https://img.shields.io/badge/galaxy-ansible.eda-5bbdbf?style=flat&logo=ansible&cacheSeconds=3600)](<(https://img.shields.io/badge/galaxy-ansible.eda-green?style=flat)(https://galaxy.ansible.com/ui/repo/published/ansible/eda/)>)
[![tox](https://github.com/ansible/event-driven-ansible/actions/workflows/tox.yml/badge.svg?event=push)](https://github.com/ansible/event-driven-ansible/actions/workflows/tox.yml)
[![codecov](https://codecov.io/github/ansible/event-driven-ansible/graph/badge.svg?token=XvFwDpezAH)](https://codecov.io/github/ansible/event-driven-ansible)

Expand Down Expand Up @@ -68,7 +69,8 @@ pip install -r requirements.txt
```

Refer to the following for more details.
* [using Ansible collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details.

- [using Ansible collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details.

## Use Cases

Expand Down
11 changes: 11 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
ancestor: null
releases:
1.4.7:
changes:
bugfixes:
- Fixed examples to use vars instead of jinja
minor_changes:
- Aad raise_error and log_error option to insert_hosts_to_meta filter
- Enable webhook mTLS support
release_date: '2024-05-21'
17 changes: 11 additions & 6 deletions changelogs/config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
add_plugin_period: true
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

changelog_filename_template: ../CHANGELOG.rst
changelog_filename_version_depth: 0
changelog_nice_yaml: false
changelog_sort: alphanumerical
changes_file: changelog.yaml
changes_format: combined
ignore_other_fragment_extensions: true
keep_fragments: false
# keep_fragments: false
mention_ancestor: true
new_plugins_after_name: removed_features
notesdir: fragments
output_formats:
- rst
- rst
- md
prelude_section_name: release_summary
prelude_section_title: Release Summary
sanitize_changelog: true
Expand All @@ -35,3 +37,6 @@ sections:
title: ansible.eda
trivial_section_name: trivial
use_fqcn: true
add_plugin_period: true
changelog_nice_yaml: true
vcs: git
2 changes: 2 additions & 0 deletions changelogs/fragments/297-bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- Generated changelog based on fragments.
1 change: 1 addition & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ignorePaths:
# The requirements file
- requirements.txt
- .config/constraints.txt
- .config/manifest.txt
- docs/requirements.txt
- docs/requirements.in
# Test fixtures generated from outside
Expand Down
2 changes: 0 additions & 2 deletions docs/bin/README.md

This file was deleted.

Binary file removed docs/bin/rsync
Binary file not shown.
7 changes: 7 additions & 0 deletions docs/docsite/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

changelog:
write_changelog: true
1 change: 1 addition & 0 deletions docs/docsite/extra-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
10 changes: 6 additions & 4 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace: ansible
name: eda

# The version of the collection. Must be compatible with semantic versioning
version: 1.4.7
version: 2.0.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down Expand Up @@ -49,7 +49,7 @@ dependencies: {}
repository: https://github.com/ansible/event-driven-ansible

# The URL to any online docs
documentation: https://github.com/ansible/event-driven-ansible
documentation: https://ansible.readthedocs.io/projects/ansible-eda/

# The URL to the homepage of the collection/project
homepage: http://ansible.com/event-driven
Expand Down Expand Up @@ -77,12 +77,14 @@ build_ignore:
- .tox
- .venv
- ansible_collections
- changelogs
- changelogs/.plugin-cache.yaml
- codecov.yml
- collections
- cspell.config.yaml
- demos
- docs
- docs/build
- docs/rst
- docs/temp-rst
- pyproject.toml
- run_pytest.yml
- start_app.yml
Expand Down
23 changes: 23 additions & 0 deletions tests/run-docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash -eu
set -eux
# Determine the collection version, if current commit is tagged, use it. Otherwise, generate pre-release version.
COLLECTION_VERSION_WITH_PREFIX=$(git describe --dirty --tags --long --match "v*.*" | cut -f1,2 -d'-')
COLLECTION_VERSION=${COLLECTION_VERSION_WITH_PREFIX/v/}
echo "INFO: Determined collection version to be ${COLLECTION_VERSION}"

echo "INFO: Running 'antsibull-changelog release' to generate a changelog that includes unreleased changes."
antsibull-changelog release -v --version="${COLLECTION_VERSION}" --codename unreleased --update-existing

echo "INFO: Resetting changes mage by 'antsibull-changelog release' call."
git checkout --no-overlay -- changelogs/changelog.yaml changelogs/fragments/

# ansible-galaxy collection install --force .
antsibull-docs sphinx-init --project="Event Driven Ansible Collection" --title="Event Driven Ansible Collection" --html-short-title="ansible.eda" --fail-on-error --squash-hierarchy --dest-dir=docs ansible.eda --use-current
bash ./docs/build.sh

if [[ ! -f ./docs/build/html/changelog.html ]]; then
echo "ERROR: Changelog file not found."
exit 1
fi

echo "INFO: Finished building docs for version ${COLLECTION_VERSION} - Open it at ./docs/build/html/index.html"
15 changes: 14 additions & 1 deletion tests/run-galaxy-importer
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
#!/bin/bash -eu
set -e

echo "INFO: Cleaning up old files"
rm -f ./*.tar.gz importer_result.json

# we produce the changelog as that is not tracked in git
echo "INFO: Generating changelog"
python3 -m antsibull_changelog generate -vvv

echo "INFO: Run galaxy-importer"
# produces importer_result.json
GALAXY_IMPORTER_CONFIG=.config/galaxy-importer.cfg python3 -m galaxy_importer.main --git-clone-path=. --output-path=.

echo "INFO: Check if importer_result.json is not empty"
ARCHIVE=$(python3 -c "import json; print(json.load(open('importer_result.json'))[-1])")

echo "INFO: Check that list of files (manifest) inside the collection archive is the expected one."
tar -tf "$ARCHIVE" | sort > .config/manifest.txt
sync
git --no-pager diff -U0 --minimal || {
echo "Manifest at .config/manifest.txt changed, please update it."
echo "ERROR: Manifest at .config/manifest.txt changed, please update it."
exit 3
}
echo "INFO: Galaxy importer check passed."
7 changes: 2 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,8 @@ deps =
commands_pre =
# --force must remain here or we risk on building docs for older version
ansible-galaxy collection install --force .
bash -c "command -v rsync || { 'Building docs with antsibull-docs require rsync, please install it.'; exit 1;}"
commands =
antsibull-docs sphinx-init --project="Event Driven Ansible Collection" --title="Event Driven Ansible Collection" --html-short-title="ansible.eda" --fail-on-error --use-current --squash-hierarchy --dest-dir=docs ansible.eda
bash ./docs/build.sh --add-antsibull-docs-version=false
./tests/run-docs
allowlist_externals =
mkdir
./tests/run-docs
bash
git

0 comments on commit a7873f5

Please sign in to comment.