pkg

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerBuild

func DockerBuild(log *zap.SugaredLogger, dockerfile string) (string, error)

Returns local image ID (truncated SHA256)

Types

type Packager

type Packager struct {
	// zap logger for printing progress updates
	Log *zap.SugaredLogger

	// AWS session configuration
	AwsConfig aws.Config

	// S3 bucket for uploading lambda zipfiles
	Bucket string

	// The image ID (truncated SHA256) for the "docker push" command.
	//
	// The docker image must be built before the packaging starts.
	DockerImageID string

	// ECR registry URI for publishing docker images
	EcrRegistry string

	// If true, docker images in ECR will be tagged with their hash and duplicate images
	// will not be uploaded - this is optimized for development.
	//
	// If false, the docker images will be tagged with the Panther version (for releases),
	// and it will push to ECR even if it means overwriting an image with the same tag.
	EcrTagWithHash bool

	// Pip library versions to install for the shared python layer
	PipLibs []string

	// Optional additional processing after the packaging and yaml marshal but before writing
	// the final template to disk.
	//
	// The function should return the modified template body.
	PostProcess func(originalPath string, packagedBody []byte) []byte
}

Packaging configuration

func (Packager) DockerPush

func (p Packager) DockerPush(tag string) (string, error)

Build the web docker image from source and push it to the ecr registry

func (*Packager) Template

func (p *Packager) Template(path string) (string, error)

Recursively build package assets in a CFN template to S3 and ECR

This offers similar functionality to 'sam package' or 'aws cloudformation package', but parallelized and compiled directly into mage for faster, simpler deployments.

The build operations (go build, docker build, pip install, etc) are pushed down to the packaging handlers instead of running at the beginning of the deploy process. In other words, assets are built "just-in-time" before they are uploaded. This way, we get parallel builds with a good balance of network and CPU operations, and we build only the exact set of assets we need for each stack.

Supports the following resource types:

AWS::AppSync::GraphQLSchema (DefinitionS3Location)
AWS::CloudFormation::Stack (TemplateURL)
AWS::ECS::TaskDefinition (Image)
AWS::Lambda::LayerVersion (Content)
AWS::Serverless::Function (CodeUri)

Returns the path to the packaged template (in the out/ folder)

func (*Packager) UploadAsset

func (p *Packager) UploadAsset(assetPath, s3Key string) (string, string, error)

Upload a CloudFormation asset to S3, returning s3 object key and version.

If no s3 key is chosen by the caller, the hash is used for the key and objects will not be uploaded if they already exist.

Jump to

Keyboard shortcuts

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