criercommonlib

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package criercommonlib contains shared lib used by reporters

Package criercommonlib contains shared lib used by reporters

Package criercommonlib contains shared lib used by reporters

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUserError

func IsUserError(err error) bool

IsUserError checks whether the returned error is a user error.

func UpdateReportStateWithRetries

func UpdateReportStateWithRetries(ctx context.Context, pj *prowv1.ProwJob, log *logrus.Entry, pjclientset ctrlruntimeclient.Client, reporterName string) error

func UserError

func UserError(err error) error

UserError wraps an error and return a userError error.

Types

type ShardedLock

type ShardedLock struct {
	// contains filtered or unexported fields
}

ShardedLock contains sharding information based on PRs

func NewShardedLock

func NewShardedLock() *ShardedLock

NewShardedLock creates ShardedLock

func (*ShardedLock) Cleanup

func (s *ShardedLock) Cleanup()

Cleanup deletes all locks by acquiring first the mapLock and then each individual lock before deleting it. The individual lock must be acquired because otherwise it may be held, we delete it from the map, it gets recreated and acquired and two routines report in parallel for the same job. Note that while this function is running, no new presubmit reporting can happen, as we hold the mapLock.

func (*ShardedLock) GetLock

func (s *ShardedLock) GetLock(ctx context.Context, key SimplePull) (*semaphore.Weighted, error)

GetLock aquires the lock for a PR

func (*ShardedLock) RunCleanup

func (s *ShardedLock) RunCleanup()

RunCleanup asynchronously runs the cleanup once per hour.

type SimplePull

type SimplePull struct {
	// contains filtered or unexported fields
}

SimplePull contains info for identifying a shard

func NewSimplePull

func NewSimplePull(org, repo string, number int) *SimplePull

NewSimplePull creates SimplePull

Jump to

Keyboard shortcuts

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