Documentation ¶
Overview ¶
Package patch models an intent to patch test code in a particular state. It is distinct from a version because a version has tasks, whereas a patch merely represents an intent.
Index ¶
- Constants
- Variables
- func ByGithash(githash string) db.Q
- func ByGithubPRAndCreatedBefore(t time.Time, owner, repo string, prNumber int) db.Q
- func ById(id mgobson.ObjectId) db.Q
- func ByProjectAndCommitQueue(project string, filterCommitQueue bool) db.Q
- func ByStringId(id string) db.Q
- func ByStringIds(ids []string) db.Q
- func ByUserAndCommitQueue(user string, filterCommitQueue bool) db.Q
- func ByUserPaginated(user string, ts time.Time, limit int) db.Q
- func ByVersion(version string) db.Q
- func ByVersions(versions []string) db.Q
- func ConsolidatePatchesForUser(oldAuthor string, newUsr *user.DBUser) error
- func FetchPatchContents(patchfileID string) (string, error)
- func FindProjectForPatch(patchID mgobson.ObjectId) (string, error)
- func FindUnprocessedGithubIntents() ([]*githubIntent, error)
- func GetChildrenOrSiblingsReadiness(childrenOrSiblings []string) (string, error)
- func GetCollectiveStatusFromPatchStatuses(statuses []string) string
- func GetFinalizedChildPatchIdsForPatch(patchID string) ([]string, error)
- func GetGithubContextForChildPatch(projectIdentifier string, parentPatch, childPatch *Patch) (string, error)
- func IsMailbox(patchFile string) (bool, error)
- func IsMailboxDiff(patchDiff string) bool
- func IsPatchEmpty(id string) (bool, error)
- func IsValidId(id string) bool
- func MostRecentPatchByUserAndProject(user, project string) db.Q
- func NewId(id string) mgobson.ObjectId
- func PatchesByProject(projectId string, ts time.Time, limit int) db.Q
- func Remove(query db.Q) error
- func ResolveVariantTasks(vts []VariantTasks) (bvs []string, tasks []string)
- func TryMarkStarted(versionId string, startTime time.Time) error
- func UpdateAll(query interface{}, update interface{}) (info *adb.ChangeInfo, err error)
- func UpdateOne(query interface{}, update interface{}) error
- type BackportInfo
- type ByPatchNameStatusesCommitQueuePaginatedOptions
- type CLIIntentParams
- type DisplayTask
- type GitMetadata
- type Intent
- func FindIntent(id, intentType string) (Intent, error)
- func GetIntent(intentType string) (Intent, bool)
- func NewCliIntent(params CLIIntentParams) (Intent, error)
- func NewGithubIntent(msgDeliveryID, patchOwner, calledBy, alias, mergeBase string, ...) (Intent, error)
- func NewGithubMergeIntent(msgDeliveryID string, caller string, mg *github.MergeGroupEvent) (Intent, error)
- func NewTriggerIntent(opts TriggerIntentOptions) Intent
- type LocalModuleInclude
- type ModulePatch
- type Parameter
- type Patch
- func ByPatchNameStatusesCommitQueuePaginated(ctx context.Context, opts ByPatchNameStatusesCommitQueuePaginatedOptions) ([]Patch, int, error)
- func Find(query db.Q) ([]Patch, error)
- func FindFailedCommitQueuePatchesInTimeRange(projectID string, startTime, endTime time.Time) ([]Patch, error)
- func FindLatestGithubPRPatch(owner, repo string, prNumber int) (*Patch, error)
- func FindOne(query db.Q) (*Patch, error)
- func FindOneId(id string) (*Patch, error)
- func MakeNewMergePatch(pr *github.PullRequest, projectID, alias, commitTitle, commitMessage string) (*Patch, error)
- func (p *Patch) AddBuildVariants(bvs []string) error
- func (p *Patch) AddSyncVariantsTasks(vts []VariantTasks) error
- func (p *Patch) AddTasks(tasks []string) error
- func (p *Patch) ClearPatchData()
- func (p *Patch) CollectiveStatus() (string, error)
- func (p *Patch) ConfigChanged(remotePath string) bool
- func (p *Patch) FetchPatchFiles(useRaw bool) error
- func (p *Patch) FilesChanged() []string
- func (p *Patch) FindModule(moduleName string) *ModulePatch
- func (p *Patch) GetCommitQueueURL(uiHost string) string
- func (p *Patch) GetFamilyInformation() (bool, *Patch, error)
- func (p *Patch) GetPatchFamily() ([]string, *Patch, error)
- func (p *Patch) GetPatchIndex(parentPatch *Patch) (int, error)
- func (p *Patch) GetRequester() string
- func (p *Patch) GetURL(uiHost string) string
- func (p *Patch) HasValidGitInfo() bool
- func (p *Patch) Insert() error
- func (p *Patch) IsBackport() bool
- func (p *Patch) IsChild() bool
- func (p *Patch) IsCommitQueuePatch() bool
- func (p *Patch) IsFinished() bool
- func (p *Patch) IsGithubMergePatch() bool
- func (p *Patch) IsGithubPRPatch() bool
- func (p *Patch) IsPRMergePatch() bool
- func (p *Patch) IsParent() bool
- func (p *Patch) MakeBackportDescription() (string, error)
- func (p *Patch) MarkFinished(status string, finishTime time.Time) error
- func (p *Patch) MarshalBSON() ([]byte, error)
- func (p *Patch) RemoveModulePatch(moduleName string) error
- func (p *Patch) ResolveSyncVariantTasks(vts []VariantTasks) []VariantTasks
- func (p *Patch) SetActivation(activated bool) error
- func (p *Patch) SetChildPatches() error
- func (p *Patch) SetDescription(desc string) error
- func (p *Patch) SetDownstreamParameters(parameters []Parameter) error
- func (p *Patch) SetFinalized(ctx context.Context, versionId string) error
- func (p *Patch) SetMergePatch(newPatchID string) error
- func (p *Patch) SetParameters(parameters []Parameter) error
- func (p *Patch) SetParametersFromParent() (*Patch, error)
- func (p *Patch) SetPatchVisibility(hidden bool) error
- func (p *Patch) SetTriggerAliases() error
- func (p *Patch) SetVariantsTasks(variantsTasks []VariantTasks) error
- func (p *Patch) ShouldPatchFileWithDiff(path string) bool
- func (p *Patch) UnmarshalBSON(in []byte) error
- func (p *Patch) UpdateGithashProjectAndTasks() error
- func (p *Patch) UpdateMergeCommitSHA(sha string) error
- func (p *Patch) UpdateModulePatch(modulePatch ModulePatch) error
- func (p *Patch) UpdateRepeatPatchId(patchId string) error
- func (p *Patch) UpdateStatus(newStatus string) error
- func (p *Patch) UpdateVariantsTasks(variantsTasks []VariantTasks)
- type PatchSet
- type PatchTriggerDefinition
- type PatchesByCreateTime
- type SyncAtEndOptions
- type TaskSpecifier
- type TriggerInfo
- type TriggerIntent
- func (t *TriggerIntent) GetAlias() string
- func (t *TriggerIntent) GetCalledBy() string
- func (t *TriggerIntent) GetType() string
- func (t *TriggerIntent) ID() string
- func (t *TriggerIntent) Insert() error
- func (t *TriggerIntent) IsProcessed() bool
- func (t *TriggerIntent) NewPatch() *Patch
- func (g *TriggerIntent) RepeatFailedTasksAndVariants() (string, bool)
- func (t *TriggerIntent) RepeatPreviousPatchDefinition() (string, bool)
- func (t *TriggerIntent) RequesterIdentity() string
- func (t *TriggerIntent) SetProcessed() error
- func (t *TriggerIntent) ShouldFinalizePatch() bool
- type TriggerIntentOptions
- type VariantTasks
Constants ¶
const ( Collection = "patches" GridFSPrefix = "patchfiles" )
const ( // IntentCollection is the database collection that stores patch intents. IntentCollection = "patch_intents" // GithubIntentType represents patch intents created for GitHub. GithubIntentType = "github" )
const ( AutomatedCaller = "auto" ManualCaller = "manual" AllCallers = "" )
CalledBy can be either auto or manual.
const CliIntentType = "cli"
const (
// GithubMergeIntentType is an intent to create a version for a GitHub merge group.
GithubMergeIntentType = "github_merge"
)
const SizeLimit = 1024 * 1024 * 100
SizeLimit is a hard limit on patch size.
const TriggerIntentType = "trigger"
Variables ¶
var ( IdKey = bsonutil.MustHaveTag(Patch{}, "Id") DescriptionKey = bsonutil.MustHaveTag(Patch{}, "Description") ProjectKey = bsonutil.MustHaveTag(Patch{}, "Project") GithashKey = bsonutil.MustHaveTag(Patch{}, "Githash") AuthorKey = bsonutil.MustHaveTag(Patch{}, "Author") NumberKey = bsonutil.MustHaveTag(Patch{}, "PatchNumber") VersionKey = bsonutil.MustHaveTag(Patch{}, "Version") StatusKey = bsonutil.MustHaveTag(Patch{}, "Status") CreateTimeKey = bsonutil.MustHaveTag(Patch{}, "CreateTime") StartTimeKey = bsonutil.MustHaveTag(Patch{}, "StartTime") FinishTimeKey = bsonutil.MustHaveTag(Patch{}, "FinishTime") BuildVariantsKey = bsonutil.MustHaveTag(Patch{}, "BuildVariants") TasksKey = bsonutil.MustHaveTag(Patch{}, "Tasks") VariantsTasksKey = bsonutil.MustHaveTag(Patch{}, "VariantsTasks") SyncAtEndOptionsKey = bsonutil.MustHaveTag(Patch{}, "SyncAtEndOpts") PatchesKey = bsonutil.MustHaveTag(Patch{}, "Patches") ParametersKey = bsonutil.MustHaveTag(Patch{}, "Parameters") ActivatedKey = bsonutil.MustHaveTag(Patch{}, "Activated") ProjectStorageMethodKey = bsonutil.MustHaveTag(Patch{}, "ProjectStorageMethod") PatchedProjectConfigKey = bsonutil.MustHaveTag(Patch{}, "PatchedProjectConfig") AliasKey = bsonutil.MustHaveTag(Patch{}, "Alias") MergePatchKey = bsonutil.MustHaveTag(Patch{}, "MergePatch") TriggersKey = bsonutil.MustHaveTag(Patch{}, "Triggers") HiddenKey = bsonutil.MustHaveTag(Patch{}, "Hidden") // BSON fields for sync at end struct SyncAtEndOptionsBuildVariantsKey = bsonutil.MustHaveTag(SyncAtEndOptions{}, "BuildVariants") SyncAtEndOptionsTasksKey = bsonutil.MustHaveTag(SyncAtEndOptions{}, "Tasks") SyncAtEndOptionsVariantsTasksKey = bsonutil.MustHaveTag(SyncAtEndOptions{}, "VariantsTasks") SyncAtEndOptionsStatusesKey = bsonutil.MustHaveTag(SyncAtEndOptions{}, "Statuses") SyncAtEndOptionsTimeoutKey = bsonutil.MustHaveTag(SyncAtEndOptions{}, "Timeout") // BSON fields for the module patch struct ModulePatchNameKey = bsonutil.MustHaveTag(ModulePatch{}, "ModuleName") ModulePatchGithashKey = bsonutil.MustHaveTag(ModulePatch{}, "Githash") ModulePatchSetKey = bsonutil.MustHaveTag(ModulePatch{}, "PatchSet") // BSON fields for the patch set struct PatchSetPatchKey = bsonutil.MustHaveTag(PatchSet{}, "Patch") PatchSetSummaryKey = bsonutil.MustHaveTag(PatchSet{}, "Summary") // BSON fields for the patch trigger struct TriggerInfoAliasesKey = bsonutil.MustHaveTag(TriggerInfo{}, "Aliases") TriggerInfoParentPatchKey = bsonutil.MustHaveTag(TriggerInfo{}, "ParentPatch") TriggerInfoChildPatchesKey = bsonutil.MustHaveTag(TriggerInfo{}, "ChildPatches") TriggerInfoDownstreamParametersKey = bsonutil.MustHaveTag(TriggerInfo{}, "DownstreamParameters") )
BSON fields for the patches
var ExcludePatchDiff = bson.M{ bsonutil.GetDottedKeyName(PatchesKey, ModulePatchSetKey, PatchSetPatchKey): 0, }
ExcludePatchDiff is a projection that excludes diff data, helping load times.
Functions ¶
func ByGithubPRAndCreatedBefore ¶
ByGithubPRAndCreatedBefore finds all patches that were created for a GitHub PR before the given timestamp.
func ByProjectAndCommitQueue ¶
ByProject produces a query that returns projects with the given identifier.
func ByStringId ¶
func ByStringIds ¶
func ByUserAndCommitQueue ¶
ByUser produces a query that returns patches by the given user.
func ByUserPaginated ¶
ByUserPaginated produces a query that returns patches by the given user before/after the input time, sorted by creation time and limited
func ByVersions ¶
ByVersion produces a query that returns the patch for a given version.
func ConsolidatePatchesForUser ¶
ConsolidatePatchesForUser updates all patches authored by oldAuthor to be authored by newAuthor, and if any patches have been authored by the new author already, update the patch numbers to come after the new author.
func FetchPatchContents ¶
func FindUnprocessedGithubIntents ¶
func FindUnprocessedGithubIntents() ([]*githubIntent, error)
FindUnprocessedGithubIntents finds all patch intents that have not yet been processed.
func GetCollectiveStatusFromPatchStatuses ¶
GetCollectiveStatusFromPatchStatuses answers the question of what the patch status should be when the patch status and the status of its children are different, given a list of statuses.
func GetFinalizedChildPatchIdsForPatch ¶
GetFinalizedChildPatchIdsForPatch returns patchIds for any finalized children of the given patch.
func GetGithubContextForChildPatch ¶
func GetGithubContextForChildPatch(projectIdentifier string, parentPatch, childPatch *Patch) (string, error)
GetGithubContextForChildPatch returns the github context for the given child patch, to be used in github statuses.
func IsMailbox ¶
IsMailbox checks if the first line of a patch file has "From ". If so, it's assumed to be a mailbox-style patch, otherwise it's a diff
func IsMailboxDiff ¶
func IsPatchEmpty ¶
func MostRecentPatchByUserAndProject ¶
MostRecentPatchByUserAndProject returns the latest patch made by the user for the project.
func PatchesByProject ¶
PatchesByProject builds a query for patches that match the given project's id.
func ResolveVariantTasks ¶
func ResolveVariantTasks(vts []VariantTasks) (bvs []string, tasks []string)
ResolveVariantTasks returns a set of all build variants and a set of all tasks that will run based on the given VariantTasks, filtering out any duplicates.
func TryMarkStarted ¶
TryMarkStarted attempts to mark a patch as started if it isn't already marked as such
func UpdateAll ¶
func UpdateAll(query interface{}, update interface{}) (info *adb.ChangeInfo, err error)
UpdateAll runs an update on all patch documents.
Types ¶
type BackportInfo ¶
type CLIIntentParams ¶
type CLIIntentParams struct { User string Path string Project string BaseGitHash string Module string PatchContent string Description string Finalize bool BackportOf BackportInfo GitInfo *GitMetadata Parameters []Parameter Variants []string Tasks []string RegexVariants []string RegexTasks []string Alias string TriggerAliases []string RepeatDefinition bool RepeatFailed bool RepeatPatchId string SyncParams SyncAtEndOptions LocalModuleIncludes []LocalModuleInclude }
type DisplayTask ¶
type GitMetadata ¶
type Intent ¶
type Intent interface { // ID returns a unique identifier for the patch. Should // correspond to the _id for the patch in database. ID() string // Insert inserts a patch intent in the database. Insert() error // SetProcessed should be called by an amboy queue after creating a patch from an intent. SetProcessed() error // IsProcessed returns whether a patch exists for this intent. IsProcessed() bool // GetType returns the patch intent, e.g., GithubIntentType. GetType() string // NewPatch creates a patch from the intent NewPatch() *Patch // Finalize indicates whether or not the patch created from this // intent should be finalized ShouldFinalizePatch() bool // RepeatPreviousPatchDefinition returns true if we should use the same tasks/variants as a previous patch. // Returns patch ID if specified, otherwise we use the latest patch. RepeatPreviousPatchDefinition() (string, bool) // RepeatFailedTasksAndVariants returns true if we should use the failed tasks/variants from a previous patch. // Returns patch ID if specified, otherwise we use the latest patch. RepeatFailedTasksAndVariants() (string, bool) // GetAlias defines the variants and tasks this intent should run on. GetAlias() string // RequesterIdentity supplies a valid requester type, that is recorded // in patches, versions, builds, and tasks to denote the origin of the // patch RequesterIdentity() string // GetCalledBy indicates whether the intent was created automatically // by Evergreen or manually by the user. GetCalledBy() string }
Intent represents an intent to create a patch build and is processed by an amboy queue.
func FindIntent ¶
FindIntent returns an intent of the specified type from the database
func NewCliIntent ¶
func NewCliIntent(params CLIIntentParams) (Intent, error)
func NewGithubIntent ¶
func NewGithubIntent(msgDeliveryID, patchOwner, calledBy, alias, mergeBase string, pr *github.PullRequest) (Intent, error)
NewGithubIntent creates an Intent from a google/go-github PullRequestEvent, or returns an error if the some part of the struct is invalid
func NewGithubMergeIntent ¶
func NewGithubMergeIntent(msgDeliveryID string, caller string, mg *github.MergeGroupEvent) (Intent, error)
NewGithubIntent creates an Intent from a google/go-github MergeGroup.
func NewTriggerIntent ¶
func NewTriggerIntent(opts TriggerIntentOptions) Intent
type LocalModuleInclude ¶
type LocalModuleInclude struct { FileName string `yaml:"filename,omitempty" bson:"filename,omitempty" json:"filename,omitempty"` Module string `yaml:"module,omitempty" bson:"module,omitempty" json:"module,omitempty"` // FileContent is only used for local module includes for CLI patches FileContent []byte `yaml:"file_content,omitempty" bson:"file_content,omitempty" json:"file_content,omitempty"` }
type ModulePatch ¶
type ModulePatch struct { ModuleName string `bson:"name"` Githash string `bson:"githash"` PatchSet PatchSet `bson:"patch_set"` IsMbox bool `bson:"is_mbox"` }
ModulePatch stores request details for a patch
func MakeMergePatchPatches ¶
func MakeMergePatchPatches(existingPatch *Patch, commitMessage string) ([]ModulePatch, error)
type Parameter ¶
type Parameter struct { Key string `yaml:"key" bson:"key"` Value string `yaml:"value" bson:"value"` }
Parameter defines a key/value pair to be used as an expansion.
type Patch ¶
type Patch struct { Id mgobson.ObjectId `bson:"_id,omitempty"` Description string `bson:"desc"` Path string `bson:"path,omitempty"` Project string `bson:"branch"` Githash string `bson:"githash"` Hidden bool `bson:"hidden"` PatchNumber int `bson:"patch_number"` Author string `bson:"author"` Version string `bson:"version"` Status string `bson:"status"` CreateTime time.Time `bson:"create_time"` StartTime time.Time `bson:"start_time"` FinishTime time.Time `bson:"finish_time"` BuildVariants []string `bson:"build_variants"` RegexBuildVariants []string `bson:"regex_build_variants"` Tasks []string `bson:"tasks"` RegexTasks []string `bson:"regex_tasks"` VariantsTasks []VariantTasks `bson:"variants_tasks"` SyncAtEndOpts SyncAtEndOptions `bson:"sync_at_end_opts,omitempty"` Patches []ModulePatch `bson:"patches"` Parameters []Parameter `bson:"parameters,omitempty"` // Activated indicates whether or not the patch is finalized (i.e. // tasks/variants are now scheduled to run). If true, the patch has been // finalized. Activated bool `bson:"activated"` // ProjectStorageMethod describes how the parser project is stored for this // patch before it's finalized. This field is only set while the patch is // unfinalized and is cleared once the patch has been finalized. ProjectStorageMethod evergreen.ParserProjectStorageMethod `bson:"project_storage_method,omitempty"` PatchedProjectConfig string `bson:"patched_project_config"` Alias string `bson:"alias"` Triggers TriggerInfo `bson:"triggers"` BackportOf BackportInfo `bson:"backport_of,omitempty"` MergePatch string `bson:"merge_patch"` GithubPatchData thirdparty.GithubPatch `bson:"github_patch_data,omitempty"` GithubMergeData thirdparty.GithubMergeGroup `bson:"github_merge_data,omitempty"` GitInfo *GitMetadata `bson:"git_info,omitempty"` // DisplayNewUI is only used when roundtripping the patch via the CLI DisplayNewUI bool `bson:"display_new_ui,omitempty"` // MergeStatus is only used in gitServePatch to send the status of this // patch on the commit queue to the agent MergeStatus string `json:"merge_status"` // MergedFrom is populated with the patch id of the existing patch // the merged patch is based off of, if applicable. MergedFrom string `bson:"merged_from,omitempty"` // LocalModuleIncludes is only used for CLI patches to store local module changes. LocalModuleIncludes []LocalModuleInclude `bson:"local_module_includes,omitempty"` // ReferenceManifestID stores the ID of the manifest that this patch is based on. // It is used to determine the module revisions for this patch during creation. // This could potentially reference an invalid manifest, and should not error // when the manifest is not found. // Not stored in the database since it is only needed during patch creation. ReferenceManifestID string `bson:"-"` }
Patch stores all details related to a patch request
func FindFailedCommitQueuePatchesInTimeRange ¶
func FindFailedCommitQueuePatchesInTimeRange(projectID string, startTime, endTime time.Time) ([]Patch, error)
FindFailedCommitQueuePatchesInTimeRange returns failed patches if they started or failed within range.
func FindLatestGithubPRPatch ¶
FindLatestGithubPRPatch returns the latest PR patch for the given PR, if there is one.
func MakeNewMergePatch ¶
func MakeNewMergePatch(pr *github.PullRequest, projectID, alias, commitTitle, commitMessage string) (*Patch, error)
func (*Patch) AddBuildVariants ¶
AddBuildVariants adds more buildvarints to a patch document. This is meant to be used after initial patch creation.
func (*Patch) AddSyncVariantsTasks ¶
func (p *Patch) AddSyncVariantsTasks(vts []VariantTasks) error
AddSyncVariantsTasks adds new tasks for variants filtered from the given sequence of VariantsTasks to the existing synced VariantTasks.
func (*Patch) AddTasks ¶
AddTasks adds more tasks to a patch document. This is meant to be used after initial patch creation, to reconfigure the patch.
func (*Patch) ClearPatchData ¶
func (p *Patch) ClearPatchData()
ClearPatchData removes any inline patch data stored in this patch object for patches that have an associated id in gridfs, so that it can be stored properly.
func (*Patch) CollectiveStatus ¶
CollectiveStatus returns the aggregate status of all tasks and child patches. If this is meant for display on the UI, we should also consider the display status aborted. NOTE that the result of this should not be compared against version statuses, as those can be different.
func (*Patch) ConfigChanged ¶
ConfigChanged looks through the parts of the patch and returns true if the passed in remotePath is in the the name of the changed files that are part of the patch
func (*Patch) FetchPatchFiles ¶
FetchPatchFiles dereferences externally-stored patch diffs by fetching them from gridfs and placing their contents into the patch object.
func (*Patch) FilesChanged ¶
func (*Patch) FindModule ¶
func (p *Patch) FindModule(moduleName string) *ModulePatch
func (*Patch) GetCommitQueueURL ¶
func (*Patch) GetRequester ¶
func (*Patch) HasValidGitInfo ¶
func (*Patch) IsBackport ¶
func (*Patch) IsCommitQueuePatch ¶
IsCommitQueuePatch returns true if the the patch is part of any commit queue: either Evergreen's commit queue or GitHub's merge queue.
func (*Patch) IsFinished ¶
IsFinished returns whether or not the patch has finished based on its status.
func (*Patch) IsGithubMergePatch ¶
IsGithubMergePatch returns true if the patch is from the GitHub merge queue.
func (*Patch) IsGithubPRPatch ¶
func (*Patch) IsPRMergePatch ¶
func (*Patch) MakeBackportDescription ¶
func (*Patch) MarkFinished ¶
func (*Patch) MarshalBSON ¶
func (*Patch) RemoveModulePatch ¶
RemoveModulePatch removes a module that's part of a patch request
func (*Patch) ResolveSyncVariantTasks ¶
func (p *Patch) ResolveSyncVariantTasks(vts []VariantTasks) []VariantTasks
ResolveSyncVariantTasks filters the given tasks by variant to find only those that match the build variant and task filters.
func (*Patch) SetActivation ¶
SetActivation sets the patch to the desired activation state without modifying the activation status of the possibly corresponding version.
func (*Patch) SetChildPatches ¶
SetChildPatches appends the IDs of downstream patches to the db
func (*Patch) SetDescription ¶
SetDescription sets a patch's description in the database
func (*Patch) SetDownstreamParameters ¶
func (*Patch) SetFinalized ¶
SetFinalized marks the patch as finalized.
func (*Patch) SetMergePatch ¶
func (*Patch) SetParameters ¶
func (*Patch) SetParametersFromParent ¶
func (*Patch) SetPatchVisibility ¶
SetPatchVisibility set the patch visibility to the desired state. This is used to hide patches that the user does not need to see.
func (*Patch) SetTriggerAliases ¶
SetTriggerAliases appends the names of invoked trigger aliases to the DB
func (*Patch) SetVariantsTasks ¶
func (p *Patch) SetVariantsTasks(variantsTasks []VariantTasks) error
SetVariantsTasks updates the variant/tasks pairs in the database. Also updates the Tasks and Variants fields to maintain backwards compatibility between the old and new fields.
func (*Patch) ShouldPatchFileWithDiff ¶
ShouldPatchFileWithDiff returns true if the patch should read with diff (i.e. is not a PR or CQ patch) and the config has changed.
func (*Patch) UnmarshalBSON ¶
func (*Patch) UpdateGithashProjectAndTasks ¶
func (*Patch) UpdateMergeCommitSHA ¶
UpdateMergeCommitSHA updates the merge commit SHA for the patch.
func (*Patch) UpdateModulePatch ¶
func (p *Patch) UpdateModulePatch(modulePatch ModulePatch) error
UpdateModulePatch adds or updates a module within a patch.
func (*Patch) UpdateRepeatPatchId ¶
UpdateRepeatPatchId updates the repeat patch Id value to be used for subsequent pr patches
func (*Patch) UpdateStatus ¶
func (*Patch) UpdateVariantsTasks ¶
func (p *Patch) UpdateVariantsTasks(variantsTasks []VariantTasks)
UpdateVariantsTasks updates the patch's Tasks and BuildVariants fields to match with the set in the given list of VariantTasks. This is to ensure schema backwards compatibility for T shaped patches. This mutates the patch in memory but does not update it in the database; for that, use SetVariantsTasks.
type PatchSet ¶
type PatchSet struct { Patch string `bson:"patch,omitempty"` PatchFileId string `bson:"patch_file_id,omitempty"` CommitMessages []string `bson:"commit_messages,omitempty"` Summary []thirdparty.Summary `bson:"summary"` }
PatchSet stores information about the actual patch
type PatchTriggerDefinition ¶
type PatchTriggerDefinition struct { Alias string `bson:"alias" json:"alias"` ChildProject string `bson:"child_project" json:"child_project"` TaskSpecifiers []TaskSpecifier `bson:"task_specifiers" json:"task_specifiers"` // The parent status that the child patch should run on: failure, success, or * Status string `bson:"status,omitempty" json:"status,omitempty"` ParentAsModule string `bson:"parent_as_module,omitempty" json:"parent_as_module,omitempty"` // The revision to base the downstream patch off of DownstreamRevision string `bson:"downstream_revision,omitempty" json:"downstream_revision,omitempty"` }
type PatchesByCreateTime ¶
type PatchesByCreateTime []Patch
func (PatchesByCreateTime) Len ¶
func (p PatchesByCreateTime) Len() int
func (PatchesByCreateTime) Less ¶
func (p PatchesByCreateTime) Less(i, j int) bool
func (PatchesByCreateTime) Swap ¶
func (p PatchesByCreateTime) Swap(i, j int)
type SyncAtEndOptions ¶
type SyncAtEndOptions struct { // BuildVariants filters which variants will sync. BuildVariants []string `bson:"build_variants,omitempty"` // Tasks filters which tasks will sync. Tasks []string `bson:"tasks,omitempty"` // VariantsTasks are the resolved pairs of build variants and tasks that // this patch can actually run task sync for. VariantsTasks []VariantTasks `bson:"variants_tasks,omitempty"` Statuses []string `bson:"statuses,omitempty"` Timeout time.Duration `bson:"timeout,omitempty"` }
SyncAtEndOptions describes when and how tasks perform sync at the end of a task.
type TaskSpecifier ¶
type TriggerInfo ¶
type TriggerInfo struct { Aliases []string `bson:"aliases,omitempty"` ParentPatch string `bson:"parent_patch,omitempty"` ParentProjectID string `bson:"parent_project_id,omitempty"` DownstreamRevision string `bson:"downstream_revision,omitempty"` SameBranchAsParent bool `bson:"same_branch_as_parent"` ChildPatches []string `bson:"child_patches,omitempty"` DownstreamParameters []Parameter `bson:"downstream_parameters,omitempty"` }
type TriggerIntent ¶
type TriggerIntent struct { Id string `bson:"_id"` Requester string `bson:"requester"` Author string `bson:"author"` ProjectID string `bson:"project_id"` ParentID string `bson:"parent_id"` ParentProjectID string `bson:"parent_project"` ParentAsModule string `bson:"parent_as_module"` // The parent status that the child patch should run on ParentStatus string `bson:"parent_status"` Definitions []PatchTriggerDefinition `bson:"definitions"` // The revision to base the downstream patch off of DownstreamRevision string `bson:"downstream_revision"` Processed bool `bson:"processed"` }
func (*TriggerIntent) GetAlias ¶
func (t *TriggerIntent) GetAlias() string
func (*TriggerIntent) GetCalledBy ¶
func (t *TriggerIntent) GetCalledBy() string
func (*TriggerIntent) GetType ¶
func (t *TriggerIntent) GetType() string
GetType returns the patch intent, e.g., GithubIntentType.
func (*TriggerIntent) ID ¶
func (t *TriggerIntent) ID() string
func (*TriggerIntent) Insert ¶
func (t *TriggerIntent) Insert() error
func (*TriggerIntent) IsProcessed ¶
func (t *TriggerIntent) IsProcessed() bool
func (*TriggerIntent) NewPatch ¶
func (t *TriggerIntent) NewPatch() *Patch
func (*TriggerIntent) RepeatFailedTasksAndVariants ¶
func (g *TriggerIntent) RepeatFailedTasksAndVariants() (string, bool)
func (*TriggerIntent) RepeatPreviousPatchDefinition ¶
func (t *TriggerIntent) RepeatPreviousPatchDefinition() (string, bool)
func (*TriggerIntent) RequesterIdentity ¶
func (t *TriggerIntent) RequesterIdentity() string
func (*TriggerIntent) SetProcessed ¶
func (t *TriggerIntent) SetProcessed() error
func (*TriggerIntent) ShouldFinalizePatch ¶
func (t *TriggerIntent) ShouldFinalizePatch() bool
type TriggerIntentOptions ¶
type VariantTasks ¶
type VariantTasks struct { Variant string `bson:"variant"` Tasks []string `bson:"tasks"` DisplayTasks []DisplayTask `bson:"displaytasks"` }
VariantTasks contains the variant name and the set of tasks to be scheduled for that variant
func MergeVariantsTasks ¶
func MergeVariantsTasks(vts1, vts2 []VariantTasks) []VariantTasks
MergeVariantsTasks merges two slices of VariantsTasks into a single set.