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

[pipelines] Circular reference when using ECR Repository for SimpleSynthAction #10535

Closed
mattbrading opened this issue Sep 25, 2020 · 1 comment · Fixed by #10654
Closed

[pipelines] Circular reference when using ECR Repository for SimpleSynthAction #10535

mattbrading opened this issue Sep 25, 2020 · 1 comment · Fixed by #10654
Assignees
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. effort/small Small work item – less than a day of effort needs-triage This issue or PR still needs to be triaged. p1

Comments

@mattbrading
Copy link

mattbrading commented Sep 25, 2020

When specifying a ECR Repository as the Build Image for a SimpleSynthAction, a circular reference error is thrown.

Reproduction Steps

import * as cdk from '@aws-cdk/core'
import * as pipelines from '@aws-cdk/pipelines'
import * as codepipeline from '@aws-cdk/aws-codepipeline'
import * as actions from '@aws-cdk/aws-codepipeline-actions'
import * as codebuild from '@aws-cdk/aws-codebuild'
import * as ecr from '@aws-cdk/aws-ecr'

const app = new cdk.App()
const stack = new cdk.Stack(app, 'MyStack')

const sourceArtifact = new codepipeline.Artifact('source')
const cloudAssemblyArtifact = new codepipeline.Artifact('output')

new pipelines.CdkPipeline(stack, 'Pipeline', {
  cloudAssemblyArtifact,
  sourceAction: new actions.GitHubSourceAction({
    actionName: 'GitHub',
    oauthToken: cdk.SecretValue.secretsManager('my-secret'),
    output: sourceArtifact,
    owner: 'mattbrading',
    repo: 'my-repo'
  }),
  synthAction: pipelines.SimpleSynthAction.standardNpmSynth({
    sourceArtifact,
    cloudAssemblyArtifact,
    environment: {
      buildImage: codebuild.LinuxBuildImage.fromEcrRepository(
        ecr.Repository.fromRepositoryName(stack, 'ECRImage', 'my-repo-name')
      )
    }
  })
})

What did you expect to happen?

Use a ECR Repository as the Build Image for the Simple Synth Action.
This code worked in v1.62.0

What actually happened?

An error is thrown, indicating a circular reference:

npx cdk synth -a 'ts-node ./debugCdk.ts'                                                                                      ~/workspace/tvr-pipeline-cdk

/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:57
    throw new Error('Unable to resolve object tree with circular reference. Path: ' + pathName);
          ^
Error: Unable to resolve object tree with circular reference. Path: /environment/buildImage/repository/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host
    at resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:57:11)
    at Object.resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:49:32)
    at resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:155:39)
    at Object.resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:49:32)
    at resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:155:39)
    at Object.resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:49:32)
    at resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:155:39)
    at Object.resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:49:32)
    at resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:155:39)
    at Object.resolve (/Users/mattbrading/my-project/node_modules/@aws-cdk/core/lib/private/resolve.ts:49:32)
Subprocess exited with error 1

Environment

  • CLI Version: 1.64.0
  • Framework Version: 1.64.0
  • Node.js Version: v12.18.1
  • OS : Mac OS 10.15.4
  • Language (Version): TypeScript (4.0.3)

Other

I believe this bug was introduced by the following PR: #10176

Specifically this block of code:

const projectConfigHash = hash(Stack.of(scope).resolve({

 const projectConfigHash = hash(Stack.of(scope).resolve({
      environment,
      buildSpecString: buildSpec.toBuildSpec(),
      environmentVariables,
    }));

This is 🐛 Bug Report

@mattbrading mattbrading added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 25, 2020
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Sep 25, 2020
rix0rrr added a commit that referenced this issue Oct 2, 2020
The environment serialization that is used to calculate a hash
of the project configuration which is used to restart the pipeline
(still following?) was not taking into account that some of the
fields of `Environment` are not just data, but are objects.

We have to turn those into data before we can serialize them.

Fixes #10535.
@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort p1 labels Oct 2, 2020
@mergify mergify bot closed this as completed in #10654 Oct 6, 2020
mergify bot pushed a commit that referenced this issue Oct 6, 2020
The environment serialization that is used to calculate a hash
of the project configuration which is used to restart the pipeline
(still following?) was not taking into account that some of the
fields of `Environment` are not just data, but are objects.

We have to turn those into data before we can serialize them.

Fixes #10535.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Oct 6, 2020

⚠️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.

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. effort/small Small work item – less than a day of effort needs-triage This issue or PR still needs to be triaged. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants