actions

package
v0.0.0-...-de93790 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCodeCatalystImage = "docker://public.ecr.aws/c8t2t1h8/al2/curated:1.3-x86_64-ec2"

Variables

This section is empty.

Functions

func ActionInputHandler

func ActionInputHandler(inputs map[string]string) runner.Feature

ActionInputHandler converts the provided inputs into environment variables (prefixed with 'INPUT_')

func ActionOutputHandler

func ActionOutputHandler(outputs map[string]string, suppressOutput bool) runner.Feature

ActionOutputHandler collects the output from an action and checks for failures in the ACTION_RUN_SUMMARY output

func CodeCatalystImage

func CodeCatalystImage() string

func NewActionPlan

func NewActionPlan(params *NewActionPlanParams) (runner.Plan, error)

NewActionPlan creates a new Plan from the given params

func NewActionPlansProvider

func NewActionPlansProvider(params *NewActionPlansProviderParams) runner.PlansProvider

NewActionPlansProvider creates a plan provider based on [Action]s

Types

type Action

type Action struct {
	SchemaVersion        string               `yaml:"SchemaVersion"`        // version of the action schema
	Name                 string               `yaml:"Name"`                 // name of the action
	ID                   string               `yaml:"Id"`                   // ID of the action
	Description          string               `yaml:"Description"`          // description of the action
	Version              string               `yaml:"Version"`              // version of the action
	Configuration        map[string]Parameter `yaml:"Configuration"`        // define the configuration properties of the action
	SupportedComputeType SupportedComputeType `yaml:"SupportedComputeType"` // specify the compute types to use for the action
	Environment          Environment          `yaml:"Environment"`          // specify the CodeCatalyst environment to use with the action
	Inputs               Inputs               `yaml:"Inputs"`               // defines the data that an action needs during a workflow run
	Outputs              Outputs              `yaml:"Outputs"`              // defines the data that is output by the action during a workflow run. If more than 10 output variables are produced, the top 10 variables are selected
	Runs                 Runs                 `yaml:"Runs"`                 // defines the runtime environment and main entry point for the action
	Basedir              string               `yaml:"-"`                    // the directory this action was loaded from
}

Action defines inputs, outputs and resources integrations for custom actions with. For more details, see the Action Reference in the Amazon CodeCatalyst Action Developer Kit (ADK).

func Find

func Find(actionSearchPath string) ([]*Action, error)

Find actions recursively under the provided actionSearchPath by reading the '.codecatalyst/actions/action.yml file in each directory

func Load

func Load(actionDir string) (*Action, error)

Load an action by reading the '.codecatalyst/actions/action.yml file relative to the provided actionDir

type ActionProvider

type ActionProvider interface {
	Action() *Action
}

ActionProvider exposes acces to an Action

type ActionRunSummaryLevel

type ActionRunSummaryLevel string

ActionRunSummaryLevel of an ActionRunSummaryMessage

const (
	// ActionRunSummaryLevelError represents the error level
	ActionRunSummaryLevelError ActionRunSummaryLevel = "Error"
)

type ActionRunSummaryMessage

type ActionRunSummaryMessage struct {
	Text              string                      // text of the message
	Level             ActionRunSummaryLevel       // level of the message
	Message           string                      // template to be used with TemplateVariables
	TemplateVariables []ActionRunTemplateVariable // variables to apply in the message template
}

ActionRunSummaryMessage describes a messages that was returned from the action

type ActionRunTemplateVariable

type ActionRunTemplateVariable struct {
	Name  string
	Value string
}

ActionRunTemplateVariable describes a variable for a message template

type Artifacts

type Artifacts struct {
	Required bool `yaml:"Required"` // if true, then action expects at least one artifact
}

Artifacts from previous actions that you want to provide as input to this action. These artifacts must already be defined as output artifacts in previous actions.

type Environment

type Environment struct {
	Required bool `yaml:"Required"` // if true, the action requires an environment
}

Environment to use with the Action

type Inputs

type Inputs struct {
	Sources   Sources   // Specify the labels that represent the source repositories that will be needed by the action
	Artifacts Artifacts // Specify artifacts from previous actions that you want to provide as input to this action
}

Inputs specifies if sources and/or artifacts are required for the action to run

type NewActionPlanParams

type NewActionPlanParams struct {
	Action        *Action              // Action to use to create a plan from
	ExecutionType runner.ExecutionType // Type of execution (shell or docker)
	WorkingDir    string               // Working directory for the plan
	ID            string               // override the id of the action
	Steps         []string             // override commands to run
	DependsOn     []string             // dependencies
}

NewActionPlanParams contains the parametes for the NewActionPlan function

