runway.cfngin.actions.deploy module

CFNgin deploy action.

runway.cfngin.actions.deploy.build_stack_tags(stack: Stack) List[TagTypeDef][source]

Build a common set of tags to attach to a stack.

runway.cfngin.actions.deploy.should_update(stack: Stack) bool[source]

Test whether a stack should be submitted for updates to CloudFormation.

Parameters

stack – The stack object to check.

runway.cfngin.actions.deploy.should_submit(stack: Stack) bool[source]

Test whether a stack should be submitted to CF for update/create.

Parameters

stack – The stack object to check.

runway.cfngin.actions.deploy.should_ensure_cfn_bucket(outline: bool, dump: bool) bool[source]

Test whether access to the cloudformation template bucket is required.

Parameters
  • outline – The outline action.

  • dump – The dump action.

Returns

If access to CF bucket is needed, return True.

class runway.cfngin.actions.deploy.UsePreviousParameterValue[source]

Bases: object

Class used to indicate a Parameter should use it’s existing value.

__init__()
__new__(**kwargs)
runway.cfngin.actions.deploy.handle_hooks(stage: Literal['post_deploy', 'pre_deploy'], hooks: List[CfnginHookDefinitionModel], provider: Provider, context: CfnginContext, *, dump: Union[bool, str] = False, outline: bool = False) None[source]

Handle pre/post hooks.

Parameters
  • stage – The name of the hook stage - pre_deploy/post_deploy.

  • hooks – A list of dictionaries containing the hooks to execute.

  • provider – The provider the current stack is using.

  • context – The current CFNgin context.

  • dump – Whether running with dump set or not.

  • outline – Whether running with outline set or not.

class runway.cfngin.actions.deploy.Action[source]

Bases: runway.cfngin.actions.base.BaseAction

Responsible for building & deploying CloudFormation stacks.

Generates the deploy plan based on stack dependencies (these dependencies are determined automatically based on output lookups from other stacks).

The plan can then either be printed out as an outline or executed. If executed, each stack will get launched in order which entails:

upload_explicitly_disabled

Explicitly disable uploading rendered templates to S3.

Type

bool

property upload_disabled: bool

Whether the CloudFormation template should be uploaded to S3.

static build_parameters(stack: Stack, provider_stack: Optional[StackTypeDef] = None) List[ParameterTypeDef][source]

Build the CloudFormation Parameters for our stack.

Parameters
  • stack – A CFNgin stack.

  • provider_stack – An optional CFNgin provider object.

Returns

The parameters for the given stack

pre_run(*, dump: Union[bool, str] = False, outline: bool = False, **_: Any) None[source]

Any steps that need to be taken prior to running the action.

run(*, concurrency: int = 0, dump: Union[bool, str] = False, force: bool = False, outline: bool = False, tail: bool = False, upload_disabled: bool = False, **_kwargs: Any) None[source]

Kicks off the create/update of the stacks in the stack_definitions.

This is the main entry point for the action.

Parameters
  • concurrency – The maximum number of concurrent deployments.

  • dump – Dump the plan rather than execute it.

  • force – Not used by this action.

  • outline – Outline the plan rather than execute it.

  • tail – Tail the stack’s events.

  • upload_disabled – Whether to explicitly disable uploading the CloudFormation template to S3.

__init__(context: CfnginContext, provider_builder: Optional[ProviderBuilder] = None, cancel: Optional[threading.Event] = None)

Instantiate class.

Parameters
  • context – The context for the current run.

  • provider_builder – An object that will build a provider that will be interacted with in order to perform the necessary actions.

  • cancel – Cancel handler.

__new__(**kwargs)
build_provider() Provider

Build a CFNgin provider.

ensure_cfn_bucket() None

CloudFormation bucket where templates will be stored.

execute(**kwargs: Any) None

Run the action with pre and post steps.

post_run(*, dump: Union[bool, str] = False, outline: bool = False, **_: Any) None[source]

Any steps that need to be taken after running the action.

property provider: Provider

Return a generic provider using the default region.

Used for running things like hooks.

s3_stack_push(blueprint: Blueprint, force: bool = False) str

Push the rendered blueprint’s template to S3.

Verifies that the template doesn’t already exist in S3 before pushing.

Returns

URL to the template in S3.

stack_template_url(blueprint: Blueprint) str

S3 URL for CloudFormation template object.