1

I'm a newbie here and I need any help possible with CDK codepipeline. I'm trying to deploy a module using the pipeline and for some reason its stuck at the 'Assets' execution step.

Error: Cannot read asset manifest at 'assembly-xxxPipelinexxxStack-Deploy/xxxPipelinexxxStackDeployxxxPipelinexxxStackF5F6A16A.assets.json': ENOENT: no such file or directory, stat 'assembly-xxxPipelinexxxStack-Deploy/xxxPipelinexxxStackDeployxxxPipelinexxxStackF5F6A16A.assets.json'

I have checked the cdk.out and it does contain the required file at location assembly-xxxPipelinexxxStack-Deploy/xxxPipelinexxxStackDeployxxxPipelinexxxStackF5F6A16A.assets.json

The auto-created buildspec file is as below:

{
  "version": "0.2",
  "phases": {
    "install": {
      "commands": [
        "npm install -g cdk-assets"
      ]
    },
    "build": {
      "commands": [
        "cdk-assets --path \"assembly-xxxPipelinexxxStack-Deploy/xxxPipelinexxxStackDeployxxxPipelinexxxStackF5F6A16A.assets.json\" --verbose publish \"38341e9ef6b01cd2c7cc3b47cd0d2da98933b1121302bf0b03603950b8ff0bd4:current_account-current_region\""
      ]
    }
  }
}

The pipeline stages are:

  • Source - Success
  • Build - Success
    • Synth - Success
  • Asset
    • FileAsset1 - Failed

Appreciate your time and reply.

TJ-AWS
  • 83
  • 8

1 Answers1

2

You didn't specify this, but I'm assuming you're using CDK pipelines (not aws-cdk-lib.aws_codepipeline).

This is a quirk of CDK pipelines - the buildspec has to change to reflect each change in the asset. What this means in practice is that when you're using assets, you have to enable self-mutation for the pipeline, which you disabled, it seems.

gshpychka
  • 8,523
  • 1
  • 11
  • 31
  • Thanks a lot @gshpychka for your answer, yes, I am using CDK pipeline `awscdk.pipelines.CodePipeline;` However, I had to disable the self mutation because it was failing in the first place, the error I'm getting for self-mutation is: `No stacks match the name(s) xxxPipelinexxxStack` More errors in next comment – TJ-AWS Dec 15 '21 at 14:08
  • `Error: No stacks match the name(s) xxxPipelinexxxStack at CdkToolkit.validateStacksSelected (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:545:13) at CdkToolkit.selectStacksForDeploy (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:492:10) at CdkToolkit.deploy (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:120:20) at initCommandLine (/usr/local/lib/node_modules/aws-cdk/bin/cdk.ts:267:9)` _Command did not exit successfully cdk -a . deploy xxxPipelinexxxStack --require-approval=never --verbose exit status 1_ – TJ-AWS Dec 15 '21 at 14:09
  • 1
    Self-mutation has to be enabled when using assets. As for your issue, I would post it as a separate question, because it is unrelated to the asset issue in the question. Although I would try to do a manual `cdk deploy` of the stack first (with enabled self-mutation). – gshpychka Dec 15 '21 at 14:18
  • Thanks for your quick response - gshpychka. I've tried manual cdk deploy, but still it fails. I've posted a different question as per your advice. – TJ-AWS Dec 15 '21 at 15:21