Documentation ¶
Index ¶
- Variables
- func LoadSchema(pathOrURI string) (*schemaapi.CraftingSchema, error)
- type CommitRemote
- type Crafter
- func (c *Crafter) AddMaterial(ctx context.Context, attestationID, key, value string, ...) error
- func (c *Crafter) AlreadyInitialized(ctx context.Context, stateID string) (bool, error)
- func (c *Crafter) Init(ctx context.Context, opts *InitOpts) error
- func (c *Crafter) LoadCraftingState(ctx context.Context, attestationID string) error
- func (c *Crafter) Reset(ctx context.Context, stateID string) error
- func (c *Crafter) ResolveEnvVars(ctx context.Context, attestationID string) error
- func (c *Crafter) ValidateAttestation() error
- type HeadCommit
- type InitOpts
- type NewOpt
- type RunnerM
- type StateManager
- type SupportedRunner
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAttestationStateNotLoaded = errors.New("crafting state not loaded")
View Source
var ErrRunnerContextNotFound = errors.New("the runner environment doesn't match the required runner type")
View Source
var RunnersMap = map[schemaapi.CraftingSchema_Runner_RunnerType]SupportedRunner{ schemaapi.CraftingSchema_Runner_GITHUB_ACTION: runners.NewGithubAction(), schemaapi.CraftingSchema_Runner_GITLAB_PIPELINE: runners.NewGitlabPipeline(), schemaapi.CraftingSchema_Runner_AZURE_PIPELINE: runners.NewAzurePipeline(), schemaapi.CraftingSchema_Runner_JENKINS_JOB: runners.NewJenkinsJob(), schemaapi.CraftingSchema_Runner_CIRCLECI_BUILD: runners.NewCircleCIBuild(), schemaapi.CraftingSchema_Runner_DAGGER_PIPELINE: runners.NewDaggerPipeline(), }
Functions ¶
func LoadSchema ¶
func LoadSchema(pathOrURI string) (*schemaapi.CraftingSchema, error)
Types ¶
type CommitRemote ¶ added in v0.25.0
type CommitRemote struct {
Name, URL string
}
type Crafter ¶
type Crafter struct { CraftingState *api.CraftingState Runner SupportedRunner // contains filtered or unexported fields }
func NewCrafter ¶
func NewCrafter(stateManager StateManager, opts ...NewOpt) (*Crafter, error)
Create a completely new crafter
func (*Crafter) AddMaterial ¶
func (c *Crafter) AddMaterial(ctx context.Context, attestationID, key, value string, casBackend *casclient.CASBackend, runtimeAnnotations map[string]string) error
Inject material to attestation state
func (*Crafter) AlreadyInitialized ¶
func (*Crafter) LoadCraftingState ¶
func (*Crafter) ResolveEnvVars ¶
ResolveEnvVars will iterate on the env vars in the allow list and resolve them from the system context strict indicates if it should fail if any env variable can not be found
func (*Crafter) ValidateAttestation ¶
type HeadCommit ¶ added in v0.25.0
type InitOpts ¶
type InitOpts struct { // Control plane workflow metadata WfInfo *api.WorkflowMetadata // already marshaled schema SchemaV1 *schemaapi.CraftingSchema // do not record, upload or push attestation DryRun bool // Identifier of the attestation state AttestationID string Runner SupportedRunner }
type NewOpt ¶
func WithLogger ¶
func WithOCIAuth ¶ added in v0.65.0
func WithWorkingDirPath ¶ added in v0.20.0
type RunnerM ¶ added in v0.65.0
type RunnerM map[schemaapi.CraftingSchema_Runner_RunnerType]SupportedRunner
type StateManager ¶ added in v0.60.0
type StateManager interface { // Check if the state is already initialized Initialized(ctx context.Context, key string) (bool, error) // Write the state to the manager backend Write(ctx context.Context, key string, state *api.CraftingState) error // Read the state from the manager backend Read(ctx context.Context, key string, state *api.CraftingState) error // Reset/Delete the state Reset(ctx context.Context, key string) error // String returns a string representation of the state manager Info(ctx context.Context, key string) string }
StateManager is an interface for managing the state of the crafting process
type SupportedRunner ¶ added in v0.65.0
type SupportedRunner interface { // Whether the attestation is happening in this environment CheckEnv() bool // List the env variables registered ListEnvVars() []*runners.EnvVarDefinition // Return the list of env vars associated with this runner already resolved ResolveEnvVars() (map[string]string, []*error) // uri to the running job/workload RunURI() string // ID returns the runner type ID() schemaapi.CraftingSchema_Runner_RunnerType }
func DiscoverAndEnforceRunner ¶ added in v0.65.0
func DiscoverAndEnforceRunner(enforcedRunnerType schemaapi.CraftingSchema_Runner_RunnerType, dryRun bool, logger zerolog.Logger) (SupportedRunner, error)
func NewRunner ¶
func NewRunner(t schemaapi.CraftingSchema_Runner_RunnerType) SupportedRunner
Load a specific runner
Click to show internal directories.
Click to hide internal directories.