简体   繁体   中英

Disabling stage transitions in AWS CodePipeline using Java CDK

Looking through the cloudformation docs, there should be a way to disable a transition to an action. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#cfn-codepipeline-pipeline-disableinboundstagetransitions

Tried looking for the Java CDK counter part and found this. https://docs.aws.amazon.com/cdk/api/latest/java/software/amazon/awscdk/services/codepipeline/CfnPipeline.StageTransitionProperty.html

However, I can't find a way to link it to a Pipeline.

Is this the right property class? If yes how do I link it to a Pipeline instance?

CDK project has an answer for this - https://github.com/aws/aws-cdk/issues/1649

Usage for CfnPipeline provided as

const cfnPipeline = pipeline.node.findChild('Resource') as codepipeline.CfnPipeline
cfnPipeline.propertyOverrides.disableInboundStageTransitions = [{
    reason: 'Pipeline is triggered by schedule not source changes',
    stageName: 'Source'
}]

For python I was able to implement with the following

cfn_pipeline = pipeline.node.find_child('Resource')
cfn_pipeline.add_property_override(
    property_path='DisableInboundStageTransitions',
    value=[{
        'Reason': 'Pipeline is triggered by schedule not source changes',
        'StageName': 'Source'
    }]
)

You may consider using the S3Trigger.NONE enumeration on your S3SourceAction trigger parameter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM