bootstrap

package
v0.0.0-...-9febfc8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExeId        = "exe"
	DepotToolsId = "depot-tools"
)

ID values for referring to the packages to be downloaded during bootstrapping

Variables

View Source
var (
	// PatchRejected indicates that some portion of a patch was rejected.
	PatchRejected = errors.BoolTag{Key: errors.NewTagKey("the patch could not be applied")}
	// SleepBeforeExiting indicates that the top-level code should sleep before returning
	// control to the calling process, with the duration of the sleep being the tag's value.
	SleepBeforeExiting = sleepBeforeExitingTag{Key: errors.NewTagKey("the properties file does not exist in the dependency project")}
)
View Source
var File_go_chromium_org_infra_chromium_bootstrapper_bootstrap_bootstrap_proto protoreflect.FileDescriptor
View Source
var File_go_chromium_org_infra_chromium_bootstrapper_bootstrap_chromium_bootstrap_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type BootstrapConfig

type BootstrapConfig struct {
	// contains filtered or unexported fields
}

func (*BootstrapConfig) UpdateBuild

func (c *BootstrapConfig) UpdateBuild(build *buildbucketpb.Build, bootstrappedExe *BootstrappedExe) error

UpdateBuild updates the build proto to use as input for the bootstrapped executable.

The build's properties will be combined from multiple sources, with earlier source in the list taking priority:

  • Properties set/removed by led
  • The properties requested at the time the build is scheduled.
  • The $build/chromium_bootstrap property will be set with information about the bootstrapping process that the bootstrapped executable can use to ensure it operates in a manner that is consistent with the bootstrapping process. See chromium_bootstrap.proto for more information.
  • The properties read from the properties file identified by the config_project and properties_file fields of the build's $bootstrap/properties property.
  • The build's input properties with the $bootstrap/properties and $bootstrap/exe properties removed.

Additionally, if the build's input gitiles commit matches the project that the config was read from, the commit will be updated to refer to the same revision that the config came from.

type BootstrapExeProperties

type BootstrapExeProperties struct {

	// Required, the executable to bootstrap
	Exe *proto.Executable `protobuf:"bytes,1,opt,name=exe,proto3" json:"exe,omitempty"`
	// contains filtered or unexported fields
}

The input properties identifying the executable to bootstrap

Next ID: 2

func (*BootstrapExeProperties) Descriptor deprecated

func (*BootstrapExeProperties) Descriptor() ([]byte, []int)

Deprecated: Use BootstrapExeProperties.ProtoReflect.Descriptor instead.

func (*BootstrapExeProperties) GetExe

func (*BootstrapExeProperties) ProtoMessage

func (*BootstrapExeProperties) ProtoMessage()

func (*BootstrapExeProperties) ProtoReflect

func (x *BootstrapExeProperties) ProtoReflect() protoreflect.Message

func (*BootstrapExeProperties) Reset

func (x *BootstrapExeProperties) Reset()

func (*BootstrapExeProperties) String

func (x *BootstrapExeProperties) String() string

type BootstrapPropertiesProperties

type BootstrapPropertiesProperties struct {

	// Details to find the repo and revision containing the builder property
	// files, one of the fields MUST be set
	//
	// Types that are valid to be assigned to ConfigProject:
	//
	//	*BootstrapPropertiesProperties_TopLevelProject_
	//	*BootstrapPropertiesProperties_DependencyProject_
	ConfigProject isBootstrapPropertiesProperties_ConfigProject `protobuf_oneof:"config_project"`
	// Required, the path to the properties file, relative to the root of the
	// config repo
	PropertiesFile string `protobuf:"bytes,3,opt,name=properties_file,json=propertiesFile,proto3" json:"properties_file,omitempty"`
	// The path to the shadow properties file, relative to the root of the config
	// repo
	//
	// If this is set and the build is an led real build, then the properties will
	// be read from the shadow properties file and will override the values set by
	// the standard properties file. Any properties set in the build request
	// itself will still override these values.
	ShadowPropertiesFile string `protobuf:"bytes,4,opt,name=shadow_properties_file,json=shadowPropertiesFile,proto3" json:"shadow_properties_file,omitempty"`
	// contains filtered or unexported fields
}

