build: golang.org/x/build/buildenv Index | Files

package buildenv

import "golang.org/x/build/buildenv"

Package buildenv contains definitions for the environments the Go build system can run in.

Index

Package Files

envs.go

Variables

var Development = &Environment{
    IsProd:   false,
    StaticIP: "127.0.0.1",
}
var Production = &Environment{
    ProjectName:  "symbolic-datum-552",
    IsProd:       true,
    Zone:         "us-central1-f",
    ZonesToClean: []string{"us-central1-f"},
    StaticIP:     "107.178.219.46",
    MachineType:  "n1-standard-4",
    KubeBuild: KubeConfig{
        MinNodes:    5,
        MaxNodes:    5,
        Name:        "buildlets",
        MachineType: "n1-standard-32",
    },
    KubeTools: KubeConfig{
        MinNodes:    3,
        MaxNodes:    3,
        Name:        "go",
        MachineType: "n1-standard-4",
    },
    DashURL:             "https://build.golang.org/",
    PerfDataURL:         "https://perfdata.golang.org",
    CoordinatorURL:      "https://storage.googleapis.com/go-builder-data/coordinator",
    CoordinatorName:     "farmer",
    BuildletBucket:      "go-builder-data",
    LogBucket:           "go-build-log",
    SnapBucket:          "go-build-snap",
    AutoCertCacheBucket: "farmer-golang-org-autocert-cache",
}

Production defines the environment that the coordinator and build infrastructure is deployed to for production usage at build.golang.org.

var Staging = &Environment{
    ProjectName:  "go-dashboard-dev",
    IsProd:       true,
    Zone:         "us-central1-f",
    ZonesToClean: []string{"us-central1-a", "us-central1-b", "us-central1-f"},
    StaticIP:     "104.154.113.235",
    MachineType:  "n1-standard-1",
    KubeBuild: KubeConfig{
        MinNodes:    1,
        MaxNodes:    2,
        Name:        "buildlets",
        MachineType: "n1-standard-8",
    },
    KubeTools: KubeConfig{
        MinNodes:    3,
        MaxNodes:    3,
        Name:        "go",
        MachineType: "n1-standard-4",
    },
    DashURL:         "https://go-dashboard-dev.appspot.com/",
    PerfDataURL:     "https://perfdata.golang.org",
    CoordinatorURL:  "https://storage.googleapis.com/dev-go-builder-data/coordinator",
    CoordinatorName: "farmer",
    BuildletBucket:  "dev-go-builder-data",
    LogBucket:       "dev-go-build-log",
    SnapBucket:      "dev-go-build-snap",
}

Staging defines the environment that the coordinator and build infrastructure is deployed to before it is released to production. For local dev, override the project with the program's flag to set a custom project.

func RegisterFlags Uses

func RegisterFlags()

RegisterFlags registers the "staging" flag. It is required if FromFlags is used.

type Environment Uses

type Environment struct {
    // The GCP project name that the build infrastructure will be provisioned in.
    // This field may be overridden as necessary without impacting other fields.
    ProjectName string

    // The IsProd flag indicates whether production functionality should be
    // enabled. When true, GCE and Kubernetes builders are enabled and the
    // coordinator serves on 443. Otherwise, GCE and Kubernetes builders are
    // disabled and the coordinator serves on 8119.
    IsProd bool

    // Zone is the GCE zone that the coordinator instance and Kubernetes cluster
    // will run in. This field may be overridden as necessary without impacting
    // other fields.
    Zone string

    // ZonesToClean are the GCE zones that will be periodically cleaned by
    // deleting old VMs. The zero value means that no cleaning will occur.
    // This field is optional.
    ZonesToClean []string

    // StaticIP is the public, static IP address that will be attached to the
    // coordinator instance. The zero value means the address will be looked
    // up by name. This field is optional.
    StaticIP string

    // MachineType is the GCE machine type to use for the coordinator.
    MachineType string

    // KubeBuild is the Kubernetes config for the buildlet cluster.
    KubeBuild KubeConfig
    // KubeTools is the Kubernetes config for the tools cluster.
    KubeTools KubeConfig

    // DashURL is the base URL of the build dashboard, ending in a slash.
    DashURL string

    // PerfDataURL is the base URL of the benchmark storage server.
    PerfDataURL string

    // CoordinatorURL is the location from which the coordinator
    // binary will be downloaded.
    // This is only used by cmd/coordinator/buildongce/create.go when
    // creating the coordinator VM from scratch.
    CoordinatorURL string

    // CoordinatorName is the hostname of the coordinator instance.
    CoordinatorName string

    // BuildletBucket is the GCS bucket that stores buildlet binaries.
    // TODO: rename. this is not just for buildlets; also for bootstrap.
    BuildletBucket string

    // LogBucket is the GCS bucket to which logs are written.
    LogBucket string

    // SnapBucket is the GCS bucket to which snapshots of
    // completed builds (after make.bash, before tests) are
    // written.
    SnapBucket string

    // MaxBuilds is the maximum number of concurrent builds that
    // can run. Zero means unlimit. This is typically only used
    // in a development or staging environment.
    MaxBuilds int

    // AutoCertCacheBucket is the GCS bucket to use for the
    // golang.org/x/crypto/acme/autocert (LetsEncrypt) cache.
    // If empty, LetsEncrypt isn't used.
    AutoCertCacheBucket string
}

Environment describes the configuration of the infrastructure for a coordinator and its buildlet resources running on Google Cloud Platform. Staging and Production are the two common build environments.

func ByProjectID Uses

func ByProjectID(projectID string) *Environment

ByProjectID returns an Environment for the specified project ID. It is currently limited to the symbolic-datum-552 and go-dashboard-dev projects. ByProjectID will panic if the project ID is not known.

func FromFlags Uses

func FromFlags() *Environment

FromFlags returns the build environment specified from flags. By default it returns the production environment.

func (Environment) ComputePrefix Uses

func (e Environment) ComputePrefix() string

ComputePrefix returns the URI prefix for Compute Engine resources in a project.

func (Environment) DashBase Uses

func (e Environment) DashBase() string

DashBase returns the base URL of the build dashboard, ending in a slash.

func (Environment) MachineTypeURI Uses

func (e Environment) MachineTypeURI() string

MachineTypeURI returns the URI for the environment's Machine Type.

func (Environment) Region Uses

func (e Environment) Region() string

Region returns the GCE region, derived from its zone.

func (Environment) SnapshotURL Uses

func (e Environment) SnapshotURL(builderType, rev string) string

SnapshotURL returns the absolute URL of the .tar.gz containing a built Go tree for the builderType and Go rev (40 character Git commit hash). The tarball is suitable for passing to (*buildlet.Client).PutTarFromURL.

type KubeConfig Uses

type KubeConfig struct {
    // MinNodes is the minimum number of nodes in the Kubernetes cluster.
    // The autoscaler will ensure that at least this many nodes is always
    // running despite any scale-down decision.
    MinNodes int64

    // MaxNodes is the maximum number of nodes that the autoscaler can
    // provision in the Kubernetes cluster.
    // If MaxNodes is 0, Kubernetes is not used.
    MaxNodes int64

    // MachineType is the GCE machine type to use for the Kubernetes cluster nodes.
    MachineType string

    // Name is the name of the Kubernetes cluster that will be created.
    Name string
}

KubeConfig describes the configuration of a Kubernetes cluster.

Package buildenv imports 3 packages (graph) and is imported by 13 packages. Updated 2017-12-17. Refresh now. Tools for package owners.