type NewActionPlansProviderParams

type NewActionPlansProviderParams struct {
	ActionsProvider Provider             // The actions [Provider] containing the actions to create plans for
	ExecutionType   runner.ExecutionType // The [ExecutionType] to use in the created plans
	WorkingDir      string               // The working directory to use for each plan
}

NewActionPlansProviderParams contains the parameters to create a new action plans provider

type Output

type Output struct {
	Description string `yaml:"Description"` // provide a description of the output variable
}

Output variables that you want the action to export so that they are available for use by the subsequent actions.

type Outputs

type Outputs struct {
	Variables map[string]Output `yaml:"Variables"` // specify the variables that you want the action to export so that they are available for use by the subsequent actions.
}

Outputs defines the data that is output by the action during a workflow run. If more than 10 output variables are produced, the top 10 variables are selected.

type Parameter

type Parameter struct {
	Description string        `yaml:"Description"` // provide a description of the parameter
	Required    bool          `yaml:"Required"`    // specify whether the parameter is required
	Default     string        `yaml:"Default"`     // specify the default value of the parameter
	DisplayName string        `yaml:"DisplayName"` // set the display name of the parameter
	Type        ParameterType `yaml:"Type"`        // the type of the parameter: number, boolean, or string
}

Parameter configuration in the action

type ParameterType

type ParameterType string

ParameterType of parameter. You can use one of the following values (default is string): number, boolean, or string

const (
	// ParameterTypeNumber is a number
	ParameterTypeNumber ParameterType = "number"
	// ParameterTypeBoolean is a boolean
	ParameterTypeBoolean ParameterType = "boolean"
	// ParameterTypeString is a string
	ParameterTypeString ParameterType = "string"
)

type Provider

type Provider interface {
	Actions() ([]*Action, error)
}

Provider describes an interface for providing a list of [Action]s

func NewStaticActionsProvider

func NewStaticActionsProvider(actions ...*Action) Provider

NewStaticActionsProvider creates a new Provider for a static list of actions

type Runs

type Runs struct {
	Using UsingType `yaml:"Using"` // specify the type of runtime environment. Currently, Node 12, Node 16 and Docker are the options

	// Using == 'node16'
	Main string `yaml:"Main"` // specify the file for the entry point of a Node.js application. This file contains your action code. Required if Node 12 or Node 16 runtime is specified for Using
	Pre  string `yaml:"Pre"`  // allows you to run a script at the beginning of the action run. Can be defined if Node 12 or Node 16 runtime is specified for Using
	Post string `yaml:"Post"` // allows your to run a script at the end of the action run. Can be defined if Node 12 or Node 16 runtime is specified for Using

	// Using == 'docker'
	Image          string `yaml:"Image"`          // specify the file or link to an image. If a link is specified, it's not validated. This is the Docker image used as the container to run the action. Required if Docker runtime is specified for Using
	Entrypoint     string `yaml:"Entrypoint"`     // overrides the Docker entrypoint in the Docker file. Can be defined if Docker runtime is specified for Using.
	PreEntryPoint  string `yaml:"PreEntryPoint"`  // allows you to run a script before the entrypoint action begins. Can be defined if Docker runtime is specified for Using.
	PostEntryPoint string `yaml:"PostEntryPoint"` // allows you to run a cleanup script once the entrypoint action has finished. Can be defined if Docker runtime is specified for Using.
}

Runs defines the runtime environment and main entry point for the action.

type Sources

type Sources struct {
	Required bool `yaml:"Required"` // if true, then action expects at least one source
}

Sources specifies the labels that represent the source repositories that will be needed by the action. Currently, the only supported label is WorkflowSource, which represents the source repository where your workflow definition file is stored.

type SupportedComputeType

type SupportedComputeType string

SupportedComputeType is the compute type to use for the action. You can specify the following types: EC2, Lambda

const (
	// SupportedComputeTypeEc2 is EC2 compute type
	SupportedComputeTypeEc2 SupportedComputeType = "EC2"
	// SupportedComputeTypeLambda is Lambda compute type
	SupportedComputeTypeLambda SupportedComputeType = "LAMBDA"
)

type UsingType

type UsingType string

UsingType specifies the type of runtime environment. Currently, Node 12, Node 16 and Docker are the options.

const (
	// UsingTypeNode12 specifies the Node 12 runtime environment.
	UsingTypeNode12 UsingType = "node12"
	// UsingTypeNode16 specifies the Node 16 runtime environment.
	UsingTypeNode16 UsingType = "node16"
	// UsingTypeDocker specifies the Docker runtime environment.
	UsingTypeDocker UsingType = "docker"
)

Jump to

Keyboard shortcuts

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