The input properties identifying the location that the bootstrapped properties can be found

Next ID: 4

func (*BootstrapPropertiesProperties) Descriptor deprecated

func (*BootstrapPropertiesProperties) Descriptor() ([]byte, []int)

Deprecated: Use BootstrapPropertiesProperties.ProtoReflect.Descriptor instead.

func (*BootstrapPropertiesProperties) GetConfigProject

func (x *BootstrapPropertiesProperties) GetConfigProject() isBootstrapPropertiesProperties_ConfigProject

func (*BootstrapPropertiesProperties) GetDependencyProject

func (*BootstrapPropertiesProperties) GetPropertiesFile

func (x *BootstrapPropertiesProperties) GetPropertiesFile() string

func (*BootstrapPropertiesProperties) GetShadowPropertiesFile

func (x *BootstrapPropertiesProperties) GetShadowPropertiesFile() string

func (*BootstrapPropertiesProperties) GetTopLevelProject

func (*BootstrapPropertiesProperties) ProtoMessage

func (*BootstrapPropertiesProperties) ProtoMessage()

func (*BootstrapPropertiesProperties) ProtoReflect

func (*BootstrapPropertiesProperties) Reset

func (x *BootstrapPropertiesProperties) Reset()

func (*BootstrapPropertiesProperties) String

type BootstrapPropertiesProperties_DependencyProject

type BootstrapPropertiesProperties_DependencyProject struct {

	// Required, the gitiles repo that contains the DEPS file that will
	// determine the revision of the config repository to retrieve the builder
	// property files from
	TopLevelRepo *GitilesRepo `protobuf:"bytes,1,opt,name=top_level_repo,json=topLevelRepo,proto3" json:"top_level_repo,omitempty"`
	// Required, the ref of the top-level repository to get the DEPS file from
	//
	// If no gitiles input or gerrit change is present, this is the ref that the
	// DEPS file will be checked out from.
	//
	// If a gitiles input or gerrit change is present on the buildbucket build
	// proto, this ref will be ignored (this allows for the flexibility to run
	// trunk try builders against canary branches).
	TopLevelRef string `protobuf:"bytes,2,opt,name=top_level_ref,json=topLevelRef,proto3" json:"top_level_ref,omitempty"`
	// Required, the gitiles repo containing the builder property files
	ConfigRepo *GitilesRepo `protobuf:"bytes,3,opt,name=config_repo,json=configRepo,proto3" json:"config_repo,omitempty"`
	// Details to find the config repo, one of the fields MUST be set
	//
	// Types that are valid to be assigned to ConfigRepoLocator:
	//
	//	*BootstrapPropertiesProperties_DependencyProject_ConfigRepoPath
	//	*BootstrapPropertiesProperties_DependencyProject_ConfigRepoSubmodulePath
	ConfigRepoLocator isBootstrapPropertiesProperties_DependencyProject_ConfigRepoLocator `protobuf_oneof:"config_repo_locator"`
	// contains filtered or unexported fields
}

A project where the builder property files are retrieved from a repository whose revision is determined by the DEPS of another repository

Next ID: 7

func (*BootstrapPropertiesProperties_DependencyProject) Descriptor deprecated

Deprecated: Use BootstrapPropertiesProperties_DependencyProject.ProtoReflect.Descriptor instead.

func (*BootstrapPropertiesProperties_DependencyProject) GetConfigRepo

func (*BootstrapPropertiesProperties_DependencyProject) GetConfigRepoLocator

func (x *BootstrapPropertiesProperties_DependencyProject) GetConfigRepoLocator() isBootstrapPropertiesProperties_DependencyProject_ConfigRepoLocator

func (*BootstrapPropertiesProperties_DependencyProject) GetConfigRepoPath

func (*BootstrapPropertiesProperties_DependencyProject) GetConfigRepoSubmodulePath

func (x *BootstrapPropertiesProperties_DependencyProject) GetConfigRepoSubmodulePath() string

func (*BootstrapPropertiesProperties_DependencyProject) GetTopLevelRef

func (*BootstrapPropertiesProperties_DependencyProject) GetTopLevelRepo

