env/linux-x86-bullseye, dashboard: add Debian Bullseye builder

This change adds the host-linux-bullseye host as well as the
configuration for the host. The linux-amd64-bullseye builder has been
added in this change as well.

Fixes golang/go#47720

Change-Id: I607f937133a0db3ed6a841f53dc7fef5e310a5a4
Reviewed-on: https://go-review.googlesource.com/c/build/+/342630
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
diff --git a/dashboard/builders.go b/dashboard/builders.go
index 004f78a..00172f6 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -108,6 +108,13 @@
 // Hosts contains the names and configs of all the types of
 // buildlets. They can be VMs, containers, or dedicated machines.
 var Hosts = map[string]*HostConfig{
+	"host-linux-bullseye": &HostConfig{
+		Notes:           "Debian Bullseye",
+		ContainerImage:  "linux-x86-bullseye:latest",
+		buildletURLTmpl: "https://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
+		env:             []string{"GOROOT_BOOTSTRAP=/go1.4"},
+		SSHUsername:     "root",
+	},
 	"host-linux-buster": &HostConfig{
 		Notes:           "Debian Buster",
 		ContainerImage:  "linux-x86-buster:latest",
@@ -1892,6 +1899,14 @@
 		},
 	})
 	addBuilder(BuildConfig{
+		Name:     "linux-amd64-bullseye",
+		HostType: "host-linux-bullseye",
+		Notes:    "Debian Bullseye.",
+		env: []string{
+			"GO_DISABLE_OUTBOUND_NETWORK=1",
+		},
+	})
+	addBuilder(BuildConfig{
 		Name:     "linux-amd64-buster",
 		HostType: "host-linux-buster",
 		Notes:    "Debian Buster.",
diff --git a/dashboard/builders_test.go b/dashboard/builders_test.go
index 9cf52e4..b53f324 100644
--- a/dashboard/builders_test.go
+++ b/dashboard/builders_test.go
@@ -569,6 +569,7 @@
 		{b("linux-amd64-fedora", "build"), none},
 		{b("linux-amd64-clang", "build"), none},
 		{b("linux-amd64-sid", "build"), none},
+		{b("linux-amd64-bullseye", "build"), none},
 		{b("linux-amd64-nocgo", "build"), none},
 		{b("linux-386-longtest", "build"), none},
 		{b("js-wasm", "build"), none},
diff --git a/env/linux-x86-bullseye/Dockerfile b/env/linux-x86-bullseye/Dockerfile
new file mode 100644
index 0000000..0f92a42
--- /dev/null
+++ b/env/linux-x86-bullseye/Dockerfile
@@ -0,0 +1,65 @@
+# Copyright 2021 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+FROM golang/buildlet-stage0 AS stage0
+
+FROM debian:bullseye
+MAINTAINER golang-dev <golang-dev@googlegroups.com>
+
+ENV DEBIAN_FRONTEND noninteractive
+
+# fonts-droid-fallback: required by x/mobile repo
+# gcc-multilib: for 32-bit builds
+# gcc: for building Go's bootstrap 'dist' prog
+# gdb: optionally used by runtime tests for gdb
+# gfortran: for compiling cgo with fortran support (multilib for 386)
+# libc6-dev-i386: for 32-bit builds
+# libc6-dev: for building Go's bootstrap 'dist' prog
+# libgles2-mesa-dev: required by x/mobile repo
+# libopenal-dev: required by x/mobile repo
+# lsof: misc basic tool
+# netbase: for net package tests, issue 42750
+# procps: misc basic tool
+# psmisc: misc basic tool
+# strace: optionally used by some net/http tests
+RUN apt-get update && apt-get install -y \
+	--no-install-recommends \
+	ca-certificates \
+	curl \
+	fonts-droid-fallback \
+	gcc \
+	gcc-multilib \
+	gdb \
+	gfortran \
+	gfortran-multilib \
+	iptables \
+	libc6-dev \
+	libc6-dev-i386 \
+	libgles2-mesa-dev \
+	libopenal-dev \
+	lsof \
+	netbase \
+	openssh-server \
+	procps \
+	psmisc \
+	strace \
+	&& rm -rf /var/lib/apt/lists/*
+
+RUN mkdir -p /go1.4-amd64 \
+	&& ( \
+		curl --silent https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz | tar -C /go1.4-amd64 -zxv \
+	) \
+	&& mv /go1.4-amd64/go /go1.4 \
+	&& rm -rf /go1.4-amd64 \
+	&& rm -rf /go1.4/pkg/linux_amd64_race \
+		/go1.4/api \
+		/go1.4/blog \
+		/go1.4/doc \
+		/go1.4/misc \
+		/go1.4/test \
+	&& find /go1.4 -type d -name testdata | xargs rm -rf
+
+COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
+
+CMD ["/usr/local/bin/stage0"]
diff --git a/env/linux-x86-bullseye/Makefile b/env/linux-x86-bullseye/Makefile
new file mode 120000
index 0000000..4742951
--- /dev/null
+++ b/env/linux-x86-bullseye/Makefile
@@ -0,0 +1 @@
+../shared-makefile/Makefile
\ No newline at end of file