srcman

package
v0.0.0-...-add0f8d Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 9

Documentation

Overview

Package srcman contains source manifest protobuf definitions.

The package name here must match the protobuf package name, as the generated files will reside in the same directory.

Index

Constants

View Source
const ContentTypeSourceManifest = "text/x-chrome-infra-source-manifest; version=1"

ContentTypeSourceManifest is a stream content type for source manifests.

Variables

View Source
var (
	ManifestDiff_Stat_name = map[int32]string{
		0:  "EQUAL",
		1:  "ADDED",
		2:  "REMOVED",
		4:  "MODIFIED",
		12: "DIFF",
	}
	ManifestDiff_Stat_value = map[string]int32{
		"EQUAL":    0,
		"ADDED":    1,
		"REMOVED":  2,
		"MODIFIED": 4,
		"DIFF":     12,
	}
)

Enum value maps for ManifestDiff_Stat.

View Source
var File_go_chromium_org_luci_common_proto_srcman_manifest_diff_proto protoreflect.FileDescriptor
View Source
var File_go_chromium_org_luci_common_proto_srcman_manifest_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Manifest

type Manifest struct {

	// Version will increment on backwards-incompatible changes only. Backwards
	// compatible changes will not alter this version number.
	//
	// Currently, the only valid version number is 0.
	Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	// Map of local file system directory path (with forward slashes) to
	// a Directory message containing one or more deployments.
	//
	// The local path is relative to some job-specific root. This should be used
	// for informational/display/organization purposes. In particular, think VERY
	// CAREFULLY before you configure remote services/recipes to look for
	// particular filesystem layouts here. For example, if you want to look for
	// "the version of chromium/src checked out by the job", prefer to look for
	// a Directory which checks out "chromium/src", as opposed to assuming this
	// checkout lives in a top-level folder called "src". The reason for this is
	// that jobs SHOULD reserve the right to do their checkouts in any way they
	// please.
	//
	// If you feel like you need to make some service configuration which uses one
	// of these local filesystem paths as a key, please consult with the Chrome
	// Infrastructure team to see if there's a better alternative.
	//
	// Ex.
	//
	//	"": {...}  // root directory
	//	"src/third_party/something": {...}
	Directories map[string]*Manifest_Directory `` /* 163-byte string literal not displayed */
	// contains filtered or unexported fields
}

A Manifest attempts to make an accurate accounting of source/data directories during the execution of a LUCI task.

These directories are primarily in the form of e.g. git checkouts of source, but also include things like isolated hashes and CIPD package deployments. In the future, other deployment forms may be supported (like other SCMs).

The purpose of this manifest is so that other parts of the LUCI stack (e.g. Milo) can work with the descriptions of this deployed data as a first-class citizen. Initially this Manifest will be used to allow Milo to display diffs between jobs, but it will also be useful for tools and humans to get a record of exactly what data went into this LUCI task.

Source Manifests can be emitted from recipes using the 'recipe_engine/source_manifest' module.

func (*Manifest) Descriptor deprecated

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

Deprecated: Use Manifest.ProtoReflect.Descriptor instead.

func (*Manifest) Diff

func (old *Manifest) Diff(new *Manifest) *ManifestDiff

Diff generates a ManifestDiff object which shows what changed between the `old` manifest and the `new` manifest.

This only calculates the pure-data differences. Notably, this will not reach out to any remote services to populate the git_history field.

func (*Manifest) FromProperty

func (p *Manifest) FromProperty(prop datastore.Property) error

FromProperty implements datastore.PropertyConverter. It parses a '[]byte' into an embedded 'Manifest' when used with the "go.chromium.org/luci/gae" library.

func (*Manifest) GetDirectories

func (x *Manifest) GetDirectories() map[string]*Manifest_Directory

func (*Manifest) GetVersion

func (x *Manifest) GetVersion() int32

func (*Manifest) ProtoMessage

