parser

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: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check added in v0.1.2

func Check(ctx context.Context, parser Parser, nodes []*yaml.Node) error

Check iterates over all references in the yaml and checks if they are pinned to an absolute reference. It ignores "ratchet:exclude" nodes from the lookup.

func List

func List() []string

List returns the list of parsers.

func Pin

func Pin(ctx context.Context, res resolver.Resolver, parser Parser, nodes []*yaml.Node, concurrency int64) error

Pin extracts all references from the given YAML document and resolves them using the given resolver, updating the associated YAML nodes.

func Unpin

func Unpin(ctx context.Context, nodes []*yaml.Node) error

Unpin removes any pinned references and updates the actual YAML to be the original reference, leaving any other comment intact. This effectively replaces the YAML with the cached comment, which could result in losing the current pin.

This function does not make any outbound network calls and relies solely on information in the document.

func Upgrade added in v0.7.0

func Upgrade(ctx context.Context, res resolver.Resolver, parser Parser, nodes []*yaml.Node, concurrency int64) error

Types

type Actions

type Actions struct{}

func (*Actions) Parse

func (a *Actions) Parse(nodes []*yaml.Node) (*RefsList, error)

Parse pulls the GitHub Actions refs from the documents.

type CircleCI added in v0.2.0

type CircleCI struct{}

func (*CircleCI) Parse added in v0.2.0

func (c *CircleCI) Parse(nodes []*yaml.Node) (*RefsList, error)

Parse pulls the CircleCI refs from the documents. Unfortunately it does not process "orbs" because there is no documented API for resolving orbs to an absolute version.

type CloudBuild

type CloudBuild struct{}

func (*CloudBuild) Parse

func (c *CloudBuild) Parse(nodes []*yaml.Node) (*RefsList, error)

Parse pulls the Google Cloud Build refs from the documents.

type Drone added in v0.4.0

type Drone struct{}

func (*Drone) Parse added in v0.4.0

func (d *Drone) Parse(nodes []*yaml.Node) (*RefsList, error)

Parse pulls the Drone Ci refs from the documents.

type GitLabCI added in v0.3.1

type GitLabCI struct{}

func (*GitLabCI) Parse added in v0.3.1

func (c *GitLabCI) Parse(nodes []*yaml.Node) (*RefsList, error)

Parse pulls the image references from GitLab CI configuration files. It does not support references with variables.

type Parser

type Parser interface {
	Parse(nodes []*yaml.Node) (*RefsList, error)
}

Parser defines an interface which parses references out of the given yaml node.

func For

func For(ctx context.Context, name string) (Parser, error)

For returns the parser that corresponds to the given name.

type RefsList

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

func (*RefsList) Add

func (l *RefsList) Add(ref string, m *yaml.Node)

func (*RefsList) All

func (l *RefsList) All() map[string][]*yaml.Node

func (*RefsList) Refs

func (l *RefsList) Refs() []string

type Tekton added in v0.9.0

type Tekton struct{}

func (*Tekton) Parse added in v0.9.0

func (d *Tekton) Parse(nodes []*yaml.Node) (*RefsList, error)

Parse pulls the Tekton Ci refs from the documents.

Jump to

Keyboard shortcuts

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