Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bonsai-oss/hetzner-machine-provider
Custom GitLab Runner Adapter for Running Jobs within Hetzner Cloud servers. Repository mirrored from GitLab. 🦊
https://github.com/bonsai-oss/hetzner-machine-provider
ci-cd cloud gitlab-ci gitlab-runner hcloud hetzner hetzner-cloud
Last synced: 3 months ago
JSON representation
Custom GitLab Runner Adapter for Running Jobs within Hetzner Cloud servers. Repository mirrored from GitLab. 🦊
- Host: GitHub
- URL: https://github.com/bonsai-oss/hetzner-machine-provider
- Owner: bonsai-oss
- License: gpl-3.0
- Created: 2023-04-02T05:53:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-20T16:04:22.000Z (6 months ago)
- Last Synced: 2024-06-22T04:37:41.449Z (5 months ago)
- Topics: ci-cd, cloud, gitlab-ci, gitlab-runner, hcloud, hetzner, hetzner-cloud
- Language: Go
- Homepage: https://gitlab.com/bonsai-oss/tools/hetzner-machine-provider
- Size: 109 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hcloud - hetzner-machine-provider - runner custom driver executing jobs on plain Hetzner Cloud machines like GitHub actions. (Integrations / Rust)
README
# hetzner-machine-provider
This is a provider for gitlab custom runners. It uses the Hetzner Cloud API to create and delete servers for using them inside the ci.
So, the CI behaves like in github actions with their "per-job" VMs.## Usage
Environment variables options used in ci config file:
- **HCLOUD_SERVER_TYPE**: The server type to use, for example `ccx12`, defaults to `auto`
- **HCLOUD_SERVER_ARCHITECTURE**: The architecture to use for the server, only being used if `HCLOUD_SERVER_TYPE` is set to `auto`, defaults to `amd64`
- **HCLOUD_SERVER_LOCATION**: The location to use, defaults to `fsn1`
- **HMP_SERVER_WAIT_DEADLINE**: The time to wait for the server to be ready, defaults to `5m`
- **HMP_ADDITIONAL_AUTHORIZED_KEYS**: Additional authorized keys to add to the server, defaults to `""`. Separate multiple keys with a newline (`\n`).### Image Selection
You can set the image to use by setting the `image` property in the `.gitlab-ci.yml` file.
If you don't set it, it will default to `ubuntu-22.04`.Also, some special image selectors are available:
- `:latest`-Suffix: Will be used to filter the images and selects the one with the highest os version. Example: `ubuntu:latest`
- `label#`-Prefix: Will be used to filter with label selectors. That is used for snapshots. The snapshot with the latest creation date will be selected. See [docs](https://docs.hetzner.cloud/#label-selector) for examples.## Runner Configuration
You need to configure the following environment variable for your gitlab runner:
- **HCLOUD_TOKEN**: The API token for the Hetzner Cloud API, must have the permissions to create and delete serversFurthermore, you need to configure the runner to use the custom executor. Here is an example configuration:
```toml
concurrent = 4
check_interval = 0
shutdown_timeout = 0[session_server]
session_timeout = 1800
...
[[runners]]
...
executor = "custom"
builds_dir = "/builds"
cache_dir = "/cache"
[runners.custom]
config_exec = "//hmp"
config_args = ["configure"]
prepare_exec = "//hmp"
prepare_args = ["prepare"]
run_exec = "//hmp"
run_args = ["exec"]
cleanup_exec= "//hmp"
cleanup_args = ["cleanup"]
...
```