question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[pipelines] self-update build fails with named pipeline stack

See original GitHub issue

When naming the pipeline stack using the stackName property with a different name than the id, the self-update build fails with an error that it cannot find the stack.

Reproduction Steps

Create a pipeline project and give the pipeline stack a custom name.

import * as cdk from '@aws-cdk/core';
import { PipelineStack } from '../lib/pipeline-stack';

const app = new cdk.App();

new PipelineStack(app, 'PipelineStack', {
    stackName: 'Pipeline'
});

app.synth();

Then deploy the project and have a look at the pipeline execution.

What did you expect to happen?

I expected the pipeline stack to be named ‘Pipeline’. This happened successfully on the first deploy from my local command line. Then I expected the pipeline build to execute successfully and update the pipeline, however this step failed. It works fine, when I don’t supply a stackName.

What actually happened?

The update build failed with the error message that it could not find the stack ‘Pipeline’.

95	No stack found matching 'Pipeline'. Use "list" to print manifest
96	Error: No stack found matching 'Pipeline'. Use "list" to print manifest
97	    at CloudAssembly.selectStacks (/usr/local/lib/node_modules/aws-cdk/lib/api/cxapp/cloud-assembly.ts:115:15)
98	    at CdkToolkit.selectStacksForDeploy (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:381:35)
99	    at CdkToolkit.deploy (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:111:20)
100	    at initCommandLine (/usr/local/lib/node_modules/aws-cdk/bin/cdk.ts:197:9)

Environment

  • CLI Version : 1.66.0
  • Framework Version: 1.66.0
  • Node.js Version: v14.11.0
  • OS : Linux x86_64
  • Language (Version): Typescript

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
alehatsmancommented, Jan 18, 2021

Hello,

I was able to workaround the issue with the next code:

class MyCdkPipeline extends CdkPipeline {
  constructor(scope: cdk.Construct, id: string, props: CdkPipelineProps) {
    // pass self mutating false to prevent bug behaviour
    super(scope, id, {...props, selfMutating: false});

    const pipelineStack = cdk.Stack.of(this);

    if (props.selfMutating ?? true) {
      this.codePipeline.addStage({
        stageName: 'UpdatePipeline',
        actions: [new UpdatePipelineAction(this, 'UpdatePipeline', {
          cloudAssemblyInput: props.cloudAssemblyArtifact,
          // use logical id as pipelineStackName to get correct cli command
          pipelineStackName: pipelineStack.node.id,
          cdkCliVersion: props.cdkCliVersion,
          projectName: `${props.pipelineName}-selfupdate`,
        })]
      })
    }
  }
}
0reactions
github-actions[bot]commented, May 21, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

SelfMutate stage failing with CodePipeline - Stack Overflow
pipelines.CodePipeline in Java. This pipeline creates another stack named xxxJavaxxxStack. The pipeline is able to connect to external github, ...
Read more >
aws-cdk/pipelines module - AWS Documentation - Amazon.com
CDK Pipelines is an opinionated construct library. It is purpose-built to deploy one or more copies of your CDK applications using CloudFormation with...
Read more >
AWS CDK Pipelines: Real-World Tips and Tricks (Part 2)
More useful tips and tricks when using AWS CDK Pipelines that go beyond the simple ... How do I develop CDK stacks without...
Read more >
CDK Pipelines - Go Packages
It is purpose-built to deploy one or more copies of your CDK applications using ... to // self-update, and only then use the...
Read more >
Deploy Pipeline Stack - Advanced CDK Workshop
As soon as the pipeline is created, it's going to run, check out the code from GitHub, ... If the build completes without...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found