env/linux-x86-fedora: add Fedora builder

Not using a Fedora kernel yet, but better than nothing.

Updates golang/go#26796

Change-Id: I228442bf6606696407a8d3fbd098df59df7353e1
Reviewed-on: https://go-review.googlesource.com/c/build/+/175999
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/cmd/xb/xb.go b/cmd/xb/xb.go
index 48009dd..07e2443 100644
--- a/cmd/xb/xb.go
+++ b/cmd/xb/xb.go
@@ -116,7 +116,9 @@
 		}
 		layers := fromLayers(file)
 		for _, layer := range layers {
-			if strings.HasPrefix(layer, "golang:") || strings.HasPrefix(layer, "debian:") {
+			if strings.HasPrefix(layer, "golang:") ||
+				strings.HasPrefix(layer, "debian:") ||
+				strings.HasPrefix(layer, "fedora:") {
 				continue
 			}
 			switch layer {
diff --git a/dashboard/builders.go b/dashboard/builders.go
index 9a2ec38..838da93 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -113,6 +113,12 @@
 		buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
 		env:             []string{"GOROOT_BOOTSTRAP=/go1.4"},
 	},
+	"host-linux-fedora": &HostConfig{
+		Notes:           "Fedora 30",
+		ContainerImage:  "linux-x86-fedora:latest",
+		buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
+		env:             []string{"GOROOT_BOOTSTRAP=/goboot"},
+	},
 	"host-linux-arm-scaleway": &HostConfig{
 		IsReverse:       true,
 		HermeticReverse: true,
@@ -1534,6 +1540,12 @@
 		Notes:     "Debian sid (unstable)",
 	})
 	addBuilder(BuildConfig{
+		Name:      "linux-amd64-fedora",
+		HostType:  "host-linux-fedora",
+		MaxAtOnce: 1,
+		Notes:     "Fedora",
+	})
+	addBuilder(BuildConfig{
 		Name:     "linux-amd64-androidemu",
 		HostType: "host-android-amd64-emu",
 		env: []string{
diff --git a/env/linux-x86-fedora/Dockerfile b/env/linux-x86-fedora/Dockerfile
new file mode 100644
index 0000000..bf1ea62
--- /dev/null
+++ b/env/linux-x86-fedora/Dockerfile
@@ -0,0 +1,36 @@
+# Copyright 2019 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 fedora:30
+MAINTAINER golang-dev <golang-dev@googlegroups.com>
+
+RUN yum -y update && yum -y install \
+    ca-certificates \
+    findutils \
+    gcc \
+    glibc-static \
+    patch \
+    strace \
+    which \
+    && true
+
+RUN mkdir -p /goboot-amd64 \
+	&& ( \
+		curl --silent https://storage.googleapis.com/golang/go1.12.5.linux-amd64.tar.gz | tar -C /goboot-amd64 -zxv \
+	) \
+	&& mv /goboot-amd64/go /goboot \
+	&& rm -rf /goboot-amd64 \
+	&& rm -rf /goboot/pkg/linux_amd64_race \
+		/goboot/api \
+		/goboot/blog \
+		/goboot/doc \
+		/goboot/misc \
+		/goboot/test \
+	&& find /goboot -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-fedora/Makefile b/env/linux-x86-fedora/Makefile
new file mode 120000
index 0000000..4742951
--- /dev/null
+++ b/env/linux-x86-fedora/Makefile
@@ -0,0 +1 @@
+../shared-makefile/Makefile
\ No newline at end of file