Makefile: add a target for doing dev builds of the k8s operator.

Updates #502.

Signed-off-by: David Anderson <danderson@tailscale.com>
pull/6724/head
David Anderson 2 years ago committed by Dave Anderson
parent 9c77205ba1
commit d81a2b2ce2

@ -62,4 +62,14 @@ publishdevimage:
@test -n "${REPO}" || (echo "REPO=... required; e.g. REPO=ghcr.io/${USER}/tailscale" && exit 1) @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}" != "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}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1)
TAGS=latest REPOS=${REPO} PUSH=true ./build_docker.sh @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)
TAGS=latest REPOS=${REPO} PUSH=true TARGET=client ./build_docker.sh
publishdevoperator:
@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)
TAGS=latest REPOS=${REPO} PUSH=true TARGET=operator ./build_docker.sh

@ -26,23 +26,46 @@ eval $(./build_dist.sh shellvars)
DEFAULT_TAGS="v${VERSION_SHORT},v${VERSION_MINOR}" DEFAULT_TAGS="v${VERSION_SHORT},v${VERSION_MINOR}"
DEFAULT_REPOS="tailscale/tailscale,ghcr.io/tailscale/tailscale" DEFAULT_REPOS="tailscale/tailscale,ghcr.io/tailscale/tailscale"
DEFAULT_BASE="ghcr.io/tailscale/alpine-base:3.16" DEFAULT_BASE="ghcr.io/tailscale/alpine-base:3.16"
DEFAULT_TARGET="client"
PUSH="${PUSH:-false}" PUSH="${PUSH:-false}"
REPOS="${REPOS:-${DEFAULT_REPOS}}" REPOS="${REPOS:-${DEFAULT_REPOS}}"
TAGS="${TAGS:-${DEFAULT_TAGS}}" TAGS="${TAGS:-${DEFAULT_TAGS}}"
BASE="${BASE:-${DEFAULT_BASE}}" BASE="${BASE:-${DEFAULT_BASE}}"
TARGET="${TARGET:-${DEFAULT_TARGET}}"
go run github.com/tailscale/mkctr \ case "$TARGET" in
--gopaths="\ client)
tailscale.com/cmd/tailscale:/usr/local/bin/tailscale, \ go run github.com/tailscale/mkctr \
tailscale.com/cmd/tailscaled:/usr/local/bin/tailscaled, \ --gopaths="\
tailscale.com/cmd/containerboot:/usr/local/bin/containerboot" \ tailscale.com/cmd/tailscale:/usr/local/bin/tailscale, \
--ldflags="\ tailscale.com/cmd/tailscaled:/usr/local/bin/tailscaled, \
-X tailscale.com/version.Long=${VERSION_LONG} \ tailscale.com/cmd/containerboot:/usr/local/bin/containerboot" \
-X tailscale.com/version.Short=${VERSION_SHORT} \ --ldflags="\
-X tailscale.com/version.GitCommit=${VERSION_GIT_HASH}" \ -X tailscale.com/version.Long=${VERSION_LONG} \
--base="${BASE}" \ -X tailscale.com/version.Short=${VERSION_SHORT} \
--tags="${TAGS}" \ -X tailscale.com/version.GitCommit=${VERSION_GIT_HASH}" \
--repos="${REPOS}" \ --base="${BASE}" \
--push="${PUSH}" \ --tags="${TAGS}" \
/usr/local/bin/containerboot --repos="${REPOS}" \
--push="${PUSH}" \
/usr/local/bin/containerboot
;;
operator)
go run github.com/tailscale/mkctr \
--gopaths="tailscale.com/cmd/k8s-operator:/usr/local/bin/operator" \
--ldflags="\
-X tailscale.com/version.Long=${VERSION_LONG} \
-X tailscale.com/version.Short=${VERSION_SHORT} \
-X tailscale.com/version.GitCommit=${VERSION_GIT_HASH}" \
--base="${BASE}" \
--tags="${TAGS}" \
--repos="${REPOS}" \
--push="${PUSH}" \
/usr/local/bin/operator
;;
*)
echo "unknown target: $TARGET"
exit 1
;;
esac
Loading…
Cancel
Save