metadata

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0 Imports: 1 Imported by: 29

Documentation

Index

Constants

View Source
const (
	// JobVersion is the metadata key that overrides repo-commit in Started when set.
	JobVersion = "job-version"
)
View Source
const Missing = "missing"

Variables

This section is empty.

Functions

func SetVersion

func SetVersion(started *Started, finished *Finished, repoCommit, jobVersion string)

SetVersion ensures that the repoCommit and jobVersion are set appropriately.

func Version

func Version(started Started, finished Finished) string

Version extracts the job's custom version or else the checked out repo commit.

Types

type Finished

type Finished struct {
	// Timestamp is UTC epoch seconds when the job finished.
	// An empty value indicates an incomplete job.
	Timestamp *int64 `json:"timestamp,omitempty"`
	// Passed is true when the job completes successfully.
	Passed *bool `json:"passed"`
	// Metadata holds data computed by the job at runtime.
	// For example, the version of a binary downloaded at runtime
	// The JobVersion key overrides the auto-version set in Started.
	Metadata Metadata `json:"metadata,omitempty"`

	// Result is deprecated, use Passed.
	Result string `json:"result,omitempty"` // TODO(fejta): remove

	// Use Metadata[JobVersion] or Started.RepoCommit
	DeprecatedJobVersion  string `json:"job-version,omitempty"`  // TODO(fejta): remove
	DeprecatedRevision    string `json:"revision,omitempty"`     // TODO(fejta): remove
	DeprecatedRepoVersion string `json:"repo-version,omitempty"` // TODO(fejta): remove
}

Finished holds the finished.json values of the build

type Metadata

type Metadata map[string]interface{}

Metadata holds the finished.json values in the metadata key.

Metadata values can either be string or string map of strings

TODO(fejta): figure out which of these we want and document them Special values: infra-commit, repos, repo, repo-commit, links, others

func (Metadata) Keys

func (m Metadata) Keys() []string

Keys returns an array of the keys of all valid Metadata values.

func (Metadata) Meta

func (m Metadata) Meta(name string) (*Metadata, bool)

Meta returns the name key if its value is a child object, and true if they key is present.

func (Metadata) String

func (m Metadata) String(name string) (*string, bool)

String returns the name key if its value is a string, and true if the key is present.

func (Metadata) Strings

func (m Metadata) Strings() map[string]string

Strings returns the submap of values in the map that are strings.

type Started

type Started struct {
	// Timestamp is UTC epoch seconds when the job started.
	Timestamp int64 `json:"timestamp"` // epoch seconds
	// Node holds the name of the machine that ran the job.
	Node string `json:"node,omitempty"`

	// Pull holds the PR number the primary repo is testing
	Pull string `json:"pull,omitempty"`
	// Repos holds the RepoVersion of all commits checked out.
	Repos      map[string]string `json:"repos,omitempty"` // {repo: branch_or_pull} map
	RepoCommit string            `json:"repo-commit,omitempty"`

	// Metadata is deprecated, add to finished.json
	Metadata Metadata `json:"metadata,omitempty"` // TODO(fejta): remove

	// Use RepoCommit
	DeprecatedJobVersion  string `json:"job-version,omitempty"`  // TODO(fejta): remove
	DeprecatedRepoVersion string `json:"repo-version,omitempty"` // TODO(fejta): remove

}

Started holds the started.json values of the build.

Directories

Path Synopsis
Package junit describes the test-infra definition of "junit", and provides utilities to parse it.
Package junit describes the test-infra definition of "junit", and provides utilities to parse it.

Jump to

Keyboard shortcuts

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