inventory

package
v0.0.0-...-2c9c3a5 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidGItURL = errors.New("invalid git scheme URL")

ErrInvalidGItURL unable to parse git scheme URL

Functions

func CompareURLs

func CompareURLs(a, b string) bool

CompareURLs compare the informed URLs.

func ExtractBuildNames

func ExtractBuildNames(results ...SearchResult) []string

ExtractBuildNames picks the build names from informed SearchResult slice.

func SanitizeURL

func SanitizeURL(rawURL string) (string, error)

SanitizeURL takes a raw repository URL and returns only the hostname and path, removing possible prefix protocol, and extension suffix.

Types

type Interface

type Interface interface {
	Add(*buildapi.Build)
	Remove(types.NamespacedName)
	SearchForObjectRef(buildapi.TriggerType, *buildapi.WhenObjectRef) []SearchResult
	SearchForGit(buildapi.TriggerType, string, string) []SearchResult
}

type Inventory

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

Inventory keeps track of Build object details, on which it can find objects that match the repository URL and trigger rules.

func NewInventory

func NewInventory() *Inventory

NewInventory instantiate the inventory.

func (*Inventory) Add

func (i *Inventory) Add(b *buildapi.Build)

Add insert or update an existing record.

func (*Inventory) Remove

func (i *Inventory) Remove(buildName types.NamespacedName)

Remove the informed entry from the cache.

func (*Inventory) SearchForGit

func (i *Inventory) SearchForGit(
	triggerType buildapi.TriggerType,
	repoURL string,
	branch string,
) []SearchResult

SearchForGit search for builds using the Git repository details, like the URL, branch name and such type of information.

func (*Inventory) SearchForObjectRef

func (i *Inventory) SearchForObjectRef(
	triggerType buildapi.TriggerType,
	objectRef *buildapi.WhenObjectRef,
) []SearchResult

SearchForObjectRef search for builds using the ObjectRef as query parameters.

type SearchFn

type SearchFn func(TriggerRules) bool

SearchFn search function signature.

type SearchResult

type SearchResult struct {
	BuildName  types.NamespacedName // build name matching criteria
	SecretName types.NamespacedName // respective secret coordinates (for webhook)
}

SearchResult contains a Inventory result item.

func (*SearchResult) HasSecret

func (s *SearchResult) HasSecret() bool

HasSecret assert if the SecretName is defined.

type TriggerRules

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

TriggerRules keeps the source and webhook trigger information for each Build instance.

Jump to

Keyboard shortcuts

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