func (*Manifest) ProtoMessage()

func (*Manifest) ProtoReflect

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

func (*Manifest) Reset

func (x *Manifest) Reset()

func (*Manifest) String

func (x *Manifest) String() string

func (*Manifest) ToProperty

func (p *Manifest) ToProperty() (prop datastore.Property, err error)

ToProperty implements datastore.PropertyConverter. It causes an embedded 'Manifest' to serialize to an unindexed '[]byte' when used with the "go.chromium.org/luci/gae" library.

type ManifestDiff

type ManifestDiff struct {

	// The older of the two manifests.
	Old *Manifest `protobuf:"bytes,1,opt,name=old,proto3" json:"old,omitempty"`
	// The newer of the two manifests.
	New *Manifest `protobuf:"bytes,2,opt,name=new,proto3" json:"new,omitempty"`
	// Indicates if there is some overall difference between old and new.
	Overall     ManifestDiff_Stat                  `protobuf:"varint,3,opt,name=overall,proto3,enum=srcman.ManifestDiff_Stat" json:"overall,omitempty"`
	Directories map[string]*ManifestDiff_Directory `` /* 163-byte string literal not displayed */
	// contains filtered or unexported fields
}

ManifestDiff holds basic difference information between two source manifests.

func (*ManifestDiff) Descriptor deprecated

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

Deprecated: Use ManifestDiff.ProtoReflect.Descriptor instead.

func (*ManifestDiff) FromProperty

func (p *ManifestDiff) FromProperty(prop datastore.Property) error

FromProperty implements datastore.PropertyConverter. It parses a '[]byte' into an embedded 'ManifestDiff' when used with the "go.chromium.org/luci/gae" library.

func (*ManifestDiff) GetDirectories

func (x *ManifestDiff) GetDirectories() map[string]*ManifestDiff_Directory

func (*ManifestDiff) GetNew

func (x *ManifestDiff) GetNew() *Manifest

func (*ManifestDiff) GetOld

func (x *ManifestDiff) GetOld() *Manifest

func (*ManifestDiff) GetOverall

func (x *ManifestDiff) GetOverall() ManifestDiff_Stat

func (*ManifestDiff) ProtoMessage

func (*ManifestDiff) ProtoMessage()

func (*ManifestDiff) ProtoReflect

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

func (*ManifestDiff) Reset

func (x *ManifestDiff) Reset()

func (*ManifestDiff) String

func (x *ManifestDiff) String() string

func (*ManifestDiff) ToProperty

func (p *ManifestDiff) ToProperty() (prop datastore.Property, err error)

ToProperty implements datastore.PropertyConverter. It causes an embedded 'ManifestDiff' to serialize to an unindexed '[]byte' when used with the "go.chromium.org/luci/gae" library.

type ManifestDiff_Directory

