releasesteps

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DayState

type DayState struct {
	// ReleaseIssue is the ID of the release issue to supply with updates.
	ReleaseIssue int

	GoImagesCommit          string
	GoImagesOfficialBuildID string

	AnnouncementWritten bool
	MARVersionChecked   bool
}

DayState is the state of the "release day" not associated with a specific version.

type Input

type Input struct {
	// Versions is a list of versions to release.
	Versions []string

	// Security is true if any of the versions contains security fixes.
	Security bool

	// RunnerGitHubUser is the GitHub username of the dev in charge of this release. They are
	// @-tagged in the release issue if their input is required. This username is also be mapped to
	// a WordPress user for the release blog post.
	//
	// "ghost" is a special value that indicates nobody should be notified. It is a username that
	// GitHub has reserved as a placeholder.
	RunnerGitHubUser string

	// ReleaseConfigVariableGroup is the name of the AzDO variable group containing the release
	// configuration, mainly secrets. This is passed to child pipelines that need access.
	ReleaseConfigVariableGroup string

	// TargetRepo is microsoft/go, or a custom override for testing.
	TargetRepo     string
	TargetAzDORepo string

	TargetGoImagesRepo     string
	TargetAzDOGoImagesRepo string

	MicrosoftGoPipeline          int
	MicrosoftGoInnerloopPipeline int
	MicrosoftGoImagesPipeline    int
	MicrosoftGoAkaMSPipeline     int
	AzureLinuxCreatePRPipeline   int
}

Input is the collection of inputs for a given release that don't change. They are provided once by the release runner and stay the same upon retry.

type Secret

type Secret struct {
	GitHubPAT         string
	GitHubReviewerPAT string
	AzDOPAT           string
}

Secret is a collection of secrets necessary to perform the top-level actions in a release. These are intentionally not part of Input, as they may change if e.g. a secret is cycled while a release is paused and then needs to be resumed. (The Input checksum would make this difficult.)

type ServiceBundle

type ServiceBundle interface {
	CreateReleaseDayTrackingIssue(ctx context.Context, repo, runner string, versions []string, secret *Secret) (int, error)
	PollUpstreamTagCommit(ctx context.Context, version string) (string, error)
	CreateGitHubSyncPR(ctx context.Context, repo, branch string, secret *Secret) (int, error)
	PollMergedGitHubPRCommit(ctx context.Context, repo string, pr int, secret *Secret) (string, error)
	PollAzDOMirror(ctx context.Context, target, commit string, secret *Secret) error
	GetTargetBranch(ctx context.Context, version string) (string, error)
	TriggerBuildPipeline(ctx context.Context, pipelineID int, parameters, optionalParameters map[string]string, secret *Secret) (string, error)
	PollPipelineComplete(ctx context.Context, buildID string, secret *Secret) error
	DownloadPipelineArtifactToDir(ctx context.Context, buildID, artifactName string, secret *Secret) (string, error)
	VerifyAssetVersion(ctx context.Context, assetJSONPath string, version string) error
	CreateGitHubTag(ctx context.Context, version, repo, tag, commit string, secret *Secret) error
	CreateGitHubRelease(ctx context.Context, repo, tag, assetJSONPath, buildAssetDir string, secret *Secret) error
	CreateDockerImagesPR(ctx context.Context, repo, assetJSONPath, manualBranch string, secret *Secret) (int, error)
	PollImagesCommit(ctx context.Context, versions []string, secret *Secret) (string, error)
	CheckLatestMARGoVersion(ctx context.Context, versions []string) error
	CreateAnnouncementBlogFile(ctx context.Context, versions []string, user string, security bool, secret *Secret) error
}

ServiceBundle is all the ways the release steps can interact with the outside world. This can be mocked for testing.

If a method returns an error, other returned values must be zero. Retry logic depends on this.

type State

type State struct {
	// InputChecksum of the Input that started this release. This is used to ensure the
	// input hasn't unintentionally changed between retries. It isn't a security feature and isn't
	// stored beyond a single release process.
	//
	// The most likely mistake this is likely to detect is that the release runner, while trying to
	// start a retry, copies the state correctly, but presses the wrong "Run" button, causing the
	// wrong input to be filled in by AzDO.
	InputChecksum uint32

	// Day is the release day's state.
	Day DayState

	// Versions maps each entry from the Input.Versions slice to its state.
	Versions map[string]*VersionState
}

State is the state of a release, saved and restored between retries. In theory, the release runner might modify this if things go wrong.

func CreateStepGraph

func CreateStepGraph(ri *Input, secret *Secret, rs *State, sb ServiceBundle) ([]*coordinator.Step, *State, error)

CreateStepGraph creates the steps for a release of one or more versions of Microsoft Go. The returned step graph is not running.

If rs is nil, creates a new empty state that indicates no release work has been done yet. Otherwise, rs is used to resume an existing release. Returns rs or the new State so it can be used to resume a future release.

While any step is running, it may modify State, so it is not safe to access the returned State. When all steps are complete (success or fail), State can then be safely used.

Implementation note: this function should only contain coordination code (moving inputs/outputs between steps through the State and synchronizing). All work involving external resources should be done by calling methods on the ServiceBundle.

type VersionState

type VersionState struct {
	UpstreamCommit   string
	UpdatePR         int
	Commit           string
	OfficialBuildID  string
	InnerloopBuildID string

	ImageUpdatePR int
	ImagesUpdated bool

	GitHubTag     string
	GitHubRelease string

	AkaMSBuildID string
	AkaMSUpdated bool

	AzureLinuxUpdateBuildID string
	AzureLinuxPRSubmitted   bool
}

VersionState is the state of a single version's release.

Jump to

Keyboard shortcuts

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