aws codepipeline: Stage does not implement IStage in Python
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
I'm trying to follow the documentation here: https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_codepipeline_actions/README.html#manual-approval-action. My aim is to add an action at the end of a testing stage to destroy the resources I don't need any more.
However, when I try to call `add_action` on a `StageDeployent` object I get the error `'StageDeployment' object has no attribute 'add_action'`. When I try to call it on a `Stage` object, I get the same error: `Stage` object has no attribute `add_action`
### Expected Behavior
I expect the code to synthesize as written in the docs
### Current Behavior
Error as above
### Reproduction Steps
```python
class MentorMatchPipeline(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs):
super().__init__(scope, construct_id, **kwargs)
pipeline = CodePipeline(self, "MentorMatchPipeline",
pipeline_name="Pipeline",
synth=ShellStep("Synth",
input=CodePipelineSource.git_hub("mentor-matching-online/mentor-match", "main"),
commands=["npm install -g aws-cdk",
"cd mentor-match-infra",
"python -m pip install -r requirements.txt",
"cdk synth"],
primary_output_directory="mentor-match-infra/cdk.out"
)
)
testing_stage: Stage = MentorMatchAppStage(self, "testing")
pipeline.add_stage(testing_stage)
production_stage: StageDeployment = pipeline.add_stage(
MentorMatchAppStage(self)
)
production_stage.add_pre(
ManualApprovalStep('approval')
)
delete_action = CloudFormationDeleteStackAction(
admin_permissions=True,
stack_name="MentorMatchStack",
action_name="delete test stack"
)
production_stage.add_action(delete_action) # this should work, but throws an AttributeError
```
Adding this to an existing pipeline will cause the synth to fail with the error `Stage object has no attribute 'add_action'`
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.79.1
### Framework Version
2.79.1
### Node.js Version
20.1.0
### OS
Linux
### Language
Python
### Language Version
3.9.10
### Other information
aws-cdk-lib==2.79.1
jsii==1.81.0
ETA: expanded example
Contributor guide
Research direction
Reproduce the provided Python example and inspect the CodePipeline.add_stage entry point together with the StageDeployment and Stage APIs. Compare those APIs with the manual-approval documentation; done means the documented example no longer raises AttributeError and synthesizes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100