2021-10-28 11:51:09 +01:00
|
|
|
IMAGE_REPO ?= tailscale/tailscale
|
2024-04-15 16:57:17 +01:00
|
|
|
SYNO_ARCH ?= "x86_64"
|
2022-01-21 20:05:48 +00:00
|
|
|
SYNO_DSM ?= "7"
|
2023-09-19 17:51:22 +01:00
|
|
|
TAGS ?= "latest"
|
2021-10-28 11:51:09 +01:00
|
|
|
|
2024-01-10 19:19:20 +00:00
|
|
|
PLATFORM ?= "flyio" ## flyio==linux/amd64. Set to "" to build all platforms.
|
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
vet: ## Run go vet
|
2022-03-18 16:58:20 +00:00
|
|
|
./tool/go vet ./...
|
2020-08-25 05:35:27 +01:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
tidy: ## Run go mod tidy
|
2022-08-02 19:34:03 +01:00
|
|
|
./tool/go mod tidy
|
2022-03-21 18:03:45 +00:00
|
|
|
|
2023-12-07 19:23:01 +00:00
|
|
|
lint: ## Run golangci-lint
|
|
|
|
./tool/go run github.com/golangci/golangci-lint/cmd/golangci-lint run
|
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
updatedeps: ## Update depaware deps
|
2023-02-01 21:43:06 +00:00
|
|
|
# depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
|
|
|
|
# it finds in its $$PATH is the right one.
|
|
|
|
PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --update \
|
2022-08-05 19:12:35 +01:00
|
|
|
tailscale.com/cmd/tailscaled \
|
|
|
|
tailscale.com/cmd/tailscale \
|
2024-01-05 19:14:42 +00:00
|
|
|
tailscale.com/cmd/derper \
|
|
|
|
tailscale.com/cmd/stund
|
2020-09-09 20:17:44 +01:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
depaware: ## Run depaware checks
|
2023-02-01 21:43:06 +00:00
|
|
|
# depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
|
|
|
|
# it finds in its $$PATH is the right one.
|
|
|
|
PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --check \
|
2022-08-05 19:12:35 +01:00
|
|
|
tailscale.com/cmd/tailscaled \
|
|
|
|
tailscale.com/cmd/tailscale \
|
2024-01-05 19:14:42 +00:00
|
|
|
tailscale.com/cmd/derper \
|
|
|
|
tailscale.com/cmd/stund
|
2020-09-09 20:17:44 +01:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
buildwindows: ## Build tailscale CLI for windows/amd64
|
2022-03-18 16:58:20 +00:00
|
|
|
GOOS=windows GOARCH=amd64 ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled
|
2021-02-28 05:42:34 +00:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
build386: ## Build tailscale CLI for linux/386
|
2022-03-18 16:58:20 +00:00
|
|
|
GOOS=linux GOARCH=386 ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled
|
2021-03-01 19:19:20 +00:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
buildlinuxarm: ## Build tailscale CLI for linux/arm
|
2022-03-18 16:58:20 +00:00
|
|
|
GOOS=linux GOARCH=arm ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled
|
2021-08-18 23:36:04 +01:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
buildwasm: ## Build tailscale CLI for js/wasm
|
2022-08-15 15:03:29 +01:00
|
|
|
GOOS=js GOARCH=wasm ./tool/go install ./cmd/tsconnect/wasm ./cmd/tailscale/cli
|
|
|
|
|
2023-08-24 23:02:42 +01:00
|
|
|
buildplan9:
|
|
|
|
GOOS=plan9 GOARCH=amd64 ./tool/go install ./cmd/tailscale ./cmd/tailscaled
|
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
buildlinuxloong64: ## Build tailscale CLI for linux/loong64
|
2022-12-12 04:16:40 +00:00
|
|
|
GOOS=linux GOARCH=loong64 ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled
|
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
buildmultiarchimage: ## Build (and optionally push) multiarch docker image
|
2021-11-22 04:52:19 +00:00
|
|
|
./build_docker.sh
|
2021-10-28 11:51:09 +01:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
check: staticcheck vet depaware buildwindows build386 buildlinuxarm buildwasm ## Perform basic checks and compilation tests
|
2020-06-15 19:04:19 +01:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
staticcheck: ## Run staticcheck.io checks
|
2022-03-18 16:58:20 +00:00
|
|
|
./tool/go run honnef.co/go/tools/cmd/staticcheck -- $$(./tool/go list ./... | grep -v tempfork)
|
2021-12-06 17:22:21 +00:00
|
|
|
|
2023-12-14 13:51:59 +00:00
|
|
|
kube-generate-all: kube-generate-deepcopy ## Refresh generated files for Tailscale Kubernetes Operator
|
|
|
|
./tool/go generate ./cmd/k8s-operator
|
|
|
|
|
|
|
|
# Tailscale operator watches Connector custom resources in a Kubernetes cluster
|
|
|
|
# and caches them locally. Caching is done implicitly by controller-runtime
|
|
|
|
# library (the middleware used by Tailscale operator to create kube control
|
|
|
|
# loops). When a Connector resource is GET/LIST-ed from within our control loop,
|
|
|
|
# the request goes through the cache. To ensure that cache contents don't get
|
|
|
|
# modified by control loops, controller-runtime deep copies the requested
|
|
|
|
# object. In order for this to work, Connector must implement deep copy
|
|
|
|
# functionality so we autogenerate it here.
|
|
|
|
# https://github.com/kubernetes-sigs/controller-runtime/blob/v0.16.3/pkg/cache/internal/cache_reader.go#L86-L89
|
|
|
|
kube-generate-deepcopy: ## Refresh generated deepcopy functionality for Tailscale kube API types
|
|
|
|
./scripts/kube-deepcopy.sh
|
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
spk: ## Build synology package for ${SYNO_ARCH} architecture and ${SYNO_DSM} DSM version
|
2023-05-26 20:42:05 +01:00
|
|
|
./tool/go run ./cmd/dist build synology/dsm${SYNO_DSM}/${SYNO_ARCH}
|
2022-01-21 20:05:48 +00:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
spkall: ## Build synology packages for all architectures and DSM versions
|
2023-05-26 20:42:05 +01:00
|
|
|
./tool/go run ./cmd/dist build synology
|
2021-12-06 17:22:21 +00:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
pushspk: spk ## Push and install synology package on ${SYNO_HOST} host
|
2022-01-21 20:05:48 +00:00
|
|
|
echo "Pushing SPK to root@${SYNO_HOST} (env var SYNO_HOST) ..."
|
|
|
|
scp tailscale.spk root@${SYNO_HOST}:
|
|
|
|
ssh root@${SYNO_HOST} /usr/syno/bin/synopkg install tailscale.spk
|
2022-10-21 18:12:34 +01:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
publishdevimage: ## Build and publish tailscale image to location specified by ${REPO}
|
2022-10-21 18:12:34 +01:00
|
|
|
@test -n "${REPO}" || (echo "REPO=... required; e.g. REPO=ghcr.io/${USER}/tailscale" && exit 1)
|
|
|
|
@test "${REPO}" != "tailscale/tailscale" || (echo "REPO=... must not be tailscale/tailscale" && exit 1)
|
|
|
|
@test "${REPO}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1)
|
2022-12-13 17:40:41 +00:00
|
|
|
@test "${REPO}" != "tailscale/k8s-operator" || (echo "REPO=... must not be tailscale/k8s-operator" && exit 1)
|
|
|
|
@test "${REPO}" != "ghcr.io/tailscale/k8s-operator" || (echo "REPO=... must not be ghcr.io/tailscale/k8s-operator" && exit 1)
|
2024-01-10 19:19:20 +00:00
|
|
|
TAGS="${TAGS}" REPOS=${REPO} PLATFORM=${PLATFORM} PUSH=true TARGET=client ./build_docker.sh
|
2022-12-13 17:40:41 +00:00
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
publishdevoperator: ## Build and publish k8s-operator image to location specified by ${REPO}
|
2022-12-13 17:40:41 +00:00
|
|
|
@test -n "${REPO}" || (echo "REPO=... required; e.g. REPO=ghcr.io/${USER}/tailscale" && exit 1)
|
|
|
|
@test "${REPO}" != "tailscale/tailscale" || (echo "REPO=... must not be tailscale/tailscale" && exit 1)
|
|
|
|
@test "${REPO}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1)
|
|
|
|
@test "${REPO}" != "tailscale/k8s-operator" || (echo "REPO=... must not be tailscale/k8s-operator" && exit 1)
|
|
|
|
@test "${REPO}" != "ghcr.io/tailscale/k8s-operator" || (echo "REPO=... must not be ghcr.io/tailscale/k8s-operator" && exit 1)
|
2024-01-10 19:19:20 +00:00
|
|
|
TAGS="${TAGS}" REPOS=${REPO} PLATFORM=${PLATFORM} PUSH=true TARGET=operator ./build_docker.sh
|
2023-02-16 22:35:54 +00:00
|
|
|
|
2024-04-30 20:18:23 +01:00
|
|
|
publishdevnameserver: ## Build and publish k8s-nameserver image to location specified by ${REPO}
|
|
|
|
@test -n "${REPO}" || (echo "REPO=... required; e.g. REPO=ghcr.io/${USER}/tailscale" && exit 1)
|
|
|
|
@test "${REPO}" != "tailscale/tailscale" || (echo "REPO=... must not be tailscale/tailscale" && exit 1)
|
|
|
|
@test "${REPO}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1)
|
|
|
|
@test "${REPO}" != "tailscale/k8s-nameserver" || (echo "REPO=... must not be tailscale/k8s-nameserver" && exit 1)
|
|
|
|
@test "${REPO}" != "ghcr.io/tailscale/k8s-nameserver" || (echo "REPO=... must not be ghcr.io/tailscale/k8s-nameserver" && exit 1)
|
|
|
|
TAGS="${TAGS}" REPOS=${REPO} PLATFORM=${PLATFORM} PUSH=true TARGET=k8s-nameserver ./build_docker.sh
|
|
|
|
|
2024-04-28 16:42:10 +01:00
|
|
|
.PHONY: sshintegrationtest
|
|
|
|
sshintegrationtest: ## Run the SSH integration tests in various Docker containers
|
|
|
|
@GOOS=linux GOARCH=amd64 go test -tags integrationtest -c ./ssh/tailssh -o ssh/tailssh/testcontainers/tailssh.test && \
|
|
|
|
GOOS=linux GOARCH=amd64 go build -o ssh/tailssh/testcontainers/tailscaled ./cmd/tailscaled && \
|
|
|
|
echo "Testing on ubuntu:focal" && docker build --build-arg="BASE=ubuntu:focal" -t ssh-ubuntu-focal ssh/tailssh/testcontainers && \
|
|
|
|
echo "Testing on ubuntu:jammy" && docker build --build-arg="BASE=ubuntu:jammy" -t ssh-ubuntu-jammy ssh/tailssh/testcontainers && \
|
|
|
|
echo "Testing on ubuntu:mantic" && docker build --build-arg="BASE=ubuntu:mantic" -t ssh-ubuntu-mantic ssh/tailssh/testcontainers && \
|
|
|
|
echo "Testing on ubuntu:noble" && docker build --build-arg="BASE=ubuntu:noble" -t ssh-ubuntu-noble ssh/tailssh/testcontainers && \
|
|
|
|
echo "Testing on fedora:38" && docker build --build-arg="BASE=dokken/fedora-38" -t ssh-fedora-38 ssh/tailssh/testcontainers && \
|
|
|
|
echo "Testing on fedora:39" && docker build --build-arg="BASE=dokken/fedora-39" -t ssh-fedora-39 ssh/tailssh/testcontainers && \
|
|
|
|
echo "Testing on fedora:40" && docker build --build-arg="BASE=dokken/fedora-40" -t ssh-fedora-40 ssh/tailssh/testcontainers
|
|
|
|
|
2023-02-16 22:35:54 +00:00
|
|
|
help: ## Show this help
|
|
|
|
@echo "\nSpecify a command. The choices are:\n"
|
|
|
|
@grep -hE '^[0-9a-zA-Z_-]+:.*?## .*$$' ${MAKEFILE_LIST} | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-20s\033[m %s\n", $$1, $$2}'
|
|
|
|
@echo ""
|
|
|
|
.PHONY: help
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := help
|