mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
Add Tailscale unstable channel and repo HEAD to integration tests
In preparation for the implementation of the new TS2021 protocol (Tailscale control protocol v2) we are expanding the test infrastructure
This commit is contained in:
parent
1c9b1c0579
commit
749c92954c
5 changed files with 72 additions and 23 deletions
|
@ -1,11 +1,12 @@
|
||||||
FROM ubuntu:latest
|
FROM ubuntu:latest
|
||||||
|
|
||||||
ARG TAILSCALE_VERSION
|
ARG TAILSCALE_VERSION
|
||||||
|
ARG TAILSCALE_CHANNEL
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y gnupg curl \
|
&& apt-get install -y gnupg curl \
|
||||||
&& curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.gpg | apt-key add - \
|
&& curl -fsSL https://pkgs.tailscale.com/${TAILSCALE_CHANNEL}/ubuntu/focal.gpg | apt-key add - \
|
||||||
&& curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.list | tee /etc/apt/sources.list.d/tailscale.list \
|
&& curl -fsSL https://pkgs.tailscale.com/${TAILSCALE_CHANNEL}/ubuntu/focal.list | tee /etc/apt/sources.list.d/tailscale.list \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y ca-certificates tailscale=${TAILSCALE_VERSION} dnsutils \
|
&& apt-get install -y ca-certificates tailscale=${TAILSCALE_VERSION} dnsutils \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
21
Dockerfile.tailscale-HEAD
Normal file
21
Dockerfile.tailscale-HEAD
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
FROM golang:latest
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y ca-certificates dnsutils git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|
||||||
|
RUN git clone https://github.com/tailscale/tailscale.git
|
||||||
|
|
||||||
|
WORKDIR tailscale
|
||||||
|
|
||||||
|
RUN sh build_dist.sh tailscale.com/cmd/tailscale
|
||||||
|
RUN sh build_dist.sh tailscale.com/cmd/tailscaled
|
||||||
|
|
||||||
|
RUN cp tailscale /usr/local/
|
||||||
|
RUN cp tailscaled /usr/local/
|
||||||
|
|
||||||
|
ADD integration_test/etc_embedded_derp/tls/server.crt /usr/local/share/ca-certificates/
|
||||||
|
RUN chmod 644 /usr/local/share/ca-certificates/server.crt
|
||||||
|
|
||||||
|
RUN update-ca-certificates
|
|
@ -20,7 +20,7 @@ var (
|
||||||
IpPrefix4 = netaddr.MustParseIPPrefix("100.64.0.0/10")
|
IpPrefix4 = netaddr.MustParseIPPrefix("100.64.0.0/10")
|
||||||
IpPrefix6 = netaddr.MustParseIPPrefix("fd7a:115c:a1e0::/48")
|
IpPrefix6 = netaddr.MustParseIPPrefix("fd7a:115c:a1e0::/48")
|
||||||
|
|
||||||
tailscaleVersions = []string{"1.22.0", "1.20.4", "1.18.2", "1.16.2", "1.14.3", "1.12.3"}
|
tailscaleVersions = []string{"HEAD", "unstable", "1.22.0", "1.20.4", "1.18.2", "1.16.2", "1.14.3", "1.12.3"}
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestNamespace struct {
|
type TestNamespace struct {
|
||||||
|
@ -128,6 +128,49 @@ func DockerAllowNetworkAdministration(config *docker.HostConfig) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getDockerBuildOptions(version string) *dockertest.BuildOptions {
|
||||||
|
var tailscaleBuildOptions *dockertest.BuildOptions
|
||||||
|
switch version {
|
||||||
|
case "HEAD":
|
||||||
|
tailscaleBuildOptions = &dockertest.BuildOptions{
|
||||||
|
Dockerfile: "Dockerfile.tailscale-HEAD",
|
||||||
|
ContextDir: ".",
|
||||||
|
BuildArgs: []docker.BuildArg{},
|
||||||
|
}
|
||||||
|
case "unstable":
|
||||||
|
tailscaleBuildOptions = &dockertest.BuildOptions{
|
||||||
|
Dockerfile: "Dockerfile.tailscale",
|
||||||
|
ContextDir: ".",
|
||||||
|
BuildArgs: []docker.BuildArg{
|
||||||
|
{
|
||||||
|
Name: "TAILSCALE_VERSION",
|
||||||
|
Value: "*", // Installs the latest version https://askubuntu.com/a/824926
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "TAILSCALE_CHANNEL",
|
||||||
|
Value: "unstable",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
tailscaleBuildOptions = &dockertest.BuildOptions{
|
||||||
|
Dockerfile: "Dockerfile.tailscale",
|
||||||
|
ContextDir: ".",
|
||||||
|
BuildArgs: []docker.BuildArg{
|
||||||
|
{
|
||||||
|
Name: "TAILSCALE_VERSION",
|
||||||
|
Value: version,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "TAILSCALE_CHANNEL",
|
||||||
|
Value: "stable",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tailscaleBuildOptions
|
||||||
|
}
|
||||||
|
|
||||||
func getIPs(
|
func getIPs(
|
||||||
tailscales map[string]dockertest.Resource,
|
tailscales map[string]dockertest.Resource,
|
||||||
) (map[string][]netaddr.IP, error) {
|
) (map[string][]netaddr.IP, error) {
|
||||||
|
|
|
@ -245,16 +245,8 @@ func (s *IntegrationDERPTestSuite) Join(
|
||||||
|
|
||||||
func (s *IntegrationDERPTestSuite) tailscaleContainer(identifier, version string, network dockertest.Network,
|
func (s *IntegrationDERPTestSuite) tailscaleContainer(identifier, version string, network dockertest.Network,
|
||||||
) (string, *dockertest.Resource) {
|
) (string, *dockertest.Resource) {
|
||||||
tailscaleBuildOptions := &dockertest.BuildOptions{
|
tailscaleBuildOptions := getDockerBuildOptions(version)
|
||||||
Dockerfile: "Dockerfile.tailscale",
|
|
||||||
ContextDir: ".",
|
|
||||||
BuildArgs: []docker.BuildArg{
|
|
||||||
{
|
|
||||||
Name: "TAILSCALE_VERSION",
|
|
||||||
Value: version,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
hostname := fmt.Sprintf(
|
hostname := fmt.Sprintf(
|
||||||
"tailscale-%s-%s",
|
"tailscale-%s-%s",
|
||||||
strings.Replace(version, ".", "-", -1),
|
strings.Replace(version, ".", "-", -1),
|
||||||
|
|
|
@ -168,16 +168,8 @@ func (s *IntegrationTestSuite) Join(
|
||||||
func (s *IntegrationTestSuite) tailscaleContainer(
|
func (s *IntegrationTestSuite) tailscaleContainer(
|
||||||
namespace, identifier, version string,
|
namespace, identifier, version string,
|
||||||
) (string, *dockertest.Resource) {
|
) (string, *dockertest.Resource) {
|
||||||
tailscaleBuildOptions := &dockertest.BuildOptions{
|
tailscaleBuildOptions := getDockerBuildOptions(version)
|
||||||
Dockerfile: "Dockerfile.tailscale",
|
|
||||||
ContextDir: ".",
|
|
||||||
BuildArgs: []docker.BuildArg{
|
|
||||||
{
|
|
||||||
Name: "TAILSCALE_VERSION",
|
|
||||||
Value: version,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
hostname := fmt.Sprintf(
|
hostname := fmt.Sprintf(
|
||||||
"%s-tailscale-%s-%s",
|
"%s-tailscale-%s-%s",
|
||||||
namespace,
|
namespace,
|
||||||
|
|
Loading…
Reference in a new issue