action

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: 72 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyViolationBlockingStrategyEnforced = "ENFORCED"
	PolicyViolationBlockingStrategyAdvisory = "ADVISORY"
)
View Source
const AttestationResetTriggerCancelled = "cancellation"
View Source
const AttestationResetTriggerFailed = "failure"
View Source
const (
	KindContract = "Contract"
)

Variables

View Source
var ErrAttestationAlreadyExist = errors.New("attestation already initialized")

ErrAttestationAlreadyExist means that there is an attestation in progress

View Source
var ErrAttestationNotInitialized = errors.New("attestation not yet initialized")
View Source
var ValidCollectors = []string{aiConfigCollectorName}

ValidCollectors is the list of known collector names accepted by --collectors.

View Source
var WorkflowRunStatus = func() map[string]pb.RunStatus {
	res := make(map[string]pb.RunStatus)
	for k, v := range pb.RunStatus_value {
		if k != "RUN_STATUS_UNSPECIFIED" {
			res[strings.Replace(k, "RUN_STATUS_", "", 1)] = pb.RunStatus(v)
		}
	}
	return res
}

WorkflowRunStatus represents the status of a workflow run

Functions

func ApplyContractFromRawData added in v1.80.0

func ApplyContractFromRawData(ctx context.Context, conn *grpc.ClientConn, rawData []byte) (bool, error)

ApplyContractFromRawData applies a single contract document using the gRPC client.

func AttestationStatePath added in v1.81.0

func AttestationStatePath(customPath string) string

AttestationStatePath returns the resolved path for local attestation state. If customPath is non-empty it is returned as-is; otherwise the default temp-dir location is used.

func CleanupTrace added in v1.108.0

func CleanupTrace(store *state.Store, repoRoot string, log zerolog.Logger) error

CleanupTrace removes the store's chainloop-trace state, the managed git hooks, and every known provider's agent hooks. A store outside a repository had no git hooks installed in the first place, and the state directory itself is trace run's to remove. Every step runs even when an earlier one failed so partial cleanup still progresses; the joined error is returned for callers that need to fail loudly (e.g. trace uninstall). Callers that want best-effort cleanup (e.g. trace run's defer) can ignore the result.

func CollectYAMLFiles added in v1.80.0

func CollectYAMLFiles(path string) ([]string, error)

CollectYAMLFiles returns YAML file paths from the given path. If path is a file, it returns that file. If a directory, it walks recursively.

func ExtractColumnValues added in v1.103.0

func ExtractColumnValues(path, column string) ([]string, error)

ExtractColumnValues reads the given CSV or JSON file and returns the values of the named column/field. Format is detected by extension, with a content-sniff fallback. Empty and whitespace-only values are dropped. CSV parsing reuses the tabular parser (BOM decoding, comma/tab auto-detection, case-insensitive header match).

func HandleAgentPostToolUse added in v1.108.0

func HandleAgentPostToolUse(provider trace.Provider, log zerolog.Logger) error

HandleAgentPostToolUse handles post-edit hooks across providers (Claude's post-tool-use, Cursor's afterFileEdit) and records AI-attributed line ranges for the edited file.

func HandleAgentPreToolUse added in v1.108.0

func HandleAgentPreToolUse(provider trace.Provider, log zerolog.Logger) error

HandleAgentPreToolUse handles the agent pre-tool-use hook.

func HandleAgentSessionEnd added in v1.108.0

func HandleAgentSessionEnd(provider trace.Provider, log zerolog.Logger) error

HandleAgentSessionEnd handles the agent session-end hook.

func HandleAgentSessionStart added in v1.108.0

func HandleAgentSessionStart(provider trace.Provider, log zerolog.Logger) error

HandleAgentSessionStart handles the agent session-start hook.

func HandleCommitMsgHook added in v1.108.0

func HandleCommitMsgHook(_ context.Context, msgFilePath string, log zerolog.Logger) error

HandleCommitMsgHook appends a Chainloop-Trace-Sessions trailer to the commit message when AI sessions have modified files staged for commit. Errors are logged but never returned (to avoid blocking commits).

func HandlePostCommitHook added in v1.108.0

func HandlePostCommitHook(ctx context.Context, log zerolog.Logger) error

HandlePostCommitHook handles the post-commit git hook. Errors are logged but never returned (to avoid blocking commits).

func HandlePrePushHook added in v1.108.0

func HandlePrePushHook(ctx context.Context, requireTrace bool, log zerolog.Logger, opts RunTracePushOpts) error

HandlePrePushHook handles the pre-push git hook. When requireTrace is true, errors from the attestation push are propagated so that the git push is blocked. When false, errors are logged but never returned.

func LoadFileOrURL

func LoadFileOrURL(fileRef string) ([]byte, error)

LoadFileOrURL loads a file from a local path or a URL

func RunTracePush added in v1.108.0

func RunTracePush(ctx context.Context, log zerolog.Logger, opts RunTracePushOpts) error

RunTracePush gathers AI-coding-session evidence from the local trace state and emits a Chainloop attestation. Shared between the pre-push git hook and `chainloop trace run`.

func TraceRun added in v1.108.0

func TraceRun(ctx context.Context, log zerolog.Logger, opts TraceRunOpts) error

TraceRun wraps a single-shot agent invocation: it cleans any prior trace state, installs the trace-run subset of git and agent hooks, runs the wrapped command, then attests the session and tears everything down. Errors from the wrapped command are surfaced as SubprocessExitError so the caller can propagate the exit code.

func ValidateAndExtractName added in v1.50.0

func ValidateAndExtractName(explicitName, filePath string) (string, error)

ValidateAndExtractName validates and extracts a name from either an explicit name parameter OR from metadata.name in the file content. Returns error when: - Neither explicit name nor metadata.name is provided - Both are provided and they differ (providing both with the same value is allowed)

Types

type APITokenCreate

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

func NewAPITokenCreate

func NewAPITokenCreate(cfg *ActionsOpts) *APITokenCreate

func (*APITokenCreate) Run

func (action *APITokenCreate) Run(ctx context.Context, name, description, projectName string, expiresIn *time.Duration) (*APITokenItem, error)

type APITokenItem

type APITokenItem struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	// JWT is returned only during the creation
	JWT          string        `json:"jwt,omitempty"`
	CreatedAt    *time.Time    `json:"createdAt"`
	RevokedAt    *time.Time    `json:"revokedAt,omitempty"`
	ExpiresAt    *time.Time    `json:"expiresAt,omitempty"`
	LastUsedAt   *time.Time    `json:"lastUsedAt,omitempty"`
	ScopedEntity *ScopedEntity `json:"scopedEntity,omitempty"`
}

type APITokenList

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

func NewAPITokenList

func NewAPITokenList(cfg *ActionsOpts) *APITokenList

func (*APITokenList) Run

func (action *APITokenList) Run(ctx context.Context, statusFilter string, project string, scope string) ([]*APITokenItem, error)

type APITokenRevoke

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

func NewAPITokenRevoke

func NewAPITokenRevoke(cfg *ActionsOpts) *APITokenRevoke

func (*APITokenRevoke) Run

func (action *APITokenRevoke) Run(ctx context.Context, id string) error

type ActionsOpts

type ActionsOpts struct {
	CPConnection *grpc.ClientConn
	Logger       zerolog.Logger
	AuthTokenRaw string
	OutputFormat string
	CLIVersion   string
}

