catalog

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCatalog

func AddCatalog(name string, url string, types []string)

func LoadSources

func LoadSources() map[string]*Source

func RemoveCatalog

func RemoveCatalog(name string)

func SaveToFile

func SaveToFile(registry *Config, file string) error

func UpdateAllCatalogs

func UpdateAllCatalogs()

func UpdateCatalog

func UpdateCatalog(name string, source *Source) error

Types

type Action

type Action struct {
	Repository string          `yaml:"repository,omitempty"`
	Type       ActionType      `required:"true" yaml:"type"`
	Container  ContainerAction `yaml:"container,omitempty"` // Container contains the configuration for containerized actions
	Version    string          `yaml:"version,omitempty"`
	Metadata   ActionMetadata  `yaml:"metadata"`
}

type ActionAccess

type ActionAccess struct {
	Environment []ActionAccessEnv        `json:"env,omitempty"`         // Environment variables that the action may access during execution
	Executables []ActionAccessExecutable `json:"executables,omitempty"` // Executables that the action may invoke during execution
}

type ActionAccessEnv added in v0.5.0

type ActionAccessEnv struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Pattern     bool   `json:"pattern,omitempty"`
	Required    bool   `json:"required,omitempty"`
}

type ActionAccessExecutable added in v0.5.0

type ActionAccessExecutable struct {
	Name       string `json:"name"`
	Constraint string `json:"constraint,omitempty"`
}

type ActionMetadata added in v0.5.0

type ActionMetadata struct {
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Category    string            `json:"category"`
	Scope       ActionScope       `json:"scope"`
	Links       map[string]string `json:"links,omitempty"`
	Rules       []WorkflowRule    `yaml:"rules,omitempty"`  // Rules define conditions that must be met for the action to be executed
	Access      ActionAccess      `json:"access,omitempty"` // Access defines resources that the action may access
}

type ActionScope

type ActionScope string
const (
	ActionScopeProject ActionScope = "project"
	ActionScopeModule  ActionScope = "module"
)

type ActionType

type ActionType string
const (
	ActionTypeContainer    ActionType = "container"
	ActionTypeGitHubAction ActionType = "githubaction"
)

type Config

type Config struct {
	// Actions
	Actions []Action `yaml:"actions,omitempty"`

	// Workflows
	Workflows []Workflow `yaml:"workflows,omitempty"`
}

Config is a registry configuration with placeholders

func LoadCatalogs

func LoadCatalogs(sources map[string]*Source) Config

func LoadFromDirectory

func LoadFromDirectory(dir string) (*Config, error)

func LoadFromFile

func LoadFromFile(file string) (*Config, error)

func ProcessCatalog

func ProcessCatalog(catalog *Config) *Config

func (*Config) FindAction

func (r *Config) FindAction(name string) *Action

FindAction finds an action by id

func (*Config) FindWorkflow

func (r *Config) FindWorkflow(id string) *Workflow

FindWorkflow finds a workflow by name

type ContainerAction

type ContainerAction struct {
	Image   string       `yaml:"image"`   // Image is the full image reference including the registry
	Command string       `yaml:"command"` // Command is the command that should be executed in the container image to start the action.
	Certs   []ImageCerts `yaml:"certs,omitempty"`
}

type ContainerImage

type ContainerImage struct {
	Repository string           `yaml:"repository,omitempty"`
	Image      string           `yaml:"image"`
	Digest     string           `yaml:"digest,omitempty"`
	Provides   []ProvidedBinary `yaml:"provides"`
	Cache      []ImageCache     `yaml:"cache,omitempty"`
	Security   Security         `yaml:"security,omitempty"`
	User       string           `yaml:"user,omitempty"`
	Entrypoint *string          `yaml:"entrypoint,omitempty"`
	Certs      []ImageCerts     `yaml:"certs,omitempty"`

	Mounts []ContainerMount `yaml:"mounts,omitempty"` // Mounts
	Source ImageSource      `yaml:"source,omitempty"` // Source
}

type ContainerMount

type ContainerMount struct {
	Src  string `yaml:"src"`
	Dest string `yaml:"dest"`
}

type ImageCache

type ImageCache struct {
	ID            string `yaml:"id"`
	ContainerPath string `yaml:"dir"`
	MountType     string `yaml:"type,omitempty"`
}

type ImageCerts

type ImageCerts struct {
	Type          string `yaml:"type"`
	ContainerPath string `yaml:"dir"`
}

type ImageSource

type ImageSource struct {
	RegistryURL string `yaml:"registry_url"`
}

type ProvidedBinary

type ProvidedBinary struct {
	Binary  string   `yaml:"binary"`
	Version string   `yaml:"version"`
	Alias   []string `yaml:"alias,omitempty"`
}

type Security

type Security struct {
	Capabilities []string `yaml:"capabilities,omitempty"`
	Privileged   bool     `yaml:"privileged,omitempty"`
}

type Source

type Source struct {
	URI       string   `json:"uri"`
	AddedAt   string   `json:"added_at"`
	UpdatedAt string   `json:"updated_at"`
	SHA256    string   `json:"sha256"`
	Filter    []string `json:"filter"`
}

type Workflow

type Workflow struct {
	Repository  string          `yaml:"repository,omitempty"`
	Name        string          `required:"true" yaml:"name,omitempty"`
	Description string          `yaml:"description,omitempty"`
	Version     string          `yaml:"version,omitempty"`
	Rules       []WorkflowRule  `yaml:"rules,omitempty"`
	Stages      []WorkflowStage `yaml:"stages,omitempty"`
}

func (*Workflow) ActionCount

func (w *Workflow) ActionCount() int

ActionCount returns the total count of actions across all stages

type WorkflowAction

type WorkflowAction struct {
	ID     string                     `required:"true" yaml:"id"`
	Rules  []WorkflowRule             `yaml:"rules,omitempty"`
	Config interface{}                `yaml:"config,omitempty"`
	Module *analyzerapi.ProjectModule `yaml:"-"`
}

type WorkflowExpressionType

type WorkflowExpressionType string
const (
	WorkflowExpressionCEL WorkflowExpressionType = "cel"
)

type WorkflowRule

type WorkflowRule struct {
	Type       WorkflowExpressionType `default:"cel" yaml:"type,omitempty"`
	Expression string                 `yaml:"expression,omitempty"`
}

type WorkflowStage

type WorkflowStage struct {
	Name    string           `required:"true" yaml:"name,omitempty"`
	Rules   []WorkflowRule   `yaml:"rules,omitempty"`
	Actions []WorkflowAction `yaml:"actions,omitempty"`
}

Jump to

Keyboard shortcuts

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