taskdef

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package taskdef reads ECS task definition metadata and tags, producing per-scale-set configuration. It defines an ECSDescriber interface for testability and provides tag parsing with sensible defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFargatePrivileged

func CheckFargatePrivileged(taskDef *ecsTypes.TaskDefinition) error

CheckFargatePrivileged returns an error if the task definition requires Fargate compatibility and has any privileged containers.

func LoadAll

func LoadAll(ctx context.Context, describer ECSDescriber, families []string, defaults Defaults) (map[string]*TaskDefInfo, error)

LoadAll describes each task definition family and returns the resolved info with parsed tags. It fails fast on any error.

Types

type Defaults

type Defaults struct {
	Subnets          []string
	SecurityGroups   []string
	CapacityProvider string
	ExtraLabels      []string
}

Defaults holds the global default values that apply when tags are absent.

type ECSDescriber

type ECSDescriber interface {
	DescribeTaskDefinition(ctx context.Context, family string) (*ecsTypes.TaskDefinition, []ecsTypes.Tag, error)
}

ECSDescriber is the interface for describing ECS task definitions. It exists to decouple this package from the AWS SDK for testing.

type ECSTaskDefDescriber

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

ECSTaskDefDescriber implements ECSDescriber using the real AWS ECS SDK.

func NewECSTaskDefDescriber

func NewECSTaskDefDescriber(client *ecs.Client) *ECSTaskDefDescriber

NewECSTaskDefDescriber creates a new ECSTaskDefDescriber.

func (*ECSTaskDefDescriber) DescribeTaskDefinition

func (d *ECSTaskDefDescriber) DescribeTaskDefinition(ctx context.Context, family string) (*ecsTypes.TaskDefinition, []ecsTypes.Tag, error)

DescribeTaskDefinition fetches a task definition by family name and returns the definition along with its tags.

type ScaleSetConfig

type ScaleSetConfig struct {
	MaxRunners       int
	MinRunners       int
	MaxRuntime       time.Duration
	Subnets          []string
	SecurityGroups   []string
	CapacityProvider string
	// LaunchType is derived from the task definition's RequiresCompatibilities.
	LaunchType ecsTypes.LaunchType
	// ExtraLabels are additional GitHub Actions labels for the scale set,
	// including automatic OS/arch labels derived from the task definition's
	// RuntimePlatform and any user-specified labels.
	ExtraLabels []string
}

ScaleSetConfig holds the per-scale-set configuration derived from task definition tags.

func ParseScaleSetConfig

func ParseScaleSetConfig(tags []ecsTypes.Tag, defaults Defaults) ScaleSetConfig

ParseScaleSetConfig extracts ScaleSetConfig from task definition tags, falling back to the provided defaults for unset values.

type TaskDefInfo

type TaskDefInfo struct {
	TaskDefinition *ecsTypes.TaskDefinition
	Config         ScaleSetConfig
}

TaskDefInfo holds a resolved task definition and its parsed scale set config.

Jump to

Keyboard shortcuts

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