type Annotation

type Annotation struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Apply added in v1.80.0

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

Apply handles applying resources from YAML files

func NewApply added in v1.80.0

func NewApply(cfg *ActionsOpts) *Apply

NewApply creates a new Apply action

func (*Apply) Run added in v1.80.0

func (a *Apply) Run(ctx context.Context, path string) ([]*ApplyResult, error)

Run applies all resources found in the given path (file or directory)

type ApplyResult added in v1.80.0

type ApplyResult struct {
	Kind    string
	Name    string
	Changed bool
}

ApplyResult holds the outcome of a successfully applied resource document

type ArtifactDownload

type ArtifactDownload struct {
	*ActionsOpts
	// contains filtered or unexported fields
}

func NewArtifactDownload

func NewArtifactDownload(opts *ArtifactDownloadOpts) *ArtifactDownload

func (*ArtifactDownload) Run

func (a *ArtifactDownload) Run(downloadPath, outputFile, digest string) error

type ArtifactDownloadOpts

type ArtifactDownloadOpts struct {
	*ActionsOpts
	ArtifactsCASConn *grpc.ClientConn
	Stdout           io.Writer
}

type ArtifactUpload

type ArtifactUpload struct {
	*ActionsOpts
	// contains filtered or unexported fields
}

func NewArtifactUpload

func NewArtifactUpload(opts *ArtifactUploadOpts) *ArtifactUpload

func (*ArtifactUpload) Run

func (a *ArtifactUpload) Run(filePath string) (*CASArtifact, error)

type ArtifactUploadOpts

type ArtifactUploadOpts struct {
	*ActionsOpts
	ArtifactsCASConn *grpc.ClientConn
}

type AttachedIntegrationAdd

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

Attach a third party integration to a workflow

func NewAttachedIntegrationAdd

func NewAttachedIntegrationAdd(cfg *ActionsOpts) *AttachedIntegrationAdd

func (*AttachedIntegrationAdd) Run

func (action *AttachedIntegrationAdd) Run(integrationName, workflowName, projectName string, options map[string]any) (*AttachedIntegrationItem, error)

type AttachedIntegrationDelete

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

func NewAttachedIntegrationDelete

func NewAttachedIntegrationDelete(cfg *ActionsOpts) *AttachedIntegrationDelete

func (*AttachedIntegrationDelete) Run

func (action *AttachedIntegrationDelete) Run(attachmentID string) error

type AttachedIntegrationItem

type AttachedIntegrationItem struct {
	ID          string                     `json:"id"`
	CreatedAt   *time.Time                 `json:"createdAt"`
	Config      map[string]interface{}     `json:"config"`
	Integration *RegisteredIntegrationItem `json:"integration"`
	Workflow    *WorkflowItem              `json:"workflow"`
}

type AttachedIntegrationList

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

func NewAttachedIntegrationList

func NewAttachedIntegrationList(cfg *ActionsOpts) *AttachedIntegrationList

func (*AttachedIntegrationList) Run

func (action *AttachedIntegrationList) Run(projectName, workflowName string) ([]*AttachedIntegrationItem, error)

type AttestationAdd

type AttestationAdd struct {
	*ActionsOpts
	// contains filtered or unexported fields
}

func NewAttestationAdd

func NewAttestationAdd(cfg *AttestationAddOpts) (*AttestationAdd, error)

func (*AttestationAdd) GetPolicyEvaluations

func (action *AttestationAdd) GetPolicyEvaluations(ctx context.Context, attestationID string) (map[string][]*PolicyEvaluation, error)

GetPolicyEvaluations is a Wrapper around the getPolicyEvaluations

func (*AttestationAdd) Run

func (action *AttestationAdd) Run(ctx context.Context, attestationID, materialName, materialValue, materialType string, annotations map[string]string, policyInputFiles []*PolicyInputFromFile, policyInputs []*PolicyInput) ([]*AttestationStatusMaterial, error)

type AttestationAddOpts

type AttestationAddOpts struct {
	*ActionsOpts
	ArtifactsCASConn   *grpc.ClientConn
	CASURI             string
	CASCAPath          string // optional CA certificate for the CAS connection
	ConnectionInsecure bool
	// OCI registry credentials used for CONTAINER_IMAGE material type
	RegistryServer, RegistryUsername, RegistryPassword string
	LocalStatePath                                     string
	// NoStrictValidation skips strict schema validation
	NoStrictValidation bool
	// SkipSecretRedaction uploads evidence that would normally be scrubbed
	// exactly as captured. The bypass is recorded in the attestation.
	SkipSecretRedaction bool
	// MaxExtractEntries limits the number of entries extracted from an archive.
	// Zero defaults to materials.DefaultArchiveLimits().MaxEntries.
	MaxExtractEntries int
	// MaxExtractSize limits the total uncompressed bytes extracted from an archive.
	// Zero defaults to materials.DefaultArchiveLimits().MaxTotalSize.
	MaxExtractSize int64
}

type AttestationExecutor added in v1.108.0

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

AttestationExecutor calls the attestation actions directly via their Go API rather than shelling out, so `chainloop trace` can drive a full init/add/push cycle in-process.

func NewAttestationExecutor added in v1.108.0

func NewAttestationExecutor(base *ActionsOpts, cliVersion string, opts ...ExecutorOption) (*AttestationExecutor, error)

NewAttestationExecutor creates an executor from the root command's already initialized ActionsOpts. Commands using it must NOT set skipActionOptsInit, or base will be nil. cliVersion is recorded in the attestation predicate and must be the bare version (cmd.Version), not ActionsOpts.CLIVersion, which carries an edition suffix.

func (*AttestationExecutor) AddEvidence added in v1.108.0

func (e *AttestationExecutor) AddEvidence(ctx context.Context, name, filePath string) error

AddEvidence adds an evidence material to the attestation. Empty attestation ID is passed upstream so the crafter uses LocalStatePath instead of forcing remote state.

func (*AttestationExecutor) CheckAuth added in v1.108.0

func (e *AttestationExecutor) CheckAuth(_ context.Context) error

CheckAuth verifies the CLI can reach the control plane.

func (*AttestationExecutor) Close added in v1.108.0

func (e *AttestationExecutor) Close() error

Close releases resources owned by the executor, currently any control-plane connection created via WithForcedOrganization. Safe to call multiple times.

func (*AttestationExecutor) Init added in v1.108.0

func (e *AttestationExecutor) Init(ctx context.Context, workflow, project, version string) (string, error)

Init starts a new attestation and returns the workflow run ID. It uses a local state path to avoid conflicts with concurrent attestations. When version is empty the latest project version is used; otherwise the attestation targets that specific version.

func (*AttestationExecutor) Push added in v1.108.0

Push finalizes and pushes the attestation.

func (*AttestationExecutor) Reset added in v1.108.0

func (e *AttestationExecutor) Reset(ctx context.Context, trigger, reason string) error

Reset cancels the current attestation.

type AttestationInit

type AttestationInit struct {
	*ActionsOpts
	// contains filtered or unexported fields
}

func NewAttestationInit

func NewAttestationInit(cfg *AttestationInitOpts) (*AttestationInit, error)

func (*AttestationInit) Run

type AttestationInitOpts

