Documentation
¶
Overview ¶
Package buildassets represents a build asset JSON file that describes the output of a Go build. We use this file to update other repos (in particular Go Docker) to that build.
This file's structure is controlled by our team: not .NET Docker, Go, or the official golang image team. So, we can choose to reuse parts of other files' schema to keep it simple.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildAssets ¶
type BuildAssets struct {
// Branch that produced this build. This is not used for auto-update.
Branch string `json:"branch"`
// BuildID is a link to the build that produced these assets. It is not used for auto-update.
BuildID string `json:"buildId"`
// Version of the build, as 'major.minor.patch-revision'. Doesn't include version note (-fips).
Version string `json:"version"`
// Arches is the list of artifacts that was produced for this version, typically one per target
// os/architecture. The name "Arches" is shared with the versions.json format.
Arches []*dockerversions.Arch `json:"arches"`
// GoSrcURL is a URL pointing at a tar.gz archive of the pre-patched Go source code.
GoSrcURL string `json:"goSrcURL"`
}
BuildAssets is the root object of a build asset JSON file.
func (BuildAssets) GetDockerRepoTargetBranch ¶
func (b BuildAssets) GetDockerRepoTargetBranch() string
GetDockerRepoTargetBranch returns the Go Docker images repo branch that needs to be updated based on the branch of the Go repo that was built, or returns empty string if no branch needs to be updated.
func (BuildAssets) GetDockerRepoVersionsKey ¶
func (b BuildAssets) GetDockerRepoVersionsKey() string
GetDockerRepoVersionsKey gets the Docker Versions key that should be updated with new builds listed in this BuildAssets file.
func (BuildAssets) GetPreviousMinorDockerRepoVersionsKey ¶
func (b BuildAssets) GetPreviousMinorDockerRepoVersionsKey() (string, error)
GetPreviousMinorDockerRepoVersionsKey gets the Docker Versions key of the minor Go release before the one in b. This can be used to find the previous release's information when setting up Docker images for the next one.
func (BuildAssets) GoVersion ¶
func (b BuildAssets) GoVersion() *goversion.GoVersion
GoVersion parses Version in the format that Microsoft builds of Go use. The BuildAssets file doesn't include the Note (-fips), so this is added based on the branch.
type BuildResultsDirectoryInfo ¶
type BuildResultsDirectoryInfo struct {
// SourceDir is the path to the source code that was built. This is checked for files that
// indicate what version of Go was built.
SourceDir string
// ArtifactsDir is the path to the directory that contains the artifacts (.tar.gz, .zip,
// .sha256) that were built.
ArtifactsDir string
// DestinationURL is the URL where the assets will be uploaded, if this is an internal build
// that will be published somewhere. This lets us include the final URL in the build asset data
// so auto-update can pick it up easily.
DestinationURL string
// DestinationManifest is the path of a manifest file that lists where each artifact has been
// published to. Fails if a file doesn't match up. Causes DestinationURL to be ignored.
DestinationManifest string
// Branch is the Git branch this build was built with. In many cases it can be determined with
// Git commands, but this is not always possible (or reliable), so we pass it through as a
// simple arg.
Branch string
// BuildID uniquely identifies the CI pipeline build that produced this result. This allows devs
// to quickly trace back to the originating build if something goes wrong later on.
BuildID string
}
BuildResultsDirectoryInfo points to locations in the filesystem that contain a Go build from source, and includes extra information that helps make sense of the build results.
func (BuildResultsDirectoryInfo) CreateSummary ¶
func (b BuildResultsDirectoryInfo) CreateSummary() (*BuildAssets, error)
CreateSummary scans the paths/info from a BuildResultsDirectoryInfo to summarize the outputs of the build in a BuildAssets struct. The result can be used later to perform an auto-update.