Class: AWSCDK::CodePipelineActions::CodeBuildActionProps

Inherits:
AWSCDK::Codepipeline::CommonAWSActionProps
  • Object
show all
Defined in:
code_pipeline_actions/code_build_action_props.rb

Overview

Construction properties of the CodeBuildAction CodeBuild build CodePipeline action.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action_name:, run_order: nil, variables_namespace: nil, role: nil, input:, project:, check_secrets_in_plain_text_env_variables: nil, combine_batch_build_artifacts: nil, environment_variables: nil, execute_batch_build: nil, extra_inputs: nil, outputs: nil, type: nil) ⇒ CodeBuildActionProps

Returns a new instance of CodeBuildActionProps.

Parameters:

  • action_name (String)

    The physical, human-readable name of the Action.

  • run_order (Numeric, nil) (defaults to: nil)

    The runOrder property for this Action.

  • variables_namespace (String, nil) (defaults to: nil)

    The name of the namespace to use for variables emitted by this action.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The Role in which context's this Action will be executing in.

  • input (AWSCDK::Codepipeline::Artifact)

    The source to use as input for this action.

  • project (AWSCDK::CodeBuild::IProject)

    The action's Project.

  • check_secrets_in_plain_text_env_variables (Boolean, nil) (defaults to: nil)

    Whether to check for the presence of any secrets in the environment variables of the default type, BuildEnvironmentVariableType.PLAINTEXT. Since using a secret for the value of that kind of variable would result in it being displayed in plain text in the AWS Console, the construct will throw an exception if it detects a secret was passed there. Pass this property as false if you want to skip this validation, and keep using a secret in a plain text environment variable.

  • combine_batch_build_artifacts (Boolean, nil) (defaults to: nil)

    Combine the build artifacts for a batch builds.

  • environment_variables (Hash{String => AWSCDK::CodeBuild::BuildEnvironmentVariable}, nil) (defaults to: nil)

    The environment variables to pass to the CodeBuild project when this action executes.

  • execute_batch_build (Boolean, nil) (defaults to: nil)

    Trigger a batch build.

  • extra_inputs (Array<AWSCDK::Codepipeline::Artifact>, nil) (defaults to: nil)

    The list of additional input Artifacts for this action.

  • outputs (Array<AWSCDK::Codepipeline::Artifact>, nil) (defaults to: nil)

    The list of output Artifacts for this action.

  • type (AWSCDK::CodePipelineActions::CodeBuildActionType, nil) (defaults to: nil)

    The type of the action that determines its CodePipeline Category - Build, or Test.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'code_pipeline_actions/code_build_action_props.rb', line 20