type AttestationInitOpts struct {
	*ActionsOpts
	DryRun bool
	// Force the initialization and override any existing, in-progress ones.
	// Note that this is only useful when local-based attestation state is configured
	// since it's a protection to make sure you don't override the state by mistake
	Force              bool
	UseRemoteState     bool
	LocalStatePath     string
	CASURI             string
	CASCAPath          string // optional CA certificate for the CAS connection
	ConnectionInsecure bool
}

type AttestationInitRunOpts

type AttestationInitRunOpts struct {
	ContractRevision             int
	ProjectName                  string
	ProjectVersion               string
	UseLatestVersion             bool
	ProjectVersionMarkAsReleased bool
	RequireExistingVersion       bool
	WorkflowName                 string
	NewWorkflowContractRef       string
	// Collectors is a list of additional collector names to enable (e.g. "aiconfig")
	Collectors   []string
	MarkAsLatest *bool
	// PRMode overrides PR/MR auto-detection.
	// nil  → auto-detect from the CI runner environment.
	// true → force PR mode on.
	// false → force PR mode off.
	PRMode *bool
}

returns the attestation ID

type AttestationPush

type AttestationPush struct {
	*ActionsOpts
	// contains filtered or unexported fields
}

func NewAttestationPush

func NewAttestationPush(cfg *AttestationPushOpts) (*AttestationPush, error)

func (*AttestationPush) Run

func (action *AttestationPush) Run(ctx context.Context, attestationID string, runtimeAnnotations map[string]string, bypassPolicyCheck bool) (*AttestationResult, error)

type AttestationPushOpts

type AttestationPushOpts struct {
	*ActionsOpts
	KeyPath, CLIVersion, CLIDigest, BundlePath string
	CASURI                                     string
	CASCAPath                                  string
	ConnectionInsecure                         bool
	LocalStatePath                             string
	SignServerOpts                             *SignServerOpts
}

type AttestationReset

type AttestationReset struct {
	*ActionsOpts
	// contains filtered or unexported fields
}

func NewAttestationReset

func NewAttestationReset(cfg *AttestationResetOpts) (*AttestationReset, error)

func (*AttestationReset) Run

func (action *AttestationReset) Run(ctx context.Context, attestationID, trigger, reason string) error

type AttestationResetOpts

type AttestationResetOpts struct {
	*ActionsOpts
	LocalStatePath string
}

type AttestationResult

type AttestationResult struct {
	Digest   string                   `json:"digest"`
	Envelope *dsse.Envelope           `json:"envelope"`
	Status   *AttestationStatusResult `json:"status"`
}

type AttestationResultRunnerContext

type AttestationResultRunnerContext struct {
	EnvVars            map[string]string
	JobURL, RunnerType string
	RawRunner          crafter.SupportedRunner
}

type AttestationStatus

type AttestationStatus struct {
	*ActionsOpts
	// contains filtered or unexported fields
}

func NewAttestationStatus

func NewAttestationStatus(cfg *AttestationStatusOpts) (*AttestationStatus, error)

func (*AttestationStatus) Run

func (action *AttestationStatus) Run(ctx context.Context, attestationID string) (*AttestationStatusResult, error)

type AttestationStatusMaterial

type AttestationStatusMaterial struct {
	*Material
	Set, IsOutput, Required, SkipUpload bool
	// Group is the choke group this material belongs to. Materials sharing a
	// non-empty group form an "at least one of" set.
	Group string `json:"group,omitempty"`
}

type AttestationStatusOpts

type AttestationStatusOpts struct {
	*ActionsOpts
	UseAttestationRemoteState bool

	LocalStatePath string
	// contains filtered or unexported fields
}

type AttestationStatusResult

type AttestationStatusResult struct {
	AttestationID               string                          `json:"attestationID"`
	InitializedAt               *time.Time                      `json:"initializedAt"`
	WorkflowMeta                *AttestationStatusWorkflowMeta  `json:"workflowMeta"`
	Materials                   []AttestationStatusMaterial     `json:"materials"`
	EnvVars                     map[string]string               `json:"envVars"`
	RunnerContext               *AttestationResultRunnerContext `json:"runnerContext"`
	DryRun                      bool                            `json:"dryRun"`
	Annotations                 []*Annotation                   `json:"annotations"`
	IsPushed                    bool                            `json:"isPushed"`
	PolicyEvaluations           map[string][]*PolicyEvaluation  `json:"policy_evaluations,omitempty"`
	HasPolicyViolations         bool                            `json:"has_policy_violations"`
	MustBlockOnPolicyViolations bool                            `json:"must_block_on_policy_violations"`
	TimestampAuthority          string                          `json:"timestamp_authority"`
	AttestationViewURL          string                          `json:"attestation_view_url"`
	// This might only be set if the attestation is pushed
	Digest string `json:"digest"`
	// This is the human readable output of the attestation status
	TerminalOutput []byte `json:"terminal_output"`
}

type AttestationStatusWorkflowMeta

type AttestationStatusWorkflowMeta struct {
	WorkflowID, Name, Team, Project, ContractRevision, ContractName, Organization string
	ProjectVersion                                                                *ProjectVersion
}

type AttestationVerifyAction

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

func NewAttestationVerifyAction

func NewAttestationVerifyAction(cfg *ActionsOpts) *AttestationVerifyAction

func (*AttestationVerifyAction) Run

func (action *AttestationVerifyAction) Run(ctx context.Context, fileOrURL string) (bool, error)

type AvailableIntegrationDescribe

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

func NewAvailableIntegrationDescribe

func NewAvailableIntegrationDescribe(cfg *ActionsOpts) *AvailableIntegrationDescribe

func (*AvailableIntegrationDescribe) Run

type AvailableIntegrationItem

type AvailableIntegrationItem struct {
	Name         string      `json:"name"`
	Version      string      `json:"version"`
	Description  string      `json:"description,omitempty"`
	Registration *JSONSchema `json:"registration"`
	Attachment   *JSONSchema `json:"attachment"`
	// Subscribed inputs (material types)
	SubscribedInputs []string `json:"subscribedInputs"`
}

type AvailableIntegrationList

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

func NewAvailableIntegrationList

func NewAvailableIntegrationList(cfg *ActionsOpts) *AvailableIntegrationList

func (*AvailableIntegrationList) Run

type CASArtifact

type CASArtifact struct {
	Digest string
	// contains filtered or unexported fields
}

type CASBackendAdd

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

func NewCASBackendAdd

func NewCASBackendAdd(cfg *ActionsOpts) *CASBackendAdd

func (*CASBackendAdd) Run

func (action *CASBackendAdd) Run(opts *NewCASBackendAddOpts) (*CASBackendItem, error)

type CASBackendDelete

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

func NewCASBackendDelete

func NewCASBackendDelete(cfg *ActionsOpts) *CASBackendDelete

func (*CASBackendDelete) Run

func (action *CASBackendDelete) Run(name string) error

type CASBackendItem

type CASBackendItem struct {
	ID               string            `json:"id"`
	Name             string            `json:"name"`
	Location         string            `json:"location"`
	Description      string            `json:"description"`
	Provider         string            `json:"provider"`
	Default          bool              `json:"default"`
	Fallback         bool              `json:"fallback"`
	Inline           bool              `json:"inline"`
	Limits           *CASBackendLimits `json:"limits"`
	ValidationStatus ValidationStatus  `json:"validationStatus"`
	ValidationError  *string           `json:"validationError,omitempty"`

	CreatedAt   *time.Time `json:"createdAt"`
	ValidatedAt *time.Time `json:"validatedAt"`
}

