This commit splits the lint and test steps into two different jobs in
github actions.
Consider this a suggestion, the idea is that when we look at PRs we will
see explicitly which one of the two types of checks fails without having
to open Github actions.
This commit adds integration tests to headscale. They are currently
quite simple, but it lays the groundwork for more comprehensive testing
and ensuring we dont break things with the official tailscale client.
The test works by leveraging Docker (via dockertest) to spin up a
Headscale container, and a number of tailscale containers (10).
Each tailscale container is joined to the headscale and then "passed on"
to the tests.
Currently three tests have been implemented:
- Have all tailscale containers join headscale (in the setup process)
- Get IP from each container (I plan to extend this with cross-ping)
- List nodes with headscales CLI and verify all has been registered
This test depends on Docker, and currently, I have not looked into
hooking it into Github Actions.
This commit makes several changes to the dockerfile:
- Add go.mod and go.sum in a seperate stage, subsequently calling `go
mod download` to make it cache dependencies and speed up builds
- Use ubuntu:latest (28MB larger) instead of scratch, makes the image a
lot easier to debug (e.g. it has a shell and a package manager)
- Change ENTRYPOINT to CMD, this makes the behaviour of the image
slightly different from a CLI perspective, but makes interacting with
the image from code, docker-compose and kubernetes easier.
This is based on the premis that "the user know what command they
executed" and therefor know that the output is the key.
This makes the command a lot more useful in scripts.
This commit tries to detect if users can render colors in their terminal
and only enables color logs if that is true.
It also adds no-color.org's NO_COLOR env var support to allow it to be
disabled.