From b1b90d165da468201c34ace992810ce61d4b4da6 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 28 Apr 2023 11:32:28 +0200 Subject: [PATCH 1/6] make dockerfiles testing only note Signed-off-by: Kristoffer Dalby --- Dockerfile | 5 ++++- Dockerfile.debug | 5 ++++- Dockerfile.tailscale-HEAD | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 367afe94..aa52b13d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ -# Builder image +# This Dockerfile and the images produced are for testing headscale, +# and are in no way endorsed by Headscale's maintainers as an +# official nor supported release or distribution. + FROM docker.io/golang:1.21-bookworm AS build ARG VERSION=dev ENV GOPATH /go diff --git a/Dockerfile.debug b/Dockerfile.debug index 8f49d2bc..7a603b05 100644 --- a/Dockerfile.debug +++ b/Dockerfile.debug @@ -1,4 +1,7 @@ -# Builder image +# This Dockerfile and the images produced are for testing headscale, +# and are in no way endorsed by Headscale's maintainers as an +# official nor supported release or distribution. + FROM docker.io/golang:1.21-bookworm AS build ARG VERSION=dev ENV GOPATH /go diff --git a/Dockerfile.tailscale-HEAD b/Dockerfile.tailscale-HEAD index 2a3aac76..83ff9fe5 100644 --- a/Dockerfile.tailscale-HEAD +++ b/Dockerfile.tailscale-HEAD @@ -1,3 +1,7 @@ +# This Dockerfile and the images produced are for testing headscale, +# and are in no way endorsed by Headscale's maintainers as an +# official nor supported release or distribution. + FROM golang:latest RUN apt-get update \ From 887302e8f1f5c93334b0ab6645c802e3dc6ea94d Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 28 Apr 2023 11:59:19 +0200 Subject: [PATCH 2/6] setup ko image builder for goreleaser Signed-off-by: Kristoffer Dalby --- .goreleaser.yml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 07efe6f7..8a1d627a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -36,6 +36,7 @@ archives: format: binary source: + rlcp: true enabled: true name_template: "{{ .ProjectName }}_{{ .Version }}" format: tar.gz @@ -63,7 +64,6 @@ nfpms: bindir: /usr/bin formats: - deb - # - rpm contents: - src: ./config-example.yaml dst: /etc/headscale/config.yaml @@ -80,6 +80,36 @@ nfpms: postinstall: ./docs/packaging/postinstall.sh postremove: ./docs/packaging/postremove.sh +kos: + - id: ghcr + build: headscale + base_image: gcr.io/distroless/base-debian11 + repository: ghcr.io/juanfont/headscale + platforms: + - linux/amd64 + - linux/386 + - linux/arm64 + - linux/arm/v7 + - linux/arm/v6 + - linux/arm/v5 + tags: + - latest + - '{{.Tag}}' + - id: dockerhub + build: headscale + base_image: gcr.io/distroless/base-debian11 + repository: headscale/headscale + platforms: + - linux/amd64 + - linux/386 + - linux/arm64 + - linux/arm/v7 + - linux/arm/v6 + - linux/arm/v5 + tags: + - latest + - '{{.Tag}}' + checksum: name_template: "checksums.txt" snapshot: From 062b9a5611cbeace60efba45c051cadc2ac630f8 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sat, 3 Feb 2024 15:49:02 +0100 Subject: [PATCH 3/6] test Signed-off-by: Kristoffer Dalby --- .goreleaser.yml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 8a1d627a..79ff0a95 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -36,7 +36,6 @@ archives: format: binary source: - rlcp: true enabled: true name_template: "{{ .ProjectName }}_{{ .Version }}" format: tar.gz @@ -95,20 +94,22 @@ kos: tags: - latest - '{{.Tag}}' - - id: dockerhub - build: headscale - base_image: gcr.io/distroless/base-debian11 - repository: headscale/headscale - platforms: - - linux/amd64 - - linux/386 - - linux/arm64 - - linux/arm/v7 - - linux/arm/v6 - - linux/arm/v5 - tags: - - latest - - '{{.Tag}}' + - '{{ .Major }}.{{ .Minor }}' + - '{{ .Major }}' + # - id: dockerhub + # build: headscale + # base_image: gcr.io/distroless/base-debian11 + # repository: headscale/headscale + # platforms: + # - linux/amd64 + # - linux/386 + # - linux/arm64 + # - linux/arm/v7 + # - linux/arm/v6 + # - linux/arm/v5 + # tags: + # - latest + # - '{{.Tag}}' checksum: name_template: "checksums.txt" From 9cedc2942b200919aee368db86a533923f59e07c Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sat, 3 Feb 2024 16:34:13 +0100 Subject: [PATCH 4/6] verbose and test Signed-off-by: Kristoffer Dalby --- .github/workflows/release.yml | 2 +- .goreleaser.yml | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 72eddbcb..7810279b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,6 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - name: Run goreleaser - run: nix develop --command -- goreleaser release --clean + run: nix develop --command -- goreleaser release --clean --verbose env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 79ff0a95..25f1893f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -14,15 +14,15 @@ builds: env: - CGO_ENABLED=0 targets: - - darwin_amd64 - - darwin_arm64 - - freebsd_amd64 - - linux_386 + # - darwin_amd64 + # - darwin_arm64 + # - freebsd_amd64 + # - linux_386 - linux_amd64 - - linux_arm64 - - linux_arm_5 - - linux_arm_6 - - linux_arm_7 + # - linux_arm64 + # - linux_arm_5 + # - linux_arm_6 + # - linux_arm_7 flags: - -mod=readonly ldflags: @@ -86,11 +86,11 @@ kos: repository: ghcr.io/juanfont/headscale platforms: - linux/amd64 - - linux/386 - - linux/arm64 - - linux/arm/v7 - - linux/arm/v6 - - linux/arm/v5 + # - linux/386 + # - linux/arm64 + # - linux/arm/v7 + # - linux/arm/v6 + # - linux/arm/v5 tags: - latest - '{{.Tag}}' From 88af29d5f546334f70b9f4ef4c3a0001b6593f98 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sat, 3 Feb 2024 16:55:35 +0100 Subject: [PATCH 5/6] derp Signed-off-by: Kristoffer Dalby --- .goreleaser.yml | 7 ++++++- flake.nix | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 25f1893f..9078fcc1 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,7 +9,7 @@ release: builds: - id: headscale - main: ./cmd/headscale/headscale.go + main: ./cmd/headscale mod_timestamp: "{{ .CommitTimestamp }}" env: - CGO_ENABLED=0 @@ -82,8 +82,11 @@ nfpms: kos: - id: ghcr build: headscale + main: ./cmd/headscale base_image: gcr.io/distroless/base-debian11 repository: ghcr.io/juanfont/headscale + env: + - CGO_ENABLED=0 platforms: - linux/amd64 # - linux/386 @@ -96,6 +99,8 @@ kos: - '{{.Tag}}' - '{{ .Major }}.{{ .Minor }}' - '{{ .Major }}' + - '{{ if not .Prerelease }}stable{{ end }}' + # - id: dockerhub # build: headscale # base_image: gcr.io/distroless/base-debian11 diff --git a/flake.nix b/flake.nix index 3576e3a0..c3fc64bc 100644 --- a/flake.nix +++ b/flake.nix @@ -95,6 +95,7 @@ gotestsum gotests ksh + ko # 'dot' is needed for pprof graphs # go tool pprof -http=: From 86768c8ac47fca83165f8c5a68949ba08faba41c Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sat, 3 Feb 2024 17:00:36 +0100 Subject: [PATCH 6/6] take 3 Signed-off-by: Kristoffer Dalby --- .goreleaser.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 9078fcc1..d3d38db0 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -14,15 +14,15 @@ builds: env: - CGO_ENABLED=0 targets: - # - darwin_amd64 - # - darwin_arm64 - # - freebsd_amd64 - # - linux_386 + - darwin_amd64 + - darwin_arm64 + - freebsd_amd64 + - linux_386 - linux_amd64 - # - linux_arm64 - # - linux_arm_5 - # - linux_arm_6 - # - linux_arm_7 + - linux_arm64 + - linux_arm_5 + - linux_arm_6 + - linux_arm_7 flags: - -mod=readonly ldflags: @@ -81,22 +81,23 @@ nfpms: kos: - id: ghcr + repository: ghcr.io/kradalby/headscale + base_image: gcr.io/distroless/base-debian11 build: headscale main: ./cmd/headscale - base_image: gcr.io/distroless/base-debian11 - repository: ghcr.io/juanfont/headscale env: - CGO_ENABLED=0 platforms: - linux/amd64 - # - linux/386 - # - linux/arm64 - # - linux/arm/v7 - # - linux/arm/v6 - # - linux/arm/v5 + - linux/386 + - linux/arm64 + - linux/arm/v7 + - linux/arm/v6 + - linux/arm/v5 tags: - latest - - '{{.Tag}}' + - '{{ .Tag }}' + - '{{ .Major }}.{{ .Minor }}.{{ .Patch }}' - '{{ .Major }}.{{ .Minor }}' - '{{ .Major }}' - '{{ if not .Prerelease }}stable{{ end }}'