type CASBackendLimits

type CASBackendLimits struct {
	// Max number of bytes allowed to be stored in this backend
	MaxBytes int64
}

type CASBackendList

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

func NewCASBackendList

func NewCASBackendList(cfg *ActionsOpts) *CASBackendList

func (*CASBackendList) Run

func (action *CASBackendList) Run() ([]*CASBackendItem, error)

type CASBackendUpdate

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

func NewCASBackendUpdate

func NewCASBackendUpdate(cfg *ActionsOpts) *CASBackendUpdate

func (*CASBackendUpdate) Run

type ConfigContextItem

type ConfigContextItem struct {
	CurrentUser       *UserItem       `json:"currentUser"`
	CurrentMembership *MembershipItem `json:"currentMembership"`
	CurrentCASBackend *CASBackendItem `json:"currentCASBackend"`
}

type ConfigCurrentContext

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

func NewConfigCurrentContext

func NewConfigCurrentContext(cfg *ActionsOpts) *ConfigCurrentContext

func (*ConfigCurrentContext) Run

func (action *ConfigCurrentContext) Run() (*ConfigContextItem, error)

type ContractRawBody

type ContractRawBody struct {
	Body   string `json:"body"`
	Format string `json:"format"`
}

type DeleteAccount

type DeleteAccount struct {
	*ActionsOpts
}

func NewDeleteAccount

func NewDeleteAccount(cfg *ActionsOpts) *DeleteAccount

func (*DeleteAccount) Run

func (a *DeleteAccount) Run() error

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type ErrRunnerContextNotFound

type ErrRunnerContextNotFound struct {
	RunnerType string
}

func (ErrRunnerContextNotFound) Error

func (e ErrRunnerContextNotFound) Error() string

type ExecutorOption added in v1.108.0

type ExecutorOption func(*AttestationExecutor) error

func WithForcedOrganization added in v1.108.0

func WithForcedOrganization(orgName string) ExecutorOption

WithForcedOrganization replaces the control-plane connection with a fresh one that carries the given organization name in every request, overriding the CLI's default org. Pass an empty string to keep the default connection. The new connection is owned by the executor and closed by Close.

func WithLocalStatePath added in v1.108.0

func WithLocalStatePath(path string) ExecutorOption

WithLocalStatePath sets a file path for local attestation state, avoiding remote state and conflicts with other concurrent attestations.

func WithLogger added in v1.108.0

func WithLogger(l zerolog.Logger) ExecutorOption

WithLogger overrides the logger used by attestation operations. It clones ActionOpts to avoid mutating global state.

type JSONSchema

type JSONSchema struct {
	// Show it as raw string so the json output contains it
	Raw string `json:"schema"`
	// Parsed schema so it can be used for validation or other purposes
	// It's not shown in the json output
	Parsed     *jsonschema.Schema      `json:"-"`
	Properties sdk.SchemaPropertiesMap `json:"-"`
}

type ListMembersOpts

type ListMembersOpts struct {
	// MembershipID Optional, if provided, filters by a specific membership ID
	MembershipID *string
	// Name is the name of the user to filter by
	Name *string
	// Email is the email of the user to filter by
	Email *string
	// Role is the role of the user to filter by
	Role *string
}

type ListMembershipResult

type ListMembershipResult struct {
	Memberships    []*MembershipItem
	PaginationMeta *OffsetPagination
}

type Material

type Material struct {
	Name           string        `json:"name"`
	Value          string        `json:"value"`
	RawValue       []byte        `json:"raw_value,omitempty"`
	Hash           string        `json:"hash"`
	Tag            string        `json:"tag"`
	Filename       string        `json:"filename"`
	Type           string        `json:"type"`
	Annotations    []*Annotation `json:"annotations,omitempty"`
	UploadedToCAS  bool          `json:"uploadedToCAS,omitempty"`
	EmbeddedInline bool          `json:"embeddedInline,omitempty"`
}

type MembershipDelete

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

func NewMembershipDelete

func NewMembershipDelete(cfg *ActionsOpts) *MembershipDelete

func (*MembershipDelete) Run

func (action *MembershipDelete) Run(ctx context.Context, membershipID string) error

type MembershipItem

type MembershipItem struct {
	ID        string     `json:"id"`
	Default   bool       `json:"current"`
	CreatedAt *time.Time `json:"joinedAt"`
	UpdatedAt *time.Time `json:"updatedAt"`
	Org       *OrgItem   `json:"org"`
	User      *UserItem  `json:"user"`
	Role      Role       `json:"role"`
}

type MembershipLeave

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

func NewMembershipLeave

func NewMembershipLeave(cfg *ActionsOpts) *MembershipLeave

func (*MembershipLeave) Run

func (action *MembershipLeave) Run(ctx context.Context, membershipID string) error

type MembershipList

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

func NewMembershipList

func NewMembershipList(cfg *ActionsOpts) *MembershipList

func (*MembershipList) ListMembers

func (action *MembershipList) ListMembers(ctx context.Context, page int, pageSize int, opts *ListMembersOpts) (*ListMembershipResult, error)

ListMembers lists the members of an organization with pagination and optional filters.

func (*MembershipList) ListOrgs

func (action *MembershipList) ListOrgs(ctx context.Context) ([]*MembershipItem, error)

List organizations for the current user

type MembershipSetCurrent

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

func NewMembershipSet

func NewMembershipSet(cfg *ActionsOpts) *MembershipSetCurrent

func (*MembershipSetCurrent) Run

type MembershipUpdate

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

func NewMembershipUpdate

func NewMembershipUpdate(cfg *ActionsOpts) *MembershipUpdate

func (*MembershipUpdate) ChangeRole

func (action *MembershipUpdate) ChangeRole(ctx context.Context, membershipID, role string) (*MembershipItem, error)

List organizations for the current user

type NewCASBackendAddOpts

type NewCASBackendAddOpts struct {
	Name        string
	Location    string
	Provider    string
	Description string
	Default     bool
	Fallback    bool
	Credentials map[string]any
	MaxBytes    *int64
}

type NewCASBackendUpdateOpts

type NewCASBackendUpdateOpts struct {
	Name        string
	Description *string
	Default     *bool
	Fallback    *bool
	Credentials map[string]any
	MaxBytes    *int64
}

type NewOrgUpdateOpts

type NewOrgUpdateOpts struct {
	BlockOnPolicyViolation          *bool
	PoliciesAllowedHostnames        *[]string
	PreventImplicitWorkflowCreation *bool
	RestrictContractCreation        *bool
	// APITokenMaxDaysInactive is the maximum number of days a token can be inactive before auto-revocation.
	// 0 means disabled.
	APITokenMaxDaysInactive *int
	// EnableAIAgentCollector enables automatic AI agent config collection during attestation init
	EnableAIAgentCollector *bool
	// BlockAttestationsOnReleasedVersions rejects new attestations pushed to project versions that are already released
	BlockAttestationsOnReleasedVersions *bool
	// SkipRunnerEnvVars opts out of storing the environment variables automatically discovered by the CI runner in the attestation
	SkipRunnerEnvVars *bool
}

type NewWorkflowCreateOpts

