Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDK Pipelines: Circular dependency on initial CDK Deploy for python #18854

Closed
terryobot opened this issue Feb 7, 2022 · 3 comments
Closed

CDK Pipelines: Circular dependency on initial CDK Deploy for python #18854

terryobot opened this issue Feb 7, 2022 · 3 comments
Assignees
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@terryobot
Copy link

What is the problem?

getting the following error message when trying to deploy initial cdk pipeline using python

Circular dependency between resources: [PipelineBuildSynthCdkBuildProject6BEFA8E6, PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290, PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C, PipelineSourceterryobotdevopsWebhookResource38D875D7, Pipeline9850B417]

Reproduction Steps

i have removed account information from the code
app.py file

#!/usr/bin/env python3
import os

import aws_cdk as cdk
from infrastructure.vpc_stack import VPC
from infrastructure.infrastructure_pipeline import InfrastructurePipeline
from constructs import Construct

AWS Environment specification

Account class

env_stg = cdk.Environment(account="accountnumber", region="us-east-1")
env_prd = cdk.Environment(account="accountnumber", region="us-east-1")

Application entrypoint

app = cdk.App()

infrastructure_stack = InfrastructurePipeline(app, "TAPP-Infrastructure-Pipeline", description = f"CDK Pipeline for TAPP {env_name}")
app.synth()

pipeline stack

import aws_cdk as cdk
from infrastructure.vpc_stack import VPC
from aws_cdk import Stack, Stage
from aws_cdk.pipelines import(
CodePipeline as codepipeline,
CodePipelineSource as codepipelinesource,
ShellStep as shellstep
)

from constructs import Construct

class InfrastructurePipeline(Stack):

def __init__(self, scope: Construct, construct_id: str, **kwargs,) -> None:
    super().__init__(scope, construct_id, **kwargs)


    self.pipeline =  codepipeline(self, "Pipeline", 
                    pipeline_name="Insfastructure_Pipeline",
                    self_mutation=False,
                    synth=shellstep("Synth", 
                        input=codepipelinesource.git_hub("user/repo", "stg",
                            authentication=cdk.SecretValue.secrets_manager('github-token')
                        ),
                        commands=["npm install -g aws-cdk", 
                            "python -m pip install -r requirements.txt", 
                            "cdk synth"]
                    )
                )

What did you expect to happen?

i am execting deployment of a cdk pipeline but i get the following error message

What actually happened?

i get the following error message when i deploy the stack

Infrastructure-Pipeline failed: Error [ValidationError]: Circular dependency between resources: [PipelineBuildSynthCdkBuildProject6BEFA8E6, PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290, PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C, PipelineSourceterryobotdevopsWebhookResource38D875D7, Pipeline9850B417]
at Request.extractError (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/protocol/query.js:50:29)
at Request.callListeners (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:686:14)
at Request.transition (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:688:12)
at Request.callListeners (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
code: 'ValidationError',
time: 2022-02-07T11:05:53.490Z,
requestId: '7dc7f937-3049-408a-b746-c2250f014224',
statusCode: 400,
retryable: false,
retryDelay: 575.0968943234187
}
Circular dependency between resources: [PipelineBuildSynthCdkBuildProject6BEFA8E6, PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290, PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C, PipelineSourceterryobotdevopsWebhookResource38D875D7, Pipeline9850B417]

CDK CLI Version

2.8.0 (build 8a5eb49)

Framework Version

No response

Node.js Version

v16.13.2

OS

mac os 12.1

Language

Python

Language Version

3.9.5

Other information

cdk is creating dependencies for initial deploy state

@terryobot terryobot added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 7, 2022
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Feb 7, 2022
@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 8, 2022

Fixed by this PR: #18686

@rix0rrr rix0rrr closed this as completed Feb 8, 2022
@github-actions
Copy link

github-actions bot commented Feb 8, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@terryobot
Copy link
Author

I currently have 2.10.0 (build e5b301f) and that does not seem to resolve the issue, please advice thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants