util

package
v0.0.0-...-a70aae3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package util contains utility functions

Package util contains utility functions

Package util contains utility functions

Package util contains utility functions

Package util contains utility functions

Index

Constants

View Source
const ProjectRePattern = `[a-z0-9\-]{1,40}`

ProjectRePattern is the regular expression pattern that matches validly formed LUCI Project names. From https://source.chromium.org/chromium/infra/infra/+/main:luci/appengine/components/components/config/common.py?q=PROJECT_ID_PATTERN

View Source
const RefHashRePattern = `[0-9a-f]{16}`

RefHashRePattern is the regular expression pattern that matches validly formed ref hash. From https://source.chromium.org/chromium/infra/infra/+/main:go/src/go.chromium.org/luci/analysis/internal/config/constants.go;l=27

View Source
const VariantHashRePattern = `[0-9a-f]{16}`

VariantHashRePattern is the regular expression pattern that matches validly formed variant hash. From https://source.chromium.org/chromium/infra/infra/+/main:go/src/go.chromium.org/luci/analysis/internal/config/constants.go;l=23

Variables

This section is empty.

Functions

func BuilderFromConfigBuilder

func BuilderFromConfigBuilder(builder *configpb.Builder) *bbpb.BuilderID

func ConstructBuganizerURLForAnalysis

func ConstructBuganizerURLForAnalysis(commitReviewURL string, analysisURL string) string

ConstructBuganizerURLForAnalysis returns a link to create a bug against LUCI Bisection for wrongly blamed commits

func ConstructBuildURL

func ConstructBuildURL(ctx context.Context, bbid int64) string

ConstructBuildURL returns a link to the build page in Milo given a Buildbucket ID

func ConstructCompileAnalysisURL

func ConstructCompileAnalysisURL(project string, bbid int64) string

ConstructCompileAnalysisURL returns a link to the analysis page in LUCI Bisection given a Buildbucket ID

func ConstructGerritCodeReviewURL

func ConstructGerritCodeReviewURL(ctx context.Context,
	gerritClient *gerrit.Client, change *gerritpb.ChangeInfo) string

func ConstructTestAnalysisURL

func ConstructTestAnalysisURL(project string, analysisID int64) string

ConstructTestAnalysisURL returns a link to the analysis page in LUCI Bisection given a Buildbucket ID

func ConstructTestHistoryURL

func ConstructTestHistoryURL(project, testID, variantHash string) string

func GetBuilderGroup

func GetBuilderGroup(build *bbpb.Build) string

GetBuilderGroup returns the builder group for a build. If there is no builder group set, return empty string.

func GetCanonicalFileName

func GetCanonicalFileName(fp string) string

GetCanonicalFileName return the file name without extension and common suffixes.

func GetDimensionWithKey

func GetDimensionWithKey(dims *pb.Dimensions, key string) *pb.Dimension

func GetGitilesCommitForBuild

func GetGitilesCommitForBuild(build *bbpb.Build) *bbpb.GitilesCommit

GetGitilesCommitForBuild returns the gitiles commit for a build The commit position is taken from output properties if available.

func GetSheriffRotationsForBuild

func GetSheriffRotationsForBuild(build *bbpb.Build) []string

GetSheriffRotationsForBuild returns the sheriff rotations for a build. If there is no sheriff rotation set, return empty list.

func GetTaskDimensions

func GetTaskDimensions(build *bbpb.Build) []*bbpb.RequestedDimension

func IsCompileStep

func IsCompileStep(step *bbpb.Step) bool

Check if a step is compile step. For the moment, we only check for the step name. In the future, we may want to check for step tag (crbug.com/1353978)

func MatchedNamedGroup

func MatchedNamedGroup(r *regexp.Regexp, s string) (map[string]string, error)

MatchedNamedGroup matches a string against a regex with named group and returns a mapping between the named group and the matches

func NormalizeFilePath

func NormalizeFilePath(fp string) string
 	NormalizeFilePath returns the normalized the file path.
	Strips leading "/" or "\"
	Converts "\\" and "//" to "/"
	Resolves ".." and "." from the file path
	e.g.
	//BUILD.gn  -> BUILD.gn
	../a/b/c.cc -> a/b/c.cc
	a/b/./c.cc  -> a/b/c.cc

func SendHTTPRequest

func SendHTTPRequest(c context.Context, req *http.Request, timeout time.Duration) (string, error)

func SortDimension

func SortDimension(dimensions []*pb.Dimension)

func StripExtensionAndCommonSuffixFromFileName

func StripExtensionAndCommonSuffixFromFileName(fileName string) string

StripExtensionAndCommonSuffix extension and common suffixes from file name. Examples: file_impl.cc, file_unittest.cc, file_impl_mac.h -> file

func StripExtensionAndCommonSuffixFromFilePath

func StripExtensionAndCommonSuffixFromFilePath(fp string) string

StripExtensionAndCommonSuffix extension and common suffixes from file path. Same as StripExtensionAndCommonSuffixFromFileName, but maintain the path. If the path is ".", just return the name.

func ToDimensionsPB

func ToDimensionsPB(dimensions []*bbpb.RequestedDimension) *pb.Dimensions

func ValidateProject

func ValidateProject(project string) error

func ValidateRefHash

func ValidateRefHash(refHash string) error

func ValidateVariantHash

func ValidateVariantHash(variantHash string) error

func VariantPB

func VariantPB(variant string) (*pb.Variant, error)

VariantPB convert json string representation of the variant into protocol buffer.

Types

This section is empty.

Directories

Path Synopsis
Package bqutil contains utility functions for BigQuery.
Package bqutil contains utility functions for BigQuery.
Package changelogutil contains utility functions for changelogs.
Package changelogutil contains utility functions for changelogs.
Package datastoreutil contains utility functions related to datastore entities
Package datastoreutil contains utility functions related to datastore entities
Package loggingutil contains utility functions for logging.
Package loggingutil contains utility functions for logging.
Package protoutil contains the utility functions to convert to protobuf.
Package protoutil contains the utility functions to convert to protobuf.
Package testutil contains utility functions for test.
Package testutil contains utility functions for test.

Jump to

Keyboard shortcuts

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