config

package
v1.108.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadOrganizationFromYML

func LoadOrganizationFromYML(dir string) string

LoadOrganizationFromYML looks for .chainloop.yml starting from dir and returns the organization value. Returns empty string when the field is absent. Unlike FindChainloopYML, this does not require projectName to be set.

func LoadProjectFromYML

func LoadProjectFromYML(dir string) string

LoadProjectFromYML looks for a .chainloop.yml (or .chainloop.yaml) file starting from dir and walking up to the git repository root. Returns the projectName if found, or empty string if not found.

func LoadRequireTraceFromYML

func LoadRequireTraceFromYML(dir string) bool

LoadRequireTraceFromYML looks for .chainloop.yml starting from dir and returns the requireTrace value. Returns false when the field is absent or nil (default-off). Unlike FindChainloopYML, this does not require projectName to be set.

func LoadWorkflowFromYML

func LoadWorkflowFromYML(dir string) string

LoadWorkflowFromYML looks for .chainloop.yml starting from dir and returns the workflowName value. Returns empty string when the field is absent. Unlike FindChainloopYML, this does not require projectName to be set.

func ResolveWorkflowName

func ResolveWorkflowName(persisted string) string

ResolveWorkflowName returns the persisted workflow name when non-empty, otherwise falls back to the trace default. Centralizes the default so the CLI command and the hook handler stay in sync.

func SaveOrganizationToYML

func SaveOrganizationToYML(dir, org string) error

SaveOrganizationToYML writes (or updates) the organization field in .chainloop.yml at the given directory, preserving any other fields.

func SaveProjectToYML

func SaveProjectToYML(dir, project string) error

SaveProjectToYML writes (or updates) the projectName field in .chainloop.yml (or .chainloop.yaml) at the given directory, preserving any other fields.

func SaveRequireTraceToYML

func SaveRequireTraceToYML(dir string, val bool) error

SaveRequireTraceToYML writes (or updates) the requireTrace field in .chainloop.yml at the given directory, preserving any other fields.

func SaveWorkflowToYML

func SaveWorkflowToYML(dir, workflow string) error

SaveWorkflowToYML writes (or updates) the workflowName field in .chainloop.yml at the given directory, preserving any other fields.

Types

type ChainloopYML

type ChainloopYML struct {
	ProjectName    string `yaml:"projectName"`
	ProjectVersion string `yaml:"projectVersion"`
	// Organization, when set, forces trace attestations (init, add, push)
	// to target that organization instead of the CLI's default.
	Organization string `yaml:"organization,omitempty"`
	// RequireTrace controls whether the pre-push hook blocks the push
	// on attestation failure. nil is treated as false (default-off).
	RequireTrace *bool `yaml:"requireTrace,omitempty"`
	// WorkflowName, when set, overrides the default trace workflow name
	// used when initializing attestations from trace hooks.
	WorkflowName string `yaml:"workflowName,omitempty"`
}

ChainloopYML represents the relevant fields in .chainloop.yml.

func FindChainloopYML

func FindChainloopYML(dir string) *ChainloopYML

FindChainloopYML looks for a .chainloop.yml (or .chainloop.yaml) file starting from dir and walking up to the git repository root. Returns the parsed config if found (with a non-empty projectName), or nil.

Jump to

Keyboard shortcuts

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