resolver

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ActionsProtocol   = "actions://"
	ContainerProtocol = "container://"
)

Variables

View Source
var (
	ActionsBaseURL   = os.Getenv("ACTIONS_BASE_URL")
	ActionsToken     = coalesce(os.Getenv("ACTIONS_TOKEN"), os.Getenv("GITHUB_TOKEN"))
	ActionsUploadURL = os.Getenv("ACTIONS_UPLOAD_URL")
)

Functions

func DenormalizeRef

func DenormalizeRef(in string) string

DenormalizeRef removes the reference prefix.

func NormalizeActionsRef

func NormalizeActionsRef(in string) string

func NormalizeContainerRef

func NormalizeContainerRef(in string) string

Types

type Actions

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

Actions resolves GitHub references.

func NewActions

func NewActions(ctx context.Context) (*Actions, error)

NewActions creates a new resolver for GitHub Actions.

func (*Actions) LatestVersion added in v0.7.0

func (g *Actions) LatestVersion(ctx context.Context, value string) (string, error)

func (*Actions) Resolve

func (g *Actions) Resolve(ctx context.Context, value string) (string, error)

type Container

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

Container resolves Container registry references.

func NewContainer

func NewContainer(ctx context.Context) (*Container, error)

NewContainer creates a new resolver for Container registries.

func (*Container) Resolve

func (g *Container) Resolve(ctx context.Context, value string) (string, error)

type DefaultResolver

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

DefaultResolver is the default resolver.

func (*DefaultResolver) LatestVersion added in v0.7.0

func (r *DefaultResolver) LatestVersion(ctx context.Context, ref string) (string, error)

LatestVersion upgrades the ref.

func (*DefaultResolver) Resolve

func (r *DefaultResolver) Resolve(ctx context.Context, ref string) (string, error)

Resolve resolves the ref.

type GitHubRef

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

func ParseActionRef added in v0.2.0

func ParseActionRef(s string) (*GitHubRef, error)

type Resolver

type Resolver interface {
	// Resolve resolves the given reference, returning the resolved reference or
	// an error. If the provided context is canceled, the resolution is also
	// canceled.
	Resolve(context.Context, string) (string, error)

	// LatestVersion resolves the given reference to the most recent release version,
	// returning the resolved reference or an error. If the provided context is
	// canceled, the resolution is also canceled.
	LatestVersion(context.Context, string) (string, error)
}

Resolver is an interface that resolvers can implement.

func NewDefaultResolver

func NewDefaultResolver(ctx context.Context) (Resolver, error)

NewDefaultResolver returns the default resolver.

type Test

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

Test is a test resolver. It accepts a pre-defined list of results and panics if asked to resolve an undefined reference.

func NewTest

func NewTest(data, latest map[string]*TestResult) (*Test, error)

NewTest creates a new test resolver.

func (*Test) LatestVersion added in v0.7.0

func (t *Test) LatestVersion(ctx context.Context, value string) (string, error)

func (*Test) Resolve

func (t *Test) Resolve(ctx context.Context, value string) (string, error)

type TestResult

type TestResult struct {
	Resolved string
	Err      error
}

TestResult represents the result of a resolution. If Err is not nil, Resolved is the empty string.

Jump to

Keyboard shortcuts

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