ShellScriptAction

class aws_cdk.pipelines.ShellScriptAction(*, action_name, commands, additional_artifacts=None, bash_options=None, environment=None, environment_variables=None, role_policy_statements=None, run_order=None, security_groups=None, subnet_selection=None, use_outputs=None, vpc=None)

Bases: object

(deprecated) Validate a revision using shell commands.

Deprecated:

This class is part of the old API. Use the API based on the CodePipeline class instead

Stability:

deprecated

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_codebuild as codebuild
import aws_cdk.aws_codepipeline as codepipeline
import aws_cdk.aws_ec2 as ec2
import aws_cdk.aws_iam as iam
import aws_cdk.aws_s3 as s3
import aws_cdk.pipelines as pipelines

# artifact: codepipeline.Artifact
# bucket: s3.Bucket
# build_image: codebuild.IBuildImage
# policy_statement: iam.PolicyStatement
# security_group: ec2.SecurityGroup
# stack_output: pipelines.StackOutput
# subnet: ec2.Subnet
# subnet_filter: ec2.SubnetFilter
# value: Any
# vpc: ec2.Vpc

shell_script_action = pipelines.ShellScriptAction(
    action_name="actionName",
    commands=["commands"],

    # the properties below are optional
    additional_artifacts=[artifact],
    bash_options="bashOptions",
    environment=codebuild.BuildEnvironment(
        build_image=build_image,
        certificate=codebuild.BuildEnvironmentCertificate(
            bucket=bucket,
            object_key="objectKey"
        ),
        compute_type=codebuild.ComputeType.SMALL,
        environment_variables={
            "environment_variables_key": codebuild.BuildEnvironmentVariable(
                value=value,

                # the properties below are optional
                type=codebuild.BuildEnvironmentVariableType.PLAINTEXT
            )
        },
        privileged=False
    ),
    environment_variables={
        "environment_variables_key": codebuild.BuildEnvironmentVariable(
            value=value,

            # the properties below are optional
            type=codebuild.BuildEnvironmentVariableType.PLAINTEXT
        )
    },
    role_policy_statements=[policy_statement],
    run_order=123,
    security_groups=[security_group],
    subnet_selection=ec2.SubnetSelection(
        availability_zones=["availabilityZones"],
        one_per_az=False,
        subnet_filters=[subnet_filter],
        subnet_group_name="subnetGroupName",
        subnet_name="subnetName",
        subnets=[subnet],
        subnet_type=ec2.SubnetType.ISOLATED
    ),
    use_outputs={
        "use_outputs_key": stack_output
    },
    vpc=vpc
)
Parameters:
  • action_name (str) – (deprecated) Name of the validation action in the pipeline.

  • commands (Sequence[str]) – (deprecated) Commands to run.

  • additional_artifacts (Optional[Sequence[Artifact]]) – (deprecated) Additional artifacts to use as input for the CodeBuild project. You can use these files to load more complex test sets into the shellscript build environment. The files artifact given here will be unpacked into the current working directory, the other ones will be unpacked into directories which are available through the environment variables $CODEBUILD_SRC_DIR_. The CodeBuild job must have at least one input artifact, so you must provide either at least one additional artifact here or one stack output using useOutput. Default: - No additional artifacts

  • bash_options (Optional[str]) – (deprecated) Bash options to set at the start of the script. Default: ‘-eu’ (errexit and nounset)

  • environment (Union[BuildEnvironment, Dict[str, Any], None]) – (deprecated) The CodeBuild environment where scripts are executed. Default: LinuxBuildImage.STANDARD_5_0

  • environment_variables (Optional[Mapping[str, Union[BuildEnvironmentVariable, Dict[str, Any]]]]) – (deprecated) Environment variables to send into build. Default: - No additional environment variables

  • role_policy_statements (Optional[Sequence[PolicyStatement]]) – (deprecated) Additional policy statements to add to the execution role. Default: - No policy statements

  • run_order (Union[int, float, None]) – (deprecated) RunOrder for this action. Use this to sequence the shell script after the deployments. The default value is 100 so you don’t have to supply the value if you just want to run this after the application stacks have been deployed, and you don’t have more than 100 stacks. Default: 100

  • security_groups (Optional[Sequence[ISecurityGroup]]) – (deprecated) Which security group to associate with the script’s project network interfaces. If no security group is identified, one will be created automatically. Only used if ‘vpc’ is supplied. Default: - Security group will be automatically created.

  • subnet_selection (Union[SubnetSelection, Dict[str, Any], None]) – (deprecated) Which subnets to use. Only used if ‘vpc’ is supplied. Default: - All private subnets.

  • use_outputs (Optional[Mapping[str, StackOutput]]) – (deprecated) Stack outputs to make available as environment variables. Default: - No outputs used

  • vpc (Optional[IVpc]) – (deprecated) The VPC where to execute the specified script. Default: - No VPC

Stability:

deprecated

Methods

bind(scope, stage, *, bucket, role)

(deprecated) Exists to implement IAction.

Parameters:
Stability:

deprecated

Return type:

ActionConfig

on_state_change(name, target=None, *, description=None, enabled=None, event_bus=None, event_pattern=None, rule_name=None, schedule=None, targets=None)

(deprecated) Exists to implement IAction.

Parameters:
  • name (str) –

  • target (Optional[IRuleTarget]) –

  • description (Optional[str]) – A description of the rule’s purpose. Default: - No description.

  • enabled (Optional[bool]) – Indicates whether the rule is enabled. Default: true

  • event_bus (Optional[IEventBus]) – The event bus to associate with this rule. Default: - The default event bus.

  • event_pattern (Union[EventPattern, Dict[str, Any], None]) – Describes which events EventBridge routes to the specified target. These routed events are matched events. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide. Default: - None.

  • rule_name (Optional[str]) – A name for the rule. Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the rule name. For more information, see Name Type.

  • schedule (Optional[Schedule]) – The schedule or rate (frequency) that determines when EventBridge runs the rule. For more information, see Schedule Expression Syntax for Rules in the Amazon EventBridge User Guide. Default: - None.

  • targets (Optional[Sequence[IRuleTarget]]) – Targets to invoke when this rule matches an event. Input will be the full matched event. If you wish to specify custom target input, use addTarget(target[, inputOptions]). Default: - No targets.

Stability:

deprecated

Return type:

Rule

Attributes

action_properties

(deprecated) Exists to implement IAction.

Stability:

deprecated

grant_principal

(deprecated) The CodeBuild Project’s principal.

Stability:

deprecated

project

(deprecated) Project generated to run the shell script in.

Stability:

deprecated