type NewWorkflowCreateOpts struct {
	Name, Description, Project, Team, ContractName string
	ContractBytes                                  []byte
	// WorkflowTemplateID optionally binds the workflow to a platform workflow template.
	// The open-source CLI does not set it, it exists so template-aware clients can.
	WorkflowTemplateID string
}

type OffsetPagination

type OffsetPagination struct {
	Page       int `json:"page"`
	PageSize   int `json:"pageSize"`
	TotalPages int `json:"totalPages"`
	TotalCount int `json:"totalCount"`
}

type OrgCreate

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

func NewOrgCreate

func NewOrgCreate(cfg *ActionsOpts) *OrgCreate

func (*OrgCreate) Run

func (action *OrgCreate) Run(ctx context.Context, name string) (*OrgItem, error)

type OrgInvitationCreate

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

func NewOrgInvitationCreate

func NewOrgInvitationCreate(cfg *ActionsOpts) *OrgInvitationCreate

func (*OrgInvitationCreate) Run

func (action *OrgInvitationCreate) Run(ctx context.Context, receiver, role string) (*OrgInvitationItem, error)

type OrgInvitationItem

type OrgInvitationItem struct {
	ID            string     `json:"id"`
	ReceiverEmail string     `json:"receiverEmail"`
	Organization  *OrgItem   `json:"organization"`
	Sender        *UserItem  `json:"sender"`
	Status        string     `json:"status"`
	CreatedAt     *time.Time `json:"createdAt"`
	Role          Role       `json:"role"`
}

type OrgInvitationListSent

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

func NewOrgInvitationListSent

func NewOrgInvitationListSent(cfg *ActionsOpts) *OrgInvitationListSent

func (*OrgInvitationListSent) Run

type OrgInvitationRevoke

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

func NewOrgInvitationRevoke

func NewOrgInvitationRevoke(cfg *ActionsOpts) *OrgInvitationRevoke

func (*OrgInvitationRevoke) Run

func (action *OrgInvitationRevoke) Run(ctx context.Context, invitationID string) error

type OrgItem

type OrgItem struct {
	ID                                  string     `json:"id"`
	Name                                string     `json:"name"`
	CreatedAt                           *time.Time `json:"createdAt"`
	PolicyViolationBlockingStrategy     string     `json:"policyViolationBlockingStrategy"`
	PolicyAllowedHostnames              []string   `json:"policyAllowedHostnames,omitempty"`
	PreventImplicitWorkflowCreation     bool       `json:"preventImplicitWorkflowCreation"`
	APITokenMaxDaysInactive             *string    `json:"apiTokenMaxDaysInactive,omitempty"`
	EnableAIAgentCollector              bool       `json:"enableAiAgentCollector"`
	BlockAttestationsOnReleasedVersions bool       `json:"blockAttestationsOnReleasedVersions"`
	SkipRunnerEnvVars                   bool       `json:"skipRunnerEnvVars"`
}

type OrgUpdate

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

func NewOrgUpdate

func NewOrgUpdate(cfg *ActionsOpts) *OrgUpdate

func (*OrgUpdate) Run

func (action *OrgUpdate) Run(ctx context.Context, name string, opts *NewOrgUpdateOpts) (*OrgItem, error)

type OrganizationDelete

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

func NewOrganizationDelete

func NewOrganizationDelete(cfg *ActionsOpts) *OrganizationDelete

func (*OrganizationDelete) Run

func (action *OrganizationDelete) Run(ctx context.Context, orgName string) error

type PaginatedWorkflowRunItem

type PaginatedWorkflowRunItem struct {
	Result         []*WorkflowRunItem
	PaginationMeta *PaginationOpts
}

type PaginationOpts

type PaginationOpts struct {
	Limit      int
	NextCursor string
}

type PluginDescribe

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

PluginInfo handles showing detailed information about a specific plugin

func NewPluginDescribe

func NewPluginDescribe(cfg *ActionsOpts, manager *plugins.Manager) *PluginDescribe

NewPluginDescribe creates a new NewPluginDescribe action

func (*PluginDescribe) Run

func (action *PluginDescribe) Run(_ context.Context, pluginName string) (*PluginDescribeResult, error)

Run executes the NewPluginDescribe action

type PluginDescribeResult

type PluginDescribeResult struct {
	Plugin *plugins.LoadedPlugin
}

PluginDescribeResult represents the result of getting plugin info

type PluginExec

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

PluginExec handles executing a command provided by a plugin

func NewPluginExec

func NewPluginExec(cfg *ActionsOpts, manager *plugins.Manager) *PluginExec

NewPluginExec creates a new PluginExec action

func (*PluginExec) Run

func (action *PluginExec) Run(ctx context.Context, pluginName string, commandName string, config plugins.PluginExecConfig) (*PluginExecResult, error)

Run executes the PluginExec action

type PluginExecResult

type PluginExecResult struct {
	Output   string
	Error    string
	ExitCode int
	Data     map[string]any
}

PluginExecResult represents the result of executing a plugin command

type PluginInstall

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

PluginInstall handles downloading a plugin

func NewPluginInstall

func NewPluginInstall(cfg *ActionsOpts, manager *plugins.Manager) *PluginInstall

NewPluginInstall creates a new PluginInstall action

func (*PluginInstall) Run

Run executes the PluginInstall action

type PluginInstallOptions

type PluginInstallOptions struct {
	File     string
	Filename string
	Location string
}

PluginInstallOptions contains all options for installing a plugin

type PluginInstallResult

type PluginInstallResult struct {
	FilePath string
}

PluginInstallResult represents the result of installing a plugin

type PluginList

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

PluginList handles listing installed plugins

func NewPluginList

func NewPluginList(cfg *ActionsOpts, manager *plugins.Manager) *PluginList

NewPluginList creates a new PluginList action

func (*PluginList) Run

func (action *PluginList) Run(_ context.Context) (*PluginListResult, error)

Run executes the PluginList action

type PluginListResult

type PluginListResult struct {
	Plugins     map[string]*plugins.LoadedPlugin
	CommandsMap map[string]string // Maps command names to plugin names
}

PluginListResult represents the result of listing plugins

type PolicyEval

type PolicyEval struct {
	*ActionsOpts
	// contains filtered or unexported fields
}

func NewPolicyEval

func NewPolicyEval(opts *PolicyEvalOpts, actionOpts *ActionsOpts) (*PolicyEval, error)

func (*PolicyEval) Run

func (action *PolicyEval) Run() (*policydevel.EvalSummary, error)

type PolicyEvalOpts

type PolicyEvalOpts struct {
	MaterialPath       string
	Kind               string
	Annotations        map[string]string
	PolicyPath         string
	Inputs             map[string]string
	AllowedHostnames   []string
	Debug              bool
	ProjectName        string
	ProjectVersionName string
}

type PolicyEvaluation

type PolicyEvaluation struct {
	Name            string             `json:"name"`
	MaterialName    string             `json:"material_name,omitempty"`
	Body            string             `json:"body,omitempty"`
	Description     string             `json:"description,omitempty"`
	Annotations     map[string]string  `json:"annotations,omitempty"`
	Violations      []*PolicyViolation `json:"violations,omitempty"`
	PolicyReference *PolicyReference   `json:"policy_reference,omitempty"`
	With            map[string]string  `json:"with,omitempty"`
	Type            string             `json:"type"`
	Skipped         bool               `json:"skipped"`
	SkipReasons     []string           `json:"skip_reasons,omitempty"`
	Gate            bool               `json:"gate,omitempty"`
}

