No description
Find a file
Jonas L c5e0d429c5
test: implement integration testing framework (#239)
Fixes #203

The namespace used to differentiate the resources between CI pipelines, CI stages or even between test targets was broken and resulted in conflicting resource names. This PR ensure the resources names don't collide with each other by making sure we use the entire hcloud_prefix value as md5sum, and by including the target role names inside the resource names.

Create a setup/teardown framework to handle testing resources used by the tests.

To simplify the review process, additional changes such as splitting the setup/teardown task in the prepare.yml and cleanup.yml files will be done in future PRs (many files were renamed, and git will not preserve the file history after the PR squash).

* chore: move integrations targets files

* test: create integration common files

* test: fix resources name namespace using the magic hcloud_ns

* test: simplify requirements install

* test: rename hcloud_server test taskfiles
2023-07-26 16:09:48 +02:00
.azure-pipelines chore: setup the stable-1 release branch (#254) 2023-07-11 13:23:22 +02:00
.github/workflows chore: setup the stable-1 release branch (#254) 2023-07-11 13:23:22 +02:00
changelogs chore: prepare v2.0.0 (#276) 2023-07-24 17:10:12 +02:00
meta feat: remove deprecated facts modules (#251) 2023-07-05 09:32:03 +02:00
plugins fix!: don't set inventory image vars if server image is undefined (#275) 2023-07-24 14:44:52 +02:00
scripts test: implement integration testing framework (#239) 2023-07-26 16:09:48 +02:00
tests test: implement integration testing framework (#239) 2023-07-26 16:09:48 +02:00
.gitignore feat: vendor hcloud python dependency (#244) 2023-07-11 11:15:08 +02:00
.gitlab-ci.yml ci: use shared gitlab CI template (#257) 2023-07-11 12:47:48 +02:00
.pre-commit-config.yaml test: implement integration testing framework (#239) 2023-07-26 16:09:48 +02:00
CHANGELOG.rst chore: prepare v2.0.0 (#276) 2023-07-24 17:10:12 +02:00
COPYING refactor: prefer true/false over yes/no (#226) 2023-06-21 10:49:54 +02:00
galaxy.yml chore: prepare v2.0.0 (#276) 2023-07-24 17:10:12 +02:00
Makefile feat: vendor hcloud python dependency (#244) 2023-07-11 11:15:08 +02:00
pyproject.toml chore: setup pre-commit (#234) 2023-06-27 11:50:13 +02:00
README.md feat: drop support for python3.7 (#270) 2023-07-19 14:28:21 +02:00
renovate.json chore: add renovate regex manager for hcloud upgrades (#256) 2023-07-12 12:22:52 +02:00

Build Status Codecov

Ansible Collection: hetzner.hcloud

Ansible Hetzner Cloud Collection for controlling your Hetzner Cloud Resources.

Python version compatibility

This collection depends on the hcloud library. Due to the hcloud Python Support Policy this collection requires Python 3.8 or greater.

Release notes

See here.

Release policy

The main branch is used for the development of the latest versions of the collections, and may contain breaking changes. The stable-* branches (e.g. stable-1 for the 1.x.y releases) are used to cut additional minor or patch releases if needed, but we do not provide official support for multiple versions of the collection.

Documentation

The documentation for all modules are available through ansible-doc.

Sample: ansible-doc hetzner.hcloud.hcloud_server shows the documentation for the hcloud_server module.

For all modules that were part of Ansible directly (before Ansible 2.11) we also have the documentation published in the Ansible documentation: https://docs.ansible.com/ansible/latest/collections/hetzner/hcloud/

Development

Requirements

You should place the collection (clone the repository) into the Ansible collection path. Normally this is ~/.ansible/collections/ansible_collections/<namespace>/<collection, so for our collection it would be: ~/.ansible/collections/ansible_collections/hetzner/hcloud.

git clone git@github.com:ansible-collections/hetzner.hcloud.git ~/.ansible/collections/ansible_collections/hetzner/hcloud

After this you just need ansible installed.

Testing

Testing is done via ansible-test. Make sure to have a cloud-config-hcloud.ini file in tests/integration which contains the hcloud API token:

[default]
hcloud_api_token=<token>

After this you should be able to use ansible-test integration to perform the integration tests for a specific module. Sample:

ansible-test integration --color --local  -vvv hcloud_server // Executed all integration tests for hcloud_server module

Releasing a new version

  1. Make sure your local main branch is in a clean state and is up to date.
  2. Define a new version:
    export HCLOUD_VERSION=1.15.0
    
  3. Create a release branch:
    git checkout -b "release-$HCLOUD_VERSION"
    
  4. Generate the changelog for the new version, it should remove all fragments and change the changelogs/changelog.yaml and CHANGELOG.rst:
    antsibull-changelog release --version "$HCLOUD_VERSION"
    git add changelogs/changelog.yaml changelogs/fragments CHANGELOG.rst
    
  5. Update the version in the ansible galaxy metadata file:
    sed -i "s/^version: .*/version: $HCLOUD_VERSION/" galaxy.yml
    git add galaxy.yml
    
  6. Commit the changes:
    git commit -m "chore: prepare v$HCLOUD_VERSION"
    
  7. Push the changes to Github, open a Pull Request and follow the process to get the PR merged into main.
  8. Once the PR is merged, tag the release through the Github UI, after this the Github Actions will run and publish the collection to Ansible Galaxy.