type ManifestDiff_Directory struct {

	// This is the overall status for this Directory.
	Overall        ManifestDiff_Stat         `protobuf:"varint,1,opt,name=overall,proto3,enum=srcman.ManifestDiff_Stat" json:"overall,omitempty"`
	GitCheckout    *ManifestDiff_GitCheckout `protobuf:"bytes,2,opt,name=git_checkout,json=gitCheckout,proto3" json:"git_checkout,omitempty"`
	CipdServerHost ManifestDiff_Stat         `` /* 136-byte string literal not displayed */
	// Note: this will only ever be MODIFIED, because we cannot (yet) determine
	// if two versions of a cipd package are diffable. We may later implement
	// DIFF detection (i.e. if both packages use `version:<sha1>` tags).
	CipdPackage map[string]ManifestDiff_Stat `` /* 213-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*ManifestDiff_Directory) Descriptor deprecated

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

Deprecated: Use ManifestDiff_Directory.ProtoReflect.Descriptor instead.

func (*ManifestDiff_Directory) GetCipdPackage

func (x *ManifestDiff_Directory) GetCipdPackage() map[string]ManifestDiff_Stat

func (*ManifestDiff_Directory) GetCipdServerHost

func (x *ManifestDiff_Directory) GetCipdServerHost() ManifestDiff_Stat

func (*ManifestDiff_Directory) GetGitCheckout

func (x *ManifestDiff_Directory) GetGitCheckout() *ManifestDiff_GitCheckout

func (*ManifestDiff_Directory) GetOverall

func (x *ManifestDiff_Directory) GetOverall() ManifestDiff_Stat

func (*ManifestDiff_Directory) ProtoMessage

func (*ManifestDiff_Directory) ProtoMessage()

func (*ManifestDiff_Directory) ProtoReflect

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

func (*ManifestDiff_Directory) Reset

func (x *ManifestDiff_Directory) Reset()

func (*ManifestDiff_Directory) String

func (x *ManifestDiff_Directory) String() string

type ManifestDiff_GitCheckout

type ManifestDiff_GitCheckout struct {

	// Indicates if there is some overall difference between old and new.
	Overall ManifestDiff_Stat `protobuf:"varint,1,opt,name=overall,proto3,enum=srcman.ManifestDiff_Stat" json:"overall,omitempty"`
	// Indicates the status for the `revision` field.
	//
	// If this is DIFF, it is sensible to compute
	//
	//	`git log repo_url old.revision new.revision`
	Revision ManifestDiff_Stat `protobuf:"varint,2,opt,name=revision,proto3,enum=srcman.ManifestDiff_Stat" json:"revision,omitempty"`
	// Indicates the status for the `patch_revision` field. It evaluates
	// the patch_fetch_ref values to ensure that old and new are different
	// patches from the same CL.
	//
	// If this is DIFF, it is sensible to compute
	//
	//	`git log repo_url old.patch_revision new.patch_revision`
	PatchRevision ManifestDiff_Stat `` /* 131-byte string literal not displayed */
	// The URL that should be used for RPCs. It may differ from the url in old
	// or new if the service computing this ManifestDiff knows of e.g. a repo
	// URL migration.
	RepoUrl string `protobuf:"bytes,4,opt,name=repo_url,json=repoUrl,proto3" json:"repo_url,omitempty"`
	// If revision==DIFF, this may be populated with git history occurring
	// between the two base revisions.
	History []*git.Commit `protobuf:"bytes,5,rep,name=history,proto3" json:"history,omitempty"`
	// contains filtered or unexported fields
}

func (*ManifestDiff_GitCheckout) Descriptor deprecated

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

Deprecated: Use ManifestDiff_GitCheckout.ProtoReflect.Descriptor instead.

func (*ManifestDiff_GitCheckout) GetHistory

func (x *ManifestDiff_GitCheckout) GetHistory() []*git.Commit

func (*ManifestDiff_GitCheckout) GetOverall

func (*ManifestDiff_GitCheckout) GetPatchRevision

func (x *ManifestDiff_GitCheckout) GetPatchRevision() ManifestDiff_Stat

func (*ManifestDiff_GitCheckout) GetRepoUrl

func (x *ManifestDiff_GitCheckout) GetRepoUrl() string

func (*ManifestDiff_GitCheckout) GetRevision

func (*ManifestDiff_GitCheckout) ProtoMessage

func (*ManifestDiff_GitCheckout) ProtoMessage()

func (*ManifestDiff_GitCheckout) ProtoReflect

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

func (*ManifestDiff_GitCheckout) Reset

func (x *ManifestDiff_GitCheckout) Reset()

func (*ManifestDiff_GitCheckout) String

func (x *ManifestDiff_GitCheckout) String() string

type ManifestDiff_Stat

type ManifestDiff_Stat int32

Stat indicates how a given item has changed.