def initialize(action_name:, run_order: nil, variables_namespace: nil, role: nil, input:, project:, check_secrets_in_plain_text_env_variables: nil, combine_batch_build_artifacts: nil, environment_variables: nil, execute_batch_build: nil, extra_inputs: nil, outputs: nil, type: nil)
  @action_name = action_name
  Jsii::Type.check_type(@action_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actionName")
  @run_order = run_order
  Jsii::Type.check_type(@run_order, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "runOrder") unless @run_order.nil?
  @variables_namespace = variables_namespace
  Jsii::Type.check_type(@variables_namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "variablesNamespace") unless @variables_namespace.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @input = input
  Jsii::Type.check_type(@input, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXBpcGVsaW5lLkFydGlmYWN0In0=")), "input")
  @project = project
  Jsii::Type.check_type(@project, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLklQcm9qZWN0In0=")), "project")
  @check_secrets_in_plain_text_env_variables = check_secrets_in_plain_text_env_variables
  Jsii::Type.check_type(@check_secrets_in_plain_text_env_variables, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "checkSecretsInPlainTextEnvVariables") unless @check_secrets_in_plain_text_env_variables.nil?
  @combine_batch_build_artifacts = combine_batch_build_artifacts
  Jsii::Type.check_type(@combine_batch_build_artifacts, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "combineBatchBuildArtifacts") unless @combine_batch_build_artifacts.nil?
  @environment_variables = environment_variables.is_a?(Hash) ? environment_variables.transform_values { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CodeBuild::BuildEnvironmentVariable.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : environment_variables
  Jsii::Type.check_type(@environment_variables, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlYnVpbGQuQnVpbGRFbnZpcm9ubWVudFZhcmlhYmxlIn0sImtpbmQiOiJtYXAifX0=")), "environmentVariables") unless @environment_variables.nil?
  @execute_batch_build = execute_batch_build
  Jsii::Type.check_type(@execute_batch_build, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "executeBatchBuild") unless @execute_batch_build.nil?
  @extra_inputs = extra_inputs
  Jsii::Type.check_type(@extra_inputs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlcGlwZWxpbmUuQXJ0aWZhY3QifSwia2luZCI6ImFycmF5In19")), "extraInputs") unless @extra_inputs.nil?
  @outputs = outputs
  Jsii::Type.check_type(@outputs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlcGlwZWxpbmUuQXJ0aWZhY3QifSwia2luZCI6ImFycmF5In19")), "outputs") unless @outputs.nil?
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXBpcGVsaW5lX2FjdGlvbnMuQ29kZUJ1aWxkQWN0aW9uVHlwZSJ9")), "type") unless @type.nil?
end

Instance Attribute Details

#action_nameString (readonly)

The physical, human-readable name of the Action.

Note that Action names must be unique within a single Stage.

Returns:

  • (String)


54
55
56
# File 'code_pipeline_actions/code_build_action_props.rb', line 54

def action_name
  @action_name
end

#check_secrets_in_plain_text_env_variablesBoolean? (readonly)

Note:

Default: true

Whether to check for the presence of any secrets in the environment variables of the default type, BuildEnvironmentVariableType.PLAINTEXT. Since using a secret for the value of that kind of variable would result in it being displayed in plain text in the AWS Console, the construct will throw an exception if it detects a secret was passed there. Pass this property as false if you want to skip this validation, and keep using a secret in a plain text environment variable.

Returns:

  • (Boolean, nil)


91
92
93
# File 'code_pipeline_actions/code_build_action_props.rb', line 91

def check_secrets_in_plain_text_env_variables
  @check_secrets_in_plain_text_env_variables
end

#combine_batch_build_artifactsBoolean? (readonly)

Note:

Default: false

Combine the build artifacts for a batch builds.

Enabling this will combine the build artifacts into the same location for batch builds. If execute_batch_build is not set to true, this property is ignored.

Returns:

  • (Boolean, nil)


99
100
101
# File 'code_pipeline_actions/code_build_action_props.rb', line 99

def combine_batch_build_artifacts
  @combine_batch_build_artifacts
end

#environment_variablesHash{String => AWSCDK::CodeBuild::BuildEnvironmentVariable}? (readonly)

Note:

Default: - No additional environment variables are specified.

The environment variables to pass to the CodeBuild project when this action executes.

If a variable with the same name was set both on the project level, and here, this value will take precedence.

Returns:



107
108
109
# File 'code_pipeline_actions/code_build_action_props.rb', line 107

def environment_variables
  @environment_variables
end

#execute_batch_buildBoolean? (readonly)

Note:

Default: false

Trigger a batch build.

Enabling this will enable batch builds on the CodeBuild project.

Returns:

  • (Boolean, nil)


114
115
116
# File 'code_pipeline_actions/code_build_action_props.rb', line 114

def execute_batch_build
  @execute_batch_build
end

#extra_inputsArray<AWSCDK::Codepipeline::Artifact>? (readonly)

The list of additional input Artifacts for this action.

The directories the additional inputs will be available at are available during the project's build in the CODEBUILD_SRC_DIR_ environment variables. The project's build always starts in the directory with the primary input artifact checked out, the one pointed to by the input property. For more information, see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html .

Returns:



125
126
127
# File 'code_pipeline_actions/code_build_action_props.rb', line 125

def extra_inputs
  @extra_inputs
end

#inputAWSCDK::Codepipeline::Artifact (readonly)

The source to use as input for this action.



82
83
84
# File 'code_pipeline_actions/code_build_action_props.rb', line 82

def input
  @input
end

#outputsArray<AWSCDK::Codepipeline::Artifact>? (readonly)

Note:

Default: the action will not have any outputs

The list of output Artifacts for this action.

Note: if you specify more than one output Artifact here, you cannot use the primary 'artifacts' section of the buildspec; you have to use the 'secondary-artifacts' section instead. See https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html for details.

Returns:



136
137
138
# File 'code_pipeline_actions/code_build_action_props.rb', line 136

def outputs
  @outputs
end

#projectAWSCDK::CodeBuild::IProject (readonly)

The action's Project.



86
87
88
# File 'code_pipeline_actions/code_build_action_props.rb', line 86

def project
  @project
end

#roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: a new Role will be generated

The Role in which context's this Action will be executing in.

The Pipeline's Role will assume this Role (the required permissions for that will be granted automatically) right before executing this Action. This Action will be passed into your IAction.bind method in the ActionBindOptions.role property.

Returns:



78
79
80
# File 'code_pipeline_actions/code_build_action_props.rb', line 78

def role
  @role
end

#run_orderNumeric? (readonly)

Note:

Default: 1

The runOrder property for this Action.

RunOrder determines the relative order in which multiple Actions in the same Stage execute.



62
63
64
# File 'code_pipeline_actions/code_build_action_props.rb', line 62

def run_order
  @run_order
end

#typeAWSCDK::CodePipelineActions::CodeBuildActionType? (readonly)

Note:

Default: CodeBuildActionType.BUILD

The type of the action that determines its CodePipeline Category - Build, or Test.



141
142
143
# File 'code_pipeline_actions/code_build_action_props.rb', line 141

def type
  @type
end

#variables_namespaceString? (readonly)

Note:

Default: - a name will be generated, based on the stage and action names, if any of the action's variables were referenced - otherwise, no namespace will be set

The name of the namespace to use for variables emitted by this action.

Returns:

  • (String, nil)


67
68
69
# File 'code_pipeline_actions/code_build_action_props.rb', line 67

def variables_namespace
  @variables_namespace
end

Class Method Details

.jsii_propertiesObject



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'code_pipeline_actions/code_build_action_props.rb', line 143

def self.jsii_properties
  {
    :action_name => "actionName",
    :run_order => "runOrder",
    :variables_namespace => "variablesNamespace",
    :role => "role",
    :input => "input",
    :project => "project",
    :check_secrets_in_plain_text_env_variables => "checkSecretsInPlainTextEnvVariables",
    :combine_batch_build_artifacts => "combineBatchBuildArtifacts",
    :environment_variables => "environmentVariables",
    :execute_batch_build => "executeBatchBuild",
    :extra_inputs => "extraInputs",
    :outputs => "outputs",
    :type => "type",
  }
end

Instance Method Details

#to_jsiiObject



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'code_pipeline_actions/code_build_action_props.rb', line 161

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "actionName" => @action_name,
    "runOrder" => @run_order,
    "variablesNamespace" => @variables_namespace,
    "role" => @role,
    "input" => @input,
    "project" => @project,
    "checkSecretsInPlainTextEnvVariables" => @check_secrets_in_plain_text_env_variables,
    "combineBatchBuildArtifacts" => @combine_batch_build_artifacts,
    "environmentVariables" => @environment_variables,
    "executeBatchBuild" => @execute_batch_build,
    "extraInputs" => @extra_inputs,
    "outputs" => @outputs,
    "type" => @type,
  })
  result.compact
end