type PolicyEvaluationStatus

type PolicyEvaluationStatus struct {
	Strategy           string `json:"strategy"`
	Bypassed           bool   `json:"bypassed"`
	Blocked            bool   `json:"blocked"`
	HasViolations      bool   `json:"has_violations"`
	HasGatedViolations bool   `json:"has_gated_violations"`
}

type PolicyInit

type PolicyInit struct {
	*ActionsOpts
	// contains filtered or unexported fields
}

func NewPolicyInit

func NewPolicyInit(opts *PolicyInitOpts, actionOpts *ActionsOpts) (*PolicyInit, error)

func (*PolicyInit) Run

func (action *PolicyInit) Run() error

type PolicyInitOpts

type PolicyInitOpts struct {
	Force       bool
	Embedded    bool
	Name        string
	Description string
	Directory   string
}

type PolicyInput added in v1.105.8

type PolicyInput struct {
	// Policy optionally scopes the input to a specific policy (its name or ref).
	// Empty means the input is global and applies to every declaring policy.
	Policy string
	// Input is the destination policy input name (e.g. "min_iterations").
	Input string
	// Value is the literal value to set.
	Value string
}

PolicyInput describes a single --policy-input flag value: a policy input name set to a literal value supplied directly on the command line. The value always replaces (overrides) any contract-declared value for the input rather than being appended, which is what makes a scalar input overridable at run time.

func ParsePolicyInput added in v1.105.8

func ParsePolicyInput(raw string) (*PolicyInput, error)

ParsePolicyInput parses a single --policy-input flag value of the form "[<policy>:]<input>=<value>", where <value> is a literal set directly on the command line. The optional "<policy>:" prefix has the same scoping semantics as --policy-input-from-file. The value always overrides (replaces) any contract-declared value for the input.

type PolicyInputFromFile added in v1.103.0

type PolicyInputFromFile struct {
	// Policy optionally scopes the input to a specific policy (its name or ref).
	// Empty means the input is global and applies to every declaring policy.
	Policy string
	// Input is the destination policy input name (e.g. "ignored_paths").
	Input string
	// Column is the file column/field to extract. Defaults to Input.
	Column string
	// File is the source CSV or JSON file path.
	File string
}

PolicyInputFromFile describes a single --policy-input-from-file flag value: a policy input name fed from a named column of a CSV or JSON file. Its values are appended to any contract-declared value for the input.

func ParsePolicyInputFromFile added in v1.103.0

func ParsePolicyInputFromFile(raw string) (*PolicyInputFromFile, error)

