Experimental
@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
ComponentOnFailure Enum
Specifies what the step should do in case of failure.
Example
ts
const component = new imagebuilder.Component(this, 'StructuredComponent', {
platform: imagebuilder.Platform.LINUX,
data: imagebuilder.ComponentData.fromComponentDocumentJsonObject({
schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
phases: [
{
name: imagebuilder.ComponentPhaseName.BUILD,
steps: [
{
name: 'install-with-timeout',
action: imagebuilder.ComponentAction.EXECUTE_BASH,
timeout: Duration.minutes(10),
onFailure: imagebuilder.ComponentOnFailure.CONTINUE,
inputs: imagebuilder.ComponentStepInputs.fromObject({
commands: ['./install-script.sh']
})
}
]
}
]
})
});
python
component = imagebuilder.Component(self, "StructuredComponent",
platform=imagebuilder.Platform.LINUX,
data=imagebuilder.ComponentData.from_component_document_json_object(
schema_version=imagebuilder.ComponentSchemaVersion.V1_0,
phases=[imagebuilder.ComponentDocumentPhase(
name=imagebuilder.ComponentPhaseName.BUILD,
steps=[imagebuilder.ComponentDocumentStep(
name="install-with-timeout",
action=imagebuilder.ComponentAction.EXECUTE_BASH,
timeout=Duration.minutes(10),
on_failure=imagebuilder.ComponentOnFailure.CONTINUE,
inputs=imagebuilder.ComponentStepInputs.from_object({
"commands": ["./install-script.sh"]
})
)
]
)
]
)
)
java
Component component = Component.Builder.create(this, "StructuredComponent")
.platform(Platform.LINUX)
.data(ComponentData.fromComponentDocumentJsonObject(ComponentDocument.builder()
.schemaVersion(ComponentSchemaVersion.V1_0)
.phases(List.of(ComponentDocumentPhase.builder()
.name(ComponentPhaseName.BUILD)
.steps(List.of(ComponentDocumentStep.builder()
.name("install-with-timeout")
.action(ComponentAction.EXECUTE_BASH)
.timeout(Duration.minutes(10))
.onFailure(ComponentOnFailure.CONTINUE)
.inputs(ComponentStepInputs.fromObject(Map.of(
"commands", List.of("./install-script.sh"))))
.build()))
.build()))
.build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
var component = new Component(this, "StructuredComponent", new ComponentProps {
Platform = Platform.LINUX,
Data = ComponentData.FromComponentDocumentJsonObject(new ComponentDocument {
SchemaVersion = ComponentSchemaVersion.V1_0,
Phases = new [] { new ComponentDocumentPhase {
Name = ComponentPhaseName.BUILD,
Steps = new [] { new ComponentDocumentStep {
Name = "install-with-timeout",
Action = ComponentAction.EXECUTE_BASH,
Timeout = Duration.Minutes(10),
OnFailure = ComponentOnFailure.CONTINUE,
Inputs = ComponentStepInputs.FromObject(new Dictionary<string, object> {
{ "commands", new [] { "./install-script.sh" } }
})
} }
} }
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
component := imagebuilder.NewComponent(this, jsii.String("StructuredComponent"), &ComponentProps{
Platform: imagebuilder.Platform_LINUX,
Data: imagebuilder.ComponentData_FromComponentDocumentJsonObject(&ComponentDocument{
SchemaVersion: imagebuilder.ComponentSchemaVersion_V1_0,
Phases: []ComponentDocumentPhase{
&ComponentDocumentPhase{
Name: imagebuilder.ComponentPhaseName_BUILD,
Steps: []ComponentDocumentStep{
&ComponentDocumentStep{
Name: jsii.String("install-with-timeout"),
Action: imagebuilder.ComponentAction_EXECUTE_BASH,
Timeout: awscdk.Duration_Minutes(jsii.Number(10)),
OnFailure: imagebuilder.ComponentOnFailure_CONTINUE,
Inputs: imagebuilder.ComponentStepInputs_FromObject(map[string]interface{}{
"commands": []interface{}{
jsii.String("./install-script.sh"),
},
}),
},
},
},
},
}),
})
Members
| Member | Description |
|---|---|
ABORT | Fails the step and document execution. |
CONTINUE | Fails the step and proceeds to execute the next step in the document. |
IGNORE | Ignores the step and proceeds to execute the next step in the document. |
Referenced by
ComponentDocumentStep.onFailureon_failureonFailureOnFailureOnFailure