func (*BootstrapPropertiesProperties_DependencyProject) ProtoMessage

func (*BootstrapPropertiesProperties_DependencyProject) ProtoReflect

func (*BootstrapPropertiesProperties_DependencyProject) Reset

func (*BootstrapPropertiesProperties_DependencyProject) String

type BootstrapPropertiesProperties_DependencyProject_

type BootstrapPropertiesProperties_DependencyProject_ struct {
	DependencyProject *BootstrapPropertiesProperties_DependencyProject `protobuf:"bytes,2,opt,name=dependency_project,json=dependencyProject,proto3,oneof"`
}

type BootstrapPropertiesProperties_DependencyProject_ConfigRepoPath

type BootstrapPropertiesProperties_DependencyProject_ConfigRepoPath struct {
	// The path that the config repository is checked out to by gclient (a key
	// into the deps dict in the DEPS file)
	ConfigRepoPath string `protobuf:"bytes,4,opt,name=config_repo_path,json=configRepoPath,proto3,oneof"`
}

type BootstrapPropertiesProperties_DependencyProject_ConfigRepoSubmodulePath

type BootstrapPropertiesProperties_DependencyProject_ConfigRepoSubmodulePath struct {
	// The path to the submodule within the top-level repo that refers to the
	// config repo
	ConfigRepoSubmodulePath string `protobuf:"bytes,6,opt,name=config_repo_submodule_path,json=configRepoSubmodulePath,proto3,oneof"`
}

type BootstrapPropertiesProperties_TopLevelProject

type BootstrapPropertiesProperties_TopLevelProject struct {

	// Required, the gitiles URL of the repository containing the builder
	// property files
	Repo *GitilesRepo `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
	// Required, the ref of the repository to find the property files on
	//
	// If no gitiles input or gerrit change is present on the buildbucket build
	// proto, this is the ref that the builder property files will be retrieved
	// from.
	//
	// If a gitiles input or gerrit change is present on the buildbucket build
	// proto, this ref will be ignored (this allows for the flexibility to run
	// trunk try builders against canary branches).
	Ref string `protobuf:"bytes,2,opt,name=ref,proto3" json:"ref,omitempty"`
	// contains filtered or unexported fields
}

A project where the builder property files are retrieved from a specified repository

func (*BootstrapPropertiesProperties_TopLevelProject) Descriptor deprecated

Deprecated: Use BootstrapPropertiesProperties_TopLevelProject.ProtoReflect.Descriptor instead.

func (*BootstrapPropertiesProperties_TopLevelProject) GetRef

func (*BootstrapPropertiesProperties_TopLevelProject) GetRepo

func (*BootstrapPropertiesProperties_TopLevelProject) ProtoMessage

func (*BootstrapPropertiesProperties_TopLevelProject) ProtoReflect

func (*BootstrapPropertiesProperties_TopLevelProject) Reset

func (*BootstrapPropertiesProperties_TopLevelProject) String

type BootstrapPropertiesProperties_TopLevelProject_

type BootstrapPropertiesProperties_TopLevelProject_ struct {
	TopLevelProject *BootstrapPropertiesProperties_TopLevelProject `protobuf:"bytes,1,opt,name=top_level_project,json=topLevelProject,proto3,oneof"`
}

type BootstrapTriggerProperties

type BootstrapTriggerProperties struct {

	// Commits to search when looking for the properties file
	//
	// When a bootstrapped builder triggers another builder with the expectation
	// that it will check out the same version of source, this can transmit the
	// commits that the bootstrapper used to find the properties file so that if
	// the triggered builder is also bootstrapped it loads properties from the
	// same revision. When needing to download a file from gitiles for a given
	// host and project, it will search for a commit first in the build proto and
	// then search this list in order. If a commit that matches the host and
	// project is found, then the file will be downloaded from the ref or ID of
	// the matching commit.
	Commits []*proto.GitilesCommit `protobuf:"bytes,1,rep,name=commits,proto3" json:"commits,omitempty"`
	// contains filtered or unexported fields
}

Optional input properties specifying per-trigger values.

Next ID: 2

func (*BootstrapTriggerProperties) Descriptor deprecated

func (*BootstrapTriggerProperties) Descriptor() ([]byte, []int)

Deprecated: Use BootstrapTriggerProperties.ProtoReflect.Descriptor instead.

func (*BootstrapTriggerProperties) GetCommits

func (x *BootstrapTriggerProperties) GetCommits() []*proto.GitilesCommit

func (*BootstrapTriggerProperties) ProtoMessage

func (*BootstrapTriggerProperties) ProtoMessage()

func (*BootstrapTriggerProperties) ProtoReflect

func (*BootstrapTriggerProperties) Reset

func (x *BootstrapTriggerProperties) Reset()

func (*BootstrapTriggerProperties) String

func (x *BootstrapTriggerProperties) String() string

type BootstrappedExe

type BootstrappedExe struct {

	// The location that the bootstrapped executable is retrieved from.
	//
	// Types that are valid to be assigned to Source:
	//
	//	*BootstrappedExe_Cipd
	//	*BootstrappedExe_Cas
	Source isBootstrappedExe_Source `protobuf_oneof:"source"`
	Cmd    []string                 `protobuf:"bytes,3,rep,name=cmd,proto3" json:"cmd,omitempty"`
	// contains filtered or unexported fields
}

Information about the executable being bootstrapped.

Next ID: 4

func DownloadPackages

func DownloadPackages(ctx context.Context, input *Input, packagesRoot string, packageChannels map[string]chan<- string) (*BootstrappedExe, []string, error)

DownloadPackages downloads the software packages necessary for bootstrapping the build.

The package for the bootstrapped executable will be downloaded from CIPD, unless the input indicates that there is a CAS bundle. If the bootstrapped build uses a configuration for a dependent project, the depot_tools package will additionally be downloaded from CIPD to provide access to gclient. All packages will be downloaded to directories located under packagesRoot. The packageChannels argument allows for the caller to be notified when packages besides the executable have been downloaded. It is a map of a package ID to a buffered channel. When the corresponding package has been downloaded, the channel will receive the path to the package.

If there is no error, a protobuf message indicating the source of the bootstrapped executable and the command used to execute the executable will be returned with a nil error. In the case of an error, the protobuf message and command will both be nil and the error will be non-nil.

func (*BootstrappedExe) Descriptor deprecated

func (*BootstrappedExe) Descriptor() ([]byte, []int)

Deprecated: Use BootstrappedExe.ProtoReflect.Descriptor instead.

func (*BootstrappedExe) GetCas

func (x *BootstrappedExe) GetCas() *api_v2.CASReference

func (*BootstrappedExe) GetCipd

func (x *BootstrappedExe) GetCipd() *Cipd

func (*BootstrappedExe) GetCmd

func (x *BootstrappedExe) GetCmd() []string

func (*BootstrappedExe) GetSource

func (x *BootstrappedExe) GetSource() isBootstrappedExe_Source

func (*BootstrappedExe) ProtoMessage

func (*BootstrappedExe) ProtoMessage()

func (*BootstrappedExe) ProtoReflect

func (x *BootstrappedExe) ProtoReflect() protoreflect.Message

func (*BootstrappedExe) Reset

func (x *BootstrappedExe) Reset()

func (*BootstrappedExe) String

func (x *BootstrappedExe) String() string

type BootstrappedExe_Cas

type BootstrappedExe_Cas struct {
	Cas *api_v2.CASReference `protobuf:"bytes,2,opt,name=cas,proto3,oneof"`
}

type BootstrappedExe_Cipd

type BootstrappedExe_Cipd struct {
	Cipd *Cipd `protobuf:"bytes,1,opt,name=cipd,proto3,oneof"`
}

type BuildBootstrapper

type BuildBootstrapper struct {
	// contains filtered or unexported fields
}

BuildBootstrapper provides the functionality for computing the build that the bootstrapped executable receives as input.

func NewBuildBootstrapper

func NewBuildBootstrapper(gitiles *gitiles.Client, gerrit *gerrit.Client, gclientGetter GclientGetter) *BuildBootstrapper

func (*BuildBootstrapper) GetBootstrapConfig

func (b *BuildBootstrapper) GetBootstrapConfig(ctx context.Context, input *Input) (*BootstrapConfig, error)

GetBootstrapConfig does the necessary work to extract the properties from the appropriate version of the properties file.

type ChromiumBootstrapModuleProperties

type ChromiumBootstrapModuleProperties struct {

	// Any commits that were accessed by the bootstrapper binary
	//
	// Since the properties should be versioned along with the code, this will
	// enable the bootstrapped executable to check out the same version of the
	// code that the properties were retrieved from.
	Commits []*proto.GitilesCommit `protobuf:"bytes,1,rep,name=commits,proto3" json:"commits,omitempty"`
	// Any reasons that the bootstrapped builder should skip analysis
	//
	// Some builders will use analyze to determine what targets need to be
	// re-built and what tests need to be re-run. If reasons are specified, the
	// builder should skip performing analysis and instead build all targets and
	// run all tests.
	SkipAnalysisReasons []string `protobuf:"bytes,2,rep,name=skip_analysis_reasons,json=skipAnalysisReasons,proto3" json:"skip_analysis_reasons,omitempty"`
	// The bootstrapped executable being executed.
	//
	// This will allow the builder to report the source of the executable.
	Exe *BootstrappedExe `protobuf:"bytes,3,opt,name=exe,proto3" json:"exe,omitempty"`
	// The information about where the bootstrapped config was loaded
	ConfigSource *ConfigSource `protobuf:"bytes,4,opt,name=config_source,json=configSource,proto3" json:"config_source,omitempty"`
	// contains filtered or unexported fields
}

The input properties consumed by the chromium_bootstrap recipe module

These will be set by the bootstrapper binary to communicate information about the bootstrap operation that occurred. This enables the bootstrapped executable to operate in a manner consistent with the bootstrapping process.

Next ID: 5

func (*ChromiumBootstrapModuleProperties) Descriptor deprecated

func (*ChromiumBootstrapModuleProperties) Descriptor() ([]byte, []int)

Deprecated: Use ChromiumBootstrapModuleProperties.ProtoReflect.Descriptor instead.

func (*ChromiumBootstrapModuleProperties) GetCommits

func (*ChromiumBootstrapModuleProperties) GetConfigSource

func (x *ChromiumBootstrapModuleProperties) GetConfigSource() *ConfigSource

func (*ChromiumBootstrapModuleProperties) GetExe

func (*ChromiumBootstrapModuleProperties) GetSkipAnalysisReasons

func (x *ChromiumBootstrapModuleProperties) GetSkipAnalysisReasons() []string

func (*ChromiumBootstrapModuleProperties) ProtoMessage

func (*ChromiumBootstrapModuleProperties) ProtoMessage()

func (*ChromiumBootstrapModuleProperties) ProtoReflect

func (*ChromiumBootstrapModuleProperties) Reset

func (*ChromiumBootstrapModuleProperties) String

type Cipd

type Cipd struct {
	Server           string `protobuf:"bytes,1,opt,name=server,proto3" json:"server,omitempty"`
	Package          string `protobuf:"bytes,2,opt,name=package,proto3" json:"package,omitempty"`
	RequestedVersion string `protobuf:"bytes,3,opt,name=requested_version,json=requestedVersion,proto3" json:"requested_version,omitempty"`
	ActualVersion    string `protobuf:"bytes,4,opt,name=actual_version,json=actualVersion,proto3" json:"actual_version,omitempty"`
	// contains filtered or unexported fields
}

A CIPD location.

Next ID: 5

func (*Cipd) Descriptor deprecated

func (*Cipd) Descriptor() ([]byte, []int)

Deprecated: Use Cipd.ProtoReflect.Descriptor instead.

func (*Cipd) GetActualVersion

func (x *Cipd) GetActualVersion() string

func (*Cipd) GetPackage

func (x *Cipd) GetPackage() string

func (*Cipd) GetRequestedVersion

func (x *Cipd) GetRequestedVersion() string

func (*Cipd) GetServer

func (x *Cipd) GetServer() string

func (*Cipd) ProtoMessage

func (*Cipd) ProtoMessage()

func (*Cipd) ProtoReflect

func (x *Cipd) ProtoReflect() protoreflect.Message

func (*Cipd) Reset

func (x *Cipd) Reset()

func (*Cipd) String

func (x *Cipd) String() string

type ConfigSource

type ConfigSource struct {

	// The commit at which the config was last changed
	//
	// This will enable the bootstrapped executable to apply the
	// optimization to not perform a checkout so long as the version of
	// the config on disk is the same version as was loaded by the
	// bootstrapper.
	LastChangedCommit *proto.GitilesCommit `protobuf:"bytes,1,opt,name=last_changed_commit,json=lastChangedCommit,proto3" json:"last_changed_commit,omitempty"`
	// The path to the config
	Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	// contains filtered or unexported fields
}

Information about from where the config was loaded

Next ID: 3

func (*ConfigSource) Descriptor deprecated

func (*ConfigSource) Descriptor() ([]byte, []int)

Deprecated: Use ConfigSource.ProtoReflect.Descriptor instead.

func (*ConfigSource) GetLastChangedCommit

func (x *ConfigSource) GetLastChangedCommit() *proto.GitilesCommit

func (*ConfigSource) GetPath

func (x *ConfigSource) GetPath() string

func (*ConfigSource) ProtoMessage

func (*ConfigSource) ProtoMessage()

func (*ConfigSource) ProtoReflect

func (x *ConfigSource) ProtoReflect() protoreflect.Message

func (*ConfigSource) Reset

func (x *ConfigSource) Reset()

func (*ConfigSource) String

func (x *ConfigSource) String() string

type GclientGetter

type GclientGetter func(ctx context.Context) (*gclient.Client, error)

type GitilesRepo

type GitilesRepo struct {

	// Required, the gitiles host containing the repository
	Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	// Required, the name of the repo on the host
	Project string `protobuf:"bytes,2,opt,name=project,proto3" json:"project,omitempty"`
	// contains filtered or unexported fields
}

A reference to a gitiles repository that will be accessed as part of the bootstrap process

func (*GitilesRepo) Descriptor deprecated

func (*GitilesRepo) Descriptor() ([]byte, []int)

Deprecated: Use GitilesRepo.ProtoReflect.Descriptor instead.

func (*GitilesRepo) GetHost

func (x *GitilesRepo) GetHost() string

func (*GitilesRepo) GetProject

func (x *GitilesRepo) GetProject() string

func (*GitilesRepo) ProtoMessage

func (*GitilesRepo) ProtoMessage()

func (*GitilesRepo) ProtoReflect

func (x *GitilesRepo) ProtoReflect() protoreflect.Message

func (*GitilesRepo) Reset

func (x *GitilesRepo) Reset()

func (*GitilesRepo) String

func (x *GitilesRepo) String() string

type Input

type Input struct {
	// contains filtered or unexported fields
}

Input provides the relevant details from the build input to the operations that prepare a bootstrapped executable to run. It is safe to share a single instance between multiple operations that take Input.

type InputOptions

type InputOptions struct {
	// Polymorphic changes the bootstrapper's behavior to support polymorphic builders: builders
	// that bootstrap properties for other builders. Polymorphic builders will prefer the
	// build's properties over the properties in the properties file with the expectation that
	// any properties that the polymorphic builder is setting its definition are required for
	// proper operation of the builder (e.g. recipe).
	Polymorphic bool
	// PropertiesOptional changes the bootstrapper's behavior to not fail if
	// the $bootstrap/properties property is not set or if the identified
	// file does not exist at the revision being bootstrapped.
	PropertiesOptional bool
}

InputOptions provides options that are inputs to the bootstrapping process.

func (InputOptions) NewInput

func (o InputOptions) NewInput(build *buildbucketpb.Build) (*Input, error)

NewInput creates a new Input, returning an error if build input fails validation.

The build input can fail to validate for the following reasons:

  • The $bootstrap/properties property is not set and o.PropertiesOptional is false.
  • The $bootstrap/properties is set, but does not contain a valid BootstrapPropertiesProperties message.
  • The $bootstrap/exe property is not set.
  • The $bootstrap/exe property is set, but does not contain a valid BootstrapExeProperties message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL