Skip to content

hetznercloud/fleeting-plugin-hetzner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipeline Status Coverage Go Report Releases Maturity License

A fleeting plugin for Hetzner Cloud.

This tool was created to leverage GitLab's Next Runner Auto-scaling Architecture with Hetzner Cloud, and take advantage of the new features that comes with it.

Docs

For more information, see the documentation.

Releases

This project adheres to Semantic Versioning.

Please read the changelog before upgrading.

Contribute

First and foremost, thank you! We appreciate that you want to contribute to this project.

When submitting your contribution to this project, make sure that:

  • all the pre-commit hooks passes:

    pre-commit run --all
  • all tests passes:

    make test
  • any relevant documentation is updated with your changes.

Development

Building the plugin

To build the binary, ensure that your go version is up-to-date, and run the following:

$ make build

Testing the plugin locally

To run the unit tests, run the following:

$ make test

For the integration tests to run, you need to export a Hetzner Cloud token in the HCLOUD_TOKEN environment variable before starting the tests.

Testing the plugin with GitLab Runner

Sometimes, you want to test the whole plugin as its being executed by GitLab's Fleeting mechanism. Use an approach like this:

  1. Build the plugin by running the following:

    $ cd cmd/fleeting-plugin-hetzner
    $ go build
  2. Set up the plugin in GitLab Runner's config.toml file using the approach described above, but update plugin = "/path/to/fleeting-plugin-hetzner" to point to your cmd/fleeting-plugin-hetzner/fleeting-plugin-hetzner

  3. Run gitlab-runner run or similar, to run GitLab Runner interactively as a foreground process.

  4. Make a CI job run using this runner, perhaps using special tags: or similar (to avoid breaking things for other CI jobs on the same GitLab installation).

Setup a development environment

To setup a development environment, make sure you installed the following tools:

  1. Configure a HCLOUD_TOKEN and a RUNNER_TOKEN in your shell session.

Warning

The development environment creates Hetzner Cloud servers which will induce costs.

  1. Run the development environment:
make -C dev up

Also run this command to update the development environment with your latest code changes.

  1. Check that the development environment is healthy:
docker compose logs

⚠️ Do not forget to clean up the development cluster once are finished:

make -C dev down

Creating a new release

We leverage the releaser-pleaser tool to prepare and cut releases. To cut a new release, you need to merge the Merge Request that was prepared by releaser-pleaser.

History

The project started out as a fork of the existing gitlab-org/fleeting/plugins/aws plugin, gradually replacing the AWS calls with calls to the Hetzner Cloud API. To all the people involved in this initial work, thanks a lot!