ParsePolicyInputFromFile parses a single flag value of the form "[<policy>:]<input>=<file>[:<column>]". The optional "<policy>:" prefix scopes the input to a single policy (matched against its name or ref); without it the input is global. Because a policy ref may itself contain ":" but an input name never does, the scope is taken as everything before the *last* ":" on the left of "=". The column is optional and defaults to the input name. A column is always a single, top-level field/header name — never a path or a nested key. The column is the segment after the last ":"; since a column name never contains a path separator, a trailing ":<...>" whose ":" belongs to the file (a Windows drive letter like C:\data\... or a URL scheme like https://) is not mistaken for a column.

type PolicyLint

type PolicyLint struct {
	*ActionsOpts
}

func NewPolicyLint

func NewPolicyLint(actionOpts *ActionsOpts) (*PolicyLint, error)

func (*PolicyLint) Run

func (action *PolicyLint) Run(_ context.Context, opts *PolicyLintOpts) (*PolicyLintResult, error)

type PolicyLintOpts

type PolicyLintOpts struct {
	PolicyPath  string
	Format      bool
	RegalConfig string
}

type PolicyLintResult

type PolicyLintResult struct {
	Valid  bool
	Errors []string
}

type PolicyReference

type PolicyReference struct {
	Name   string            `json:"name"`
	Digest map[string]string `json:"digest"`
}

type PolicyViolation

type PolicyViolation struct {
	Subject  string `json:"subject"`
	Message  string `json:"message"`
	Suppress bool   `json:"suppress,omitempty"`
	// Mirrors the oneof on the wire — exactly one pointer is set per
	// violation, or none for unstructured policies.
	Vulnerability    *attv1.PolicyVulnerabilityFinding    `json:"vulnerability,omitempty"`
	Sast             *attv1.PolicySASTFinding             `json:"sast,omitempty"`
	LicenseViolation *attv1.PolicyLicenseViolationFinding `json:"license_violation,omitempty"`
}

type ProjectVersion

type ProjectVersion struct {
	ID             string `json:"id"`
	Version        string `json:"version,omitempty"`
	Prerelease     bool   `json:"prerelease"`
	MarkAsReleased bool   `json:"markAsRelease"`
}

type ReferrerDiscover

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

func NewReferrerDiscoverPrivate

func NewReferrerDiscoverPrivate(cfg *ActionsOpts) *ReferrerDiscover

func (*ReferrerDiscover) Run

func (action *ReferrerDiscover) Run(ctx context.Context, digest, kind string, p *PaginationOpts) (*ReferrerDiscoverResult, error)

type ReferrerDiscoverResult added in v1.89.0

type ReferrerDiscoverResult struct {
	Item       *ReferrerItem `json:"result"`
	NextCursor string        `json:"nextCursor,omitempty"`
}

type ReferrerItem

type ReferrerItem struct {
	Digest       string            `json:"digest"`
	Kind         string            `json:"kind"`
	Downloadable bool              `json:"downloadable"`
	CreatedAt    *time.Time        `json:"createdAt"`
	References   []*ReferrerItem   `json:"references"`
	Metadata     map[string]string `json:"metadata,omitempty"`
	Annotations  map[string]string `json:"annotations,omitempty"`
}

type RegisteredIntegrationAdd

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

func NewRegisteredIntegrationAdd

func NewRegisteredIntegrationAdd(cfg *ActionsOpts) *RegisteredIntegrationAdd

func (*RegisteredIntegrationAdd) Run

func (action *RegisteredIntegrationAdd) Run(pluginID, name, description string, options map[string]any) (*RegisteredIntegrationItem, error)

type RegisteredIntegrationDelete

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

func NewRegisteredIntegrationDelete

func NewRegisteredIntegrationDelete(cfg *ActionsOpts) *RegisteredIntegrationDelete

func (*RegisteredIntegrationDelete) Run

func (action *RegisteredIntegrationDelete) Run(name string) error

type RegisteredIntegrationDescribe

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

func NewRegisteredIntegrationDescribe

func NewRegisteredIntegrationDescribe(cfg *ActionsOpts) *RegisteredIntegrationDescribe

func (*RegisteredIntegrationDescribe) Run

type RegisteredIntegrationItem

type RegisteredIntegrationItem struct {
	ID string `json:"id"`
	// Registration name used for declarative configuration
	Name string `json:"name"`
	// Integration backend kind, i.e slack, pagerduty, etc
	Kind string `json:"kind"`
	// Integration description for display and differentiation purposes
	Description string                 `json:"description"`
	CreatedAt   *time.Time             `json:"createdAt"`
	Config      map[string]interface{} `json:"config"`
}

type RegisteredIntegrationList

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

func NewRegisteredIntegrationList

func NewRegisteredIntegrationList(cfg *ActionsOpts) *RegisteredIntegrationList

func (*RegisteredIntegrationList) Run

type Role

type Role string
const (
	RoleAdmin       Role = "admin"
	RoleOwner       Role = "owner"
	RoleViewer      Role = "viewer"
	RoleMember      Role = "member"
	RoleContributor Role = "contributor"
)

type Roles

type Roles []Role

func (Roles) String

func (roles Roles) String() string

type RunTracePushOpts added in v1.108.0

type RunTracePushOpts struct {
	// AllowEmpty makes the push attest every recorded session even when
	// no AI-attributed commits exist. Used by `chainloop trace run`,
	// which drives one-shot agent sessions that may produce no commits.
	AllowEmpty bool

	// ProjectName, when set, overrides the projectName read from
	// .chainloop.yml. Lets `trace run` operate without mutating the repo
	// config.
	ProjectName string
	// Organization, when set, overrides the organization read from
	// .chainloop.yml.
	Organization string
	// WorkflowName, when set, overrides the workflowName read from
	// .chainloop.yml.
	WorkflowName string
	// ProjectVersion, when set, targets a specific project version for
	// the attestation. Empty means use the latest version.
	ProjectVersion string
	// IgnoreYAML disables the .chainloop.yml fallback used to fill in
	// identity fields. `trace run` sets this so its attestations depend
	// only on CLI flags. Pre-push hook callers leave it false to keep
	// reading the repo config.
	IgnoreYAML bool

	// ActionOpts is the root command's initialized options, used to build
	// the attestation executor. Required: the push cannot run without it.
	ActionOpts *ActionsOpts
	// CLIVersion is the bare CLI version recorded in the attestation
	// predicate.
	CLIVersion string
}

RunTracePushOpts configures RunTracePush behaviour.

type ScopedEntity

type ScopedEntity struct {
	Type string `json:"type"`
	ID   string `json:"id"`
	Name string `json:"name"`
}

func (*ScopedEntity) String

func (s *ScopedEntity) String() string

type SignServerOpts

type SignServerOpts struct {
	// CA certificate for TLS connection
	CAPath string
	// (optional) Client cert and passphrase for mutual TLS authentication
	AuthClientCertPath, AuthClientCertPass string
}

SignServerOpts holds SignServer integration options

type SubprocessExitError added in v1.108.0

type SubprocessExitError struct {
	Command  string
	ExitCode int
}

SubprocessExitError carries the exit code of a wrapped command so the CLI can propagate it to the parent shell.

func (*SubprocessExitError) Error added in v1.108.0

func (e *SubprocessExitError) Error() string

type TraceRunOpts added in v1.108.0

type TraceRunOpts struct {
	// Store owns the chainloop-trace state directory, parented by the
	// .git directory inside a repository and otherwise by the out-of-tree
	// directory returned by state.NonGitDir. Outside a repository (IsGit
	// false) the managed git hooks are disabled, since git could never
	// invoke them anyway.
	Store *state.Store
	// RepoRoot is the repository root containing .chainloop.yml, or the
	// working directory when running outside a git repository.
	RepoRoot string
	// Providers is the list of agent provider names (e.g. "claude-code",
	// "cursor") whose info-gathering hooks should be installed.
	Providers []string
	// Command is the wrapped command: Command[0] is the program,
	// Command[1:] are its arguments.
	Command []string
	// ProjectName, Organization, WorkflowName identify the attestation
	// for this run. trace run is isolated from .chainloop.yml, so callers
	// must pass these values directly from CLI flags.
	ProjectName  string
	Organization string
	WorkflowName string
	// ProjectVersion, when set, targets a specific project version.
	// Empty means use the latest version.
	ProjectVersion string

	// ActionOpts is the root command's initialized options, used to build
	// the attestation executor. Required.
	ActionOpts *ActionsOpts
	// CLIVersion is the bare CLI version recorded in the attestation
	// predicate.
	CLIVersion string
}

TraceRunOpts configures a single TraceRun invocation.

type UserItem

type UserItem struct {
	ID            string     `json:"id"`
	Email         string     `json:"email"`
	FirstName     string     `json:"firstName"`
	LastName      string     `json:"lastName"`
	CreatedAt     *time.Time `json:"createdAt"`
	InstanceAdmin bool       `json:"instanceAdmin,omitempty"`
}

func (*UserItem) PrintUserProfileWithEmail

func (u *UserItem) PrintUserProfileWithEmail() string

PrintUserProfileWithEmail formats the user's profile with their email.

type ValidationStatus

type ValidationStatus string
const (
	Valid   ValidationStatus = "valid"
	Invalid ValidationStatus = "invalid"
)

type WorkflowContractApply added in v1.49.0

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

func NewWorkflowContractApply added in v1.49.0

func NewWorkflowContractApply(cfg *ActionsOpts) *WorkflowContractApply

func (*WorkflowContractApply) Run added in v1.49.0

func (action *WorkflowContractApply) Run(ctx context.Context, contractName string, contractPath string, description *string, projectName string) (*WorkflowContractItem, bool, error)

type WorkflowContractCreate

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

func NewWorkflowContractCreate

func NewWorkflowContractCreate(cfg *ActionsOpts) *WorkflowContractCreate

func (*WorkflowContractCreate) Run

func (action *WorkflowContractCreate) Run(name string, description *string, contractPath string, projectName string) (*WorkflowContractItem, error)

type WorkflowContractDelete

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

func NewWorkflowContractDelete

func NewWorkflowContractDelete(cfg *ActionsOpts) *WorkflowContractDelete

func (*WorkflowContractDelete) Run

func (action *WorkflowContractDelete) Run(name string) error

type WorkflowContractDescribe

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

func NewWorkflowContractDescribe

func NewWorkflowContractDescribe(cfg *ActionsOpts) *WorkflowContractDescribe

func (*WorkflowContractDescribe) Run

type WorkflowContractItem

type WorkflowContractItem struct {
	Name                    string         `json:"name"`
	Description             string         `json:"description,omitempty"`
	ID                      string         `json:"id"`
	LatestRevision          int            `json:"latestRevision,omitempty"`
	LatestRevisionCreatedAt *time.Time     `json:"latestRevisionCreatedAt,omitempty"`
	CreatedAt               *time.Time     `json:"createdAt"`
	Workflows               []string       `json:"workflows,omitempty"` // TODO: remove this field after all clients are updated
	WorkflowRefs            []*WorkflowRef `json:"workflowRefs,omitempty"`
	ScopedEntity            *ScopedEntity  `json:"scopedEntity,omitempty"`
	Scope                   string         `json:"scope"`
}

type WorkflowContractList

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

func NewWorkflowContractList

func NewWorkflowContractList(cfg *ActionsOpts) *WorkflowContractList

func (*WorkflowContractList) Run

func (action *WorkflowContractList) Run() ([]*WorkflowContractItem, error)

type WorkflowContractUpdate

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

func NewWorkflowContractUpdate

func NewWorkflowContractUpdate(cfg *ActionsOpts) *WorkflowContractUpdate

func (*WorkflowContractUpdate) Run

func (action *WorkflowContractUpdate) Run(name string, description *string, contractPath string) (*WorkflowContractWithVersionItem, error)

type WorkflowContractVersionItem

type WorkflowContractVersionItem struct {
	ID          string                   `json:"id"`
	Revision    int                      `json:"revision"`
	Description string                   `json:"description"`
	CreatedAt   *time.Time               `json:"createdAt"`
	BodyV1      *schemav1.CraftingSchema `json:"bodyV1"`
	RawBody     *ContractRawBody         `json:"rawBody"`
}

type WorkflowContractWithVersionItem

type WorkflowContractWithVersionItem struct {
	Contract *WorkflowContractItem        `json:"contract"`
	Revision *WorkflowContractVersionItem `json:"revision"`
}

type WorkflowCreate

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

func NewWorkflowCreate

func NewWorkflowCreate(cfg *ActionsOpts) *WorkflowCreate

func (*WorkflowCreate) Run

func (action *WorkflowCreate) Run(opts *NewWorkflowCreateOpts) (*WorkflowItem, error)

type WorkflowDelete

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

func NewWorkflowDelete

func NewWorkflowDelete(cfg *ActionsOpts) *WorkflowDelete

func (*WorkflowDelete) Run

func (action *WorkflowDelete) Run(name, projectName string) error

type WorkflowDescribe

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

func NewWorkflowDescribe

func NewWorkflowDescribe(cfg *ActionsOpts) *WorkflowDescribe

func (*WorkflowDescribe) Run

func (action *WorkflowDescribe) Run(ctx context.Context, name, projectName string) (*WorkflowItem, error)

type WorkflowItem

type WorkflowItem struct {
	Name                   string           `json:"name"`
	Description            string           `json:"description,omitempty"`
	ID                     string           `json:"id"`
	Team                   string           `json:"team"`
	Project                string           `json:"project,omitempty"`
	CreatedAt              *time.Time       `json:"createdAt"`
	RunsCount              int32            `json:"runsCount"`
	ContractName           string           `json:"contractName,omitempty"`
	ContractRevisionLatest int32            `json:"contractRevisionLatest,omitempty"`
	LastRun                *WorkflowRunItem `json:"lastRun,omitempty"`
	// WorkflowTemplateID is the platform workflow template this workflow is bound to,
	// empty when it is not bound to any
	WorkflowTemplateID string `json:"workflowTemplateId,omitempty"`
}

func (*WorkflowItem) NamespacedName

func (wi *WorkflowItem) NamespacedName() string

NamespacedName returns the project and workflow name in a formatted string

type WorkflowList

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

func NewWorkflowList

func NewWorkflowList(cfg *ActionsOpts) *WorkflowList

NewWorkflowList creates a new instance of WorkflowList

func (*WorkflowList) Run

func (action *WorkflowList) Run(page int, pageSize int) (*WorkflowListResult, error)

Run executes the workflow list action

type WorkflowListResult

type WorkflowListResult struct {
	Workflows  []*WorkflowItem   `json:"workflows"`
	Pagination *OffsetPagination `json:"pagination"`
}

WorkflowListResult holds the output of the workflow list action

type WorkflowRef

type WorkflowRef struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	ProjectName string `json:"projectName"`
}

type WorkflowRunAttestationItem

type WorkflowRunAttestationItem struct {
	Envelope *dsse.Envelope `json:"envelope"`
	Bundle   []byte         `json:"bundle"`

	Materials   []*Material   `json:"materials,omitempty"`
	EnvVars     []*EnvVar     `json:"envvars,omitempty"`
	Annotations []*Annotation `json:"annotations,omitempty"`
	// Digest in CAS backend
	Digest string `json:"digest"`
	// Policy violations
	PolicyEvaluations map[string][]*PolicyEvaluation `json:"policy_evaluations,omitempty"`
	// Policy evaluation status
	PolicyEvaluationStatus *PolicyEvaluationStatus `json:"policy_evaluation_status,omitempty"`
	// URL to view the attestation in the UI
	AttestationViewURL string `json:"attestation_view_url"`
	// contains filtered or unexported fields
}

func (*WorkflowRunAttestationItem) Statement

type WorkflowRunDescribe

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

func NewWorkflowRunDescribe

func NewWorkflowRunDescribe(cfg *ActionsOpts) *WorkflowRunDescribe

func (*WorkflowRunDescribe) Run

type WorkflowRunDescribeOpts

type WorkflowRunDescribeOpts struct {
	RunID, Digest           string
	Verify                  bool
	PublicKeyRef            string
	CertPath, CertChainPath string
}

type WorkflowRunItem

type WorkflowRunItem struct {
	ID                     string                       `json:"id"`
	State                  string                       `json:"state"`
	Reason                 string                       `json:"reason,omitempty"`
	CreatedAt              *time.Time                   `json:"createdAt,omitempty"`
	FinishedAt             *time.Time                   `json:"finishedAt,omitempty"`
	Workflow               *WorkflowItem                `json:"workflow,omitempty"`
	RunURL                 string                       `json:"runURL,omitempty"`
	RunnerType             string                       `json:"runnerType,omitempty"`
	ContractVersion        *WorkflowContractVersionItem `json:"contractVersion,omitempty"`
	ContractRevisionUsed   int                          `json:"contractRevisionUsed"`
	ContractRevisionLatest int                          `json:"contractRevisionLatest"`
	ProjectVersion         *ProjectVersion              `json:"projectVersion,omitempty"`
	PolicyStatus           string                       `json:"policyStatus,omitempty"`
}

type WorkflowRunItemFull

type WorkflowRunItemFull struct {
	WorkflowRun *WorkflowRunItem            `json:"workflowRun"`
	Workflow    *WorkflowItem               `json:"workflow"`
	Attestation *WorkflowRunAttestationItem `json:"attestation,omitempty"`
	Verified    bool                        `json:"verified"`
}

type WorkflowRunList

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

func NewWorkflowRunList

func NewWorkflowRunList(cfg *ActionsOpts) *WorkflowRunList

func (*WorkflowRunList) Run

type WorkflowRunListOpts

type WorkflowRunListOpts struct {
	WorkflowName, ProjectName string
	// ProjectVersionName filters by project version name (e.g. v1.2.0). It requires
	// ProjectName, since a version name is unique only within a project.
	ProjectVersionName string
	Pagination         *PaginationOpts
	Status             string
	PolicyStatus       string
}

type WorkflowUpdate

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

func NewWorkflowUpdate

func NewWorkflowUpdate(cfg *ActionsOpts) *WorkflowUpdate

func (*WorkflowUpdate) Run

func (action *WorkflowUpdate) Run(ctx context.Context, name, project string, opts *WorkflowUpdateOpts) (*WorkflowItem, error)

type WorkflowUpdateOpts

type WorkflowUpdateOpts struct {
	Description, Team, ContractName *string
}

type YAMLDoc added in v1.80.0

type YAMLDoc struct {
	Kind    string
	Name    string
	RawData []byte
}

YAMLDoc holds a parsed YAML document with its kind and raw bytes

func ParseYAMLPath added in v1.80.0

func ParseYAMLPath(path string) ([]*YAMLDoc, error)

ParseYAMLPath collects all YAML files from a path (file or directory), reads them, and splits multi-document files into individual YAMLDoc entries.

func SplitYAMLDocuments added in v1.80.0

func SplitYAMLDocuments(rawData []byte) ([]*YAMLDoc, error)

SplitYAMLDocuments splits a potentially multi-document YAML file into individual documents, extracting kind and name from each.

Jump to

Keyboard shortcuts

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