Documentation
¶
Index ¶
- Variables
- func AllTrue[K comparable](m map[K]bool) bool
- func AppendStringToFile(filename, text string)
- func Average(data []int) int
- func CheckIfImageHasRequiredAttestations(image name.Reference, cosignClient CosignAttestationClient, ...) (map[AttestationType]bool, error)
- func Contains[T comparable](s []T, e T) bool
- func ExtractBaseURL(u string) (string, error)
- func Filter[T any](s []T, f func(T) bool) []T
- func Find[T any](s []T, f func(T) bool) *T
- func Flatten[T any](s [][]T) []T
- func FormatContributorsByValue(obfuscatedContributors map[string]int, unit string) string
- func FormatStringBoolMap[K ~string](data map[K]bool) string
- func GetBytesFromAPI(ctx context.Context, URL string, httpHeader map[string]string) ([]byte, error)
- func GetEnvOrNil(key string) *string
- func GetEnvWithDefault[T string](key string, defaultValue string) string
- func GetIndexOfLargestElement[T cmp.Ordered](s []T) int
- func GetIndexOfSmallestElement[T cmp.Ordered](s []T) int
- func GetJSONFromAPI(ctx context.Context, target any, URL string) error
- func GetOrDefault[T any](val *T, deflt T) T
- func GetOrDefaultStr(val *string, deflt string) string
- func Index[T comparable](s []T, e T) int
- func IsImageValidSemVer(image string) (name.Reference, *semver.Version, error)
- func Map[T, U any](s []T, f func(T) U) []U
- func Median(data []int) int
- func ObfuscateEmail(val string) string
- func ObfuscateEmails(mapping map[string]int) map[string]int
- func ObfuscateString(val string) string
- func Ptr[T any](v T) *T
- func Reduce[T any, U any](s []T, f func(U, T) U, initial U) U
- func SafeDeref(ptr *int) string
- func TimeMidnight(t time.Time) time.Time
- func TimeMidnightOffsetDays(t time.Time, days int) time.Time
- func TimeMidnightOffsetMonth(month int) time.Time
- func TimeMidnightTomorrow() time.Time
- func ToDescriptionString[T Describer](elements []T) string
- func Unique[T comparable](s []T) []T
- func UniqueBy[T any, U comparable](s []T, extractor func(el T) U) []T
- func WaitAll[T any](tasks []func() (T, error)) ([]T, error)
- type AttestationType
- type Branch
- type CIPipeline
- type Commit
- type CommitRef
- type CommitVerificationStatus
- type ContainerRegistryTag
- type CosignAttestationClient
- type CosignAttestationClientImpl
- type DateRangeListOptions
- type Describer
- type GetCommitOptions
- type GetProjectOptions
- type Issue
- type IssueEvent
- type IssueState
- type KeyInt
- type ListCIPipelineRunsOptions
- type ListCommitsOptions
- type ListMergeRequestsOptions
- type ListReleasesOptions
- type ListTagsOptions
- type MergeRequest
- type MergeRequestApprovals
- type Package
- type Project
- type ProjectMember
- type ProtectedBranch
- type ProtectedTag
- type RateLimiter
- type Release
- type RpsRateLimiter
- type Tag
- type TagSignature
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrForbidden = errors.New("forbidden") ErrNotSupported = errors.New("not supported by this git provider") )
Sentinel errors that git clients translate provider errors into, so observers can react without knowing the provider's error shape.
View Source
var AllAttestationTypes = []AttestationType{ BuildProvenance, SourceProvenance, SARIF, SBOM, VEX, }
View Source
var AttestationRegex = map[AttestationType][]*regexp.Regexp{ SBOM: { regexp.MustCompile(`^https://cyclonedx\.org/bom(/v[\d\.]+)?$`), regexp.MustCompile(`^https://spdx\.dev/Document/v[\d\.]+$`), }, VEX: { regexp.MustCompile(`^https://cyclonedx\.org/vex$`), }, SARIF: { regexp.MustCompile(`^https://www\.schemastore\.org/schemas/json/sarif-[\d\.]+.json$`), }, BuildProvenance: { regexp.MustCompile(`^https://slsa\.dev/provenance/v[\d\.]+$`), regexp.MustCompile(`^https://cosign\.sigstore\.dev/attestation/v[\d\.]+$`), }, SourceProvenance: { regexp.MustCompile(`^https://gitlab\.opencode\.de/open-code/badgebackend/source-provenance-attestation-service/schema/source-provenance-report-v[\d]+$`), regexp.MustCompile(`^https://gitlab\.opencode\.de/open-code/badgebackend/source-provenance-attestation-service/-/raw/main/schema/source-provenance-schema-1\.0\.0\.json$`), }, }
Functions ¶
func AllTrue ¶
func AllTrue[K comparable](m map[K]bool) bool
func CheckIfImageHasRequiredAttestations ¶
func CheckIfImageHasRequiredAttestations(image name.Reference, cosignClient CosignAttestationClient, attestationTypes []AttestationType) (map[AttestationType]bool, error)
func Contains ¶
func Contains[T comparable](s []T, e T) bool
func FormatContributorsByValue ¶
func GetBytesFromAPI ¶
func Index ¶
func Index[T comparable](s []T, e T) int
func IsImageValidSemVer ¶
func ObfuscateString ¶
Obfuscate string by replacing all chars in the middle with * while allowing special chars like dots and dashes (e.g. david.luhmer would be d***.*****r)
func TimeMidnightOffsetMonth ¶
today 0am X month ago
func Unique ¶
func Unique[T comparable](s []T) []T
func UniqueBy ¶
func UniqueBy[T any, U comparable](s []T, extractor func(el T) U) []T
Types ¶
type AttestationType ¶
type AttestationType string
const ( SBOM AttestationType = "sbom" VEX AttestationType = "vex" SARIF AttestationType = "sarif" BuildProvenance AttestationType = "build-provenance" SourceProvenance AttestationType = "source-provenance" )
type Branch ¶
type CIPipeline ¶
type Commit ¶
type CommitVerificationStatus ¶
type ContainerRegistryTag ¶
type CosignAttestationClient ¶
type CosignAttestationClientImpl ¶
type CosignAttestationClientImpl struct {
// contains filtered or unexported fields
}
func NewCosignAttestationClient ¶
func NewCosignAttestationClient(opts ...cosignRemote.Option) *CosignAttestationClientImpl
type DateRangeListOptions ¶
type GetCommitOptions ¶
type GetCommitOptions struct {
}
type Issue ¶
type IssueEvent ¶
type IssueState ¶
type IssueState string
const ( IssueStateOpen IssueState = "open" IssueStateClosed IssueState = "closed" )
type KeyInt ¶
type ListCIPipelineRunsOptions ¶
type ListCommitsOptions ¶
type ListMergeRequestsOptions ¶
type ListReleasesOptions ¶
type ListTagsOptions ¶
type MergeRequest ¶
type MergeRequestApprovals ¶
type Project ¶
type ProjectMember ¶
type ProtectedBranch ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter(limit int, gauge gauge) *RateLimiter
func (*RateLimiter) Done ¶
func (r *RateLimiter) Done()
func (*RateLimiter) Wait ¶
func (r *RateLimiter) Wait()
type Release ¶
type RpsRateLimiter ¶
type RpsRateLimiter struct {
// contains filtered or unexported fields
}
func NewRpsLimiter ¶
func NewRpsLimiter(maxRequestsPerSecond int, gauge gauge) *RpsRateLimiter
Requests per second limiter
func (*RpsRateLimiter) Done ¶
func (r *RpsRateLimiter) Done()
func (*RpsRateLimiter) Wait ¶
func (r *RpsRateLimiter) Wait()
type Tag ¶
Source Files
¶
- concurrency.go
- cosign.go
- errors.go
- file-io.go
- http-api.go
- oci_attestation.go
- ratelimiter.go
- slices.go
- types.go
- utils.go
Click to show internal directories.
Click to hide internal directories.