Documentation ¶
Overview ¶
Package artifacts contains tools for reading and processing artifacts.
Index ¶
- Constants
- Variables
- func AddHashPrefix(hash string) string
- func MustParseName(name string) (invID invocations.ID, testID, resultID, artifactID string)
- func ParentID(testID, resultID string) string
- func ParseParentID(parentID string) (testID, resultID string, err error)
- func ToLogLines(artifactID string, contentType string, content []byte, ...) ([]*pb.ArtifactLine, error)
- func TrimHashPrefix(hash string) string
- func VerifyReadArtifactPermission(ctx context.Context, name string) error
- type Artifact
- type Query
Constants ¶
const ( RFC3339FullDate = "2006-01-02" PstTimeZone = "America/Los_Angeles" UtcTimeZone = "UTC" )
Variables ¶
var ContentHashRe = regexp.MustCompile(fmt.Sprintf(`^%s:%s$`, hashFunc, sha256Pattern))
var SupportedContentTypes = map[string]bool{ "application/octet-stream": true, "application/x-gzip": true, }
Functions ¶
func AddHashPrefix ¶
AddHashPrefix adds HashFunc to a given hash string.
func MustParseName ¶
func MustParseName(name string) (invID invocations.ID, testID, resultID, artifactID string)
MustParseName extracts invocation, test, result and artifactIDs. Test and result IDs are "" if this is a invocation-level artifact. Panics on failure.
func ParseParentID ¶
ParseParentID parses parentID into testID and resultID. If the artifact's parent is invocation, then testID and resultID are "".
func ToLogLines ¶
func ToLogLines(artifactID string, contentType string, content []byte, year, maxLines, maxBytes int) ([]*pb.ArtifactLine, error)
ToLogLines retrieves and processes an artifact and returns its content as a set of log lines. It executes best effort extraction of the timestamp and the severity of each log line. The `year` is used as a fallback if the year was absent from the log line's timestamp. The max specified the maximum number of results to return, if the max <= 0 it will return all lines.
func TrimHashPrefix ¶
TrimHashPrefix removes HashFunc from a given hash string.
Types ¶
type Query ¶
type Query struct { InvocationIDs invocations.IDSet ParentIDRegexp string FollowEdges *pb.ArtifactPredicate_EdgeTypeSet TestResultPredicate *pb.TestResultPredicate ContentTypeRegexp string ArtifactIDRegexp string PageSize int // must be positive PageToken string WithRBECASHash bool WithGcsURI bool }
Query specifies artifacts to fetch.
func (*Query) FetchProtos ¶
func (q *Query) FetchProtos(ctx context.Context) (arts []*pb.Artifact, nextPageToken string, err error)
FetchProtos returns a page of artifact protos matching q.
Returned artifacts are ordered by level (invocation or test result). Test result artifacts are sorted by parent invocation ID, test ID and artifact ID.