const (
	// These two items are identical
	ManifestDiff_EQUAL ManifestDiff_Stat = 0
	// The item was added in `new` compared to `old`
	ManifestDiff_ADDED ManifestDiff_Stat = 1
	// The item was removed in `new` compared to `old`
	ManifestDiff_REMOVED ManifestDiff_Stat = 2
	// The item is in both, but is incomparable (e.g. repo_url changed from
	// `old` to `new`).
	ManifestDiff_MODIFIED ManifestDiff_Stat = 4
	// The item is in both, and is directly comparable (e.g. different
	// revisions of the same repo_url). This only applies to the revision fields
	// of SCM messages.
	//
	// This is 0x8 | MODIFIED, so that users who don't care about DIFF v.
	// MODIFIED can check `Status & MODIFIED`.
	ManifestDiff_DIFF ManifestDiff_Stat = 12
)

func (ManifestDiff_Stat) Descriptor

func (ManifestDiff_Stat) Enum

func (ManifestDiff_Stat) EnumDescriptor deprecated

func (ManifestDiff_Stat) EnumDescriptor() ([]byte, []int)

Deprecated: Use ManifestDiff_Stat.Descriptor instead.

func (ManifestDiff_Stat) Number

func (ManifestDiff_Stat) String

func (x ManifestDiff_Stat) String() string

func (ManifestDiff_Stat) Type

type ManifestLink struct {

	// The fully qualified url of the Manifest proto. It's expected that this is
	// a binary logdog stream consisting of exactly one Manifest proto. For now
	// this will always be the `logdog` uri scheme, though it's feasible to put
	// other uri schemes here later.
	//
	// Ex.
	//
	//	logdog://logs.chromium.org/infra/build/12345/+/some/path
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// The hash of the Manifest's raw binary form (i.e. the bytes at the end of
	// `url`, without any interpretation or decoding). Milo will use this as an
	// optimization; Manifests will be interned once into Milo's datastore.
	// Future hashes which match will not be loaded from the url, but will be
	// assumed to be identical. If the sha256 doesn't match the data at the URL,
	// Milo may render this build with the wrong manifest.
	//
	// This is the raw sha256, so it must be exactly 32 bytes.
	Sha256 []byte `protobuf:"bytes,2,opt,name=sha256,proto3" json:"sha256,omitempty"`
	// contains filtered or unexported fields
}

Links to an externally stored Manifest proto.

func (*ManifestLink) Descriptor deprecated

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

Deprecated: Use ManifestLink.ProtoReflect.Descriptor instead.

func (*ManifestLink) GetSha256

func (x *ManifestLink) GetSha256() []byte

func (*ManifestLink) GetUrl

func (x *ManifestLink) GetUrl() string

func (*ManifestLink) ProtoMessage

func (*ManifestLink) ProtoMessage()

func (*ManifestLink) ProtoReflect

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

func (*ManifestLink) Reset

func (x *ManifestLink) Reset()

func (*ManifestLink) String

func (x *ManifestLink) String() string

type Manifest_CIPDPackage

type Manifest_CIPDPackage struct {

	// The package pattern that was given to the CIPD client (if known).
	//
	// Ex.
	//
	//	infra/tools/luci/led/${platform}
	PackagePattern string `protobuf:"bytes,1,opt,name=package_pattern,json=packagePattern,proto3" json:"package_pattern,omitempty"`
	// The fully resolved instance ID of the deployed package.
	//
	// Ex.
	//
	//	0cfafb3a705bd8f05f86c6444ff500397fbb711c
	InstanceId string `protobuf:"bytes,2,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"`
	// The unresolved version ID of the deployed package (if known).
	//
	// Ex.
	//
	//	git_revision:aaf3a2cfccc227b5141caa1b6b3502c9907d7420
	//	latest
	Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

func (*Manifest_CIPDPackage) Descriptor deprecated

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

Deprecated: Use Manifest_CIPDPackage.ProtoReflect.Descriptor instead.

func (*Manifest_CIPDPackage) Diff

Diff generates a ManifestDiff_Stat reflecting the difference between the `old` CIPDPackage and the `new` one.

func (*Manifest_CIPDPackage) GetInstanceId

func (x *Manifest_CIPDPackage) GetInstanceId() string

func (*Manifest_CIPDPackage) GetPackagePattern

func (x *Manifest_CIPDPackage) GetPackagePattern() string

func (*Manifest_CIPDPackage) GetVersion

func (x *Manifest_CIPDPackage) GetVersion() string

func (*Manifest_CIPDPackage) ProtoMessage

func (*Manifest_CIPDPackage) ProtoMessage()

func (*Manifest_CIPDPackage) ProtoReflect

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

func (*Manifest_CIPDPackage) Reset

func (x *Manifest_CIPDPackage) Reset()

func (*Manifest_CIPDPackage) String

func (x *Manifest_CIPDPackage) String() string

type Manifest_Directory

type Manifest_Directory struct {
	GitCheckout *Manifest_GitCheckout `protobuf:"bytes,1,opt,name=git_checkout,json=gitCheckout,proto3" json:"git_checkout,omitempty"`
	// The canonicalized hostname of the CIPD server which hosts the CIPD
	// packages (if any). If no CIPD packages are in this Directory, this must
	// be blank.
	//
	// Ex.
	//
	//	chrome-infra-packages.appspot.com
	CipdServerHost string `protobuf:"bytes,2,opt,name=cipd_server_host,json=cipdServerHost,proto3" json:"cipd_server_host,omitempty"`
	// Maps CIPD package name to CIPDPackage.
	//
	// Ex.
	//
	//	"some/package/name": {...}
	//	"other/package": {...}
	CipdPackage map[string]*Manifest_CIPDPackage `` /* 182-byte string literal not displayed */
	// contains filtered or unexported fields
}

A Directory contains one or more descriptions of deployed artifacts. Note that due to the practical nature of jobs on bots, it may be the case that a given directory contains e.g. a git checkout and multiple cipd packages.

func (*Manifest_Directory) Descriptor deprecated

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

Deprecated: Use Manifest_Directory.ProtoReflect.Descriptor instead.

func (*Manifest_Directory) Diff

Diff generates a ManifestDiff_Directory object which shows what changed between the `old` manifest directory and the `new` manifest directory.

func (*Manifest_Directory) GetCipdPackage

func (x *Manifest_Directory) GetCipdPackage() map[string]*Manifest_CIPDPackage

func (*Manifest_Directory) GetCipdServerHost

func (x *Manifest_Directory) GetCipdServerHost() string

func (*Manifest_Directory) GetGitCheckout

func (x *Manifest_Directory) GetGitCheckout() *Manifest_GitCheckout

func (*Manifest_Directory) ProtoMessage

func (*Manifest_Directory) ProtoMessage()

func (*Manifest_Directory) ProtoReflect

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

func (*Manifest_Directory) Reset

func (x *Manifest_Directory) Reset()

func (*Manifest_Directory) String

func (x *Manifest_Directory) String() string

type Manifest_GitCheckout

type Manifest_GitCheckout struct {

	// The canonicalized URL of the original repo that is considered the “source
	// of truth” for the source code.
	//
	// Ex.
	//
	//	https://chromium.googlesource.com/chromium/tools/build
	//	https://chromium.googlesource.com/infra/luci/recipes-py
	RepoUrl string `protobuf:"bytes,1,opt,name=repo_url,json=repoUrl,proto3" json:"repo_url,omitempty"`
	// If different from repo_url, this can be the URL of the repo that the source
	// was actually fetched from (i.e. a mirror).
	//
	// If this is empty, it's presumed to be equal to repo_url.
	//
	// Ex.
	//
	//	https://github.com/luci/recipes-py
	FetchUrl string `protobuf:"bytes,2,opt,name=fetch_url,json=fetchUrl,proto3" json:"fetch_url,omitempty"`
	// The fully resolved revision (commit hash) of the source.
	//
	// This must always be a revision on the hosted repo (not any locally
	// generated commit).
	//
	// Ex.
	//
	//	3617b0eea7ec74b8e731a23fed2f4070cbc284c4
	Revision string `protobuf:"bytes,3,opt,name=revision,proto3" json:"revision,omitempty"`
	// The ref that the task used to resolve/fetch the revision of the source
	// (if any).
	//
	// This must always be a ref on the hosted repo (not any local alias
	// like 'refs/remotes/...').
	//
	// This must always be an absolute ref (i.e. starts with 'refs/'). An
	// example of a non-absolute ref would be 'master'.
	//
	// Ex.
	//
	//	refs/heads/master
	FetchRef string `protobuf:"bytes,4,opt,name=fetch_ref,json=fetchRef,proto3" json:"fetch_ref,omitempty"`
	// If the checkout had a CL associated with it (i.e. a gerrit commit), this
	// is the fully resolved revision (commit hash) of the CL. If there was no
	// CL, this is empty. Typically the checkout application (e.g. bot_update)
	// rebases this revision on top of the `revision` fetched above.
	//
	// If specified, this must always be a revision on the hosted repo (not any
	// locally generated commit).
	//
	// Ex.
	//
	//	6b0b5c12443cfb93305f8d9e21f8d762c8dad9f0
	PatchRevision string `protobuf:"bytes,5,opt,name=patch_revision,json=patchRevision,proto3" json:"patch_revision,omitempty"`
	// If the checkout had a CL associated with it, this is the ref that the
	// task used to fetch patch_revision. If `patch_revision` is supplied, this
	// field is required. If there was no CL, this is empty.
	//
	// If specified, this must always be a ref on the hosted repo (not any local
	// alias like 'refs/remotes/...').
	//
	// This must always be an absolute ref (i.e. starts with 'refs/').
	//
	// Ex.
	//
	//	refs/changes/04/511804/4
	PatchFetchRef string `protobuf:"bytes,6,opt,name=patch_fetch_ref,json=patchFetchRef,proto3" json:"patch_fetch_ref,omitempty"`
	// contains filtered or unexported fields
}

func (*Manifest_GitCheckout) Descriptor deprecated

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

Deprecated: Use Manifest_GitCheckout.ProtoReflect.Descriptor instead.

func (*Manifest_GitCheckout) Diff

Diff generates a Stat reflecting the difference between the `old` GitCheckout and the `new` one.

This will generate a Stat of `DIFF` if the two GitCheckout's are non-nil and share the same RepoUrl.

This only calculates the pure-data differences. Notably, this will not reach out to any remote services to populate the git_history field.

func (*Manifest_GitCheckout) GetFetchRef

func (x *Manifest_GitCheckout) GetFetchRef() string

func (*Manifest_GitCheckout) GetFetchUrl

func (x *Manifest_GitCheckout) GetFetchUrl() string

func (*Manifest_GitCheckout) GetPatchFetchRef

func (x *Manifest_GitCheckout) GetPatchFetchRef() string

func (*Manifest_GitCheckout) GetPatchRevision

func (x *Manifest_GitCheckout) GetPatchRevision() string

func (*Manifest_GitCheckout) GetRepoUrl

func (x *Manifest_GitCheckout) GetRepoUrl() string

func (*Manifest_GitCheckout) GetRevision

func (x *Manifest_GitCheckout) GetRevision() string

func (*Manifest_GitCheckout) ProtoMessage

func (*Manifest_GitCheckout) ProtoMessage()

func (*Manifest_GitCheckout) ProtoReflect

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

func (*Manifest_GitCheckout) Reset

func (x *Manifest_GitCheckout) Reset()

func (*Manifest_GitCheckout) String

func (x *Manifest_GitCheckout) String() string

Jump to

Keyboard shortcuts

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