Documentation
¶
Index ¶
- func LoadOrganizationFromYML(dir string) string
- func LoadProjectFromYML(dir string) string
- func LoadRequireTraceFromYML(dir string) bool
- func LoadWorkflowFromYML(dir string) string
- func ResolveWorkflowName(persisted string) string
- func SaveOrganizationToYML(dir, org string) error
- func SaveProjectToYML(dir, project string) error
- func SaveRequireTraceToYML(dir string, val bool) error
- func SaveWorkflowToYML(dir, workflow string) error
- type ChainloopYML
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadOrganizationFromYML ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
SaveOrganizationToYML writes (or updates) the organization field in .chainloop.yml at the given directory, preserving any other fields.
func SaveProjectToYML ¶
SaveProjectToYML writes (or updates) the projectName field in .chainloop.yml (or .chainloop.yaml) at the given directory, preserving any other fields.
func SaveRequireTraceToYML ¶
SaveRequireTraceToYML writes (or updates) the requireTrace field in .chainloop.yml at the given directory, preserving any other fields.
func SaveWorkflowToYML ¶
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.