0

The install commands in the Build Step of the AWS CodePipeline do not update when there are changes made in the AWS CDK Code (TypeScript) and are pushed to the repository. The Buildspec section under the Build details of the project has the same configuration as when it was created.

Is there a way to fix it? We've made some changes to the BuildStep CDK but does not take effect on the AWS CodeBuild configuration details. I'm only new to AWS CodeBuild and CodePipeline. Any answer/suggestion would be a great help.

Sample Code

const pipeline = new CodePipeline(this, 'SamplePipeline', {
    pipelineName: 'SamplePipeline',
    synth: new CodeBuildStep('BuildSynthStep', {
            input: source,
            buildEnvironment: {
                buildImage: codebuild.LinuxBuildImage.STANDARD_5_0
            },
            installCommands: [
                'install_command_1',
                'install_command_2',
                ...
                'install_command_n'
            ],
            commands: [
                'command_2',
                ...
                'command_n'
            ],
        }
    )
});

Artifact Provider: Amazon S3

6
  • What pipeline construct are you using? It would be helpful to have some minimal code in the question. Commented Jan 24, 2023 at 6:58
  • I would suggest you to use a seperate yml file for your build commands and include that file during the codebuild project creation. Commented Jan 24, 2023 at 7:02
  • Assuming you're talking about the pipelines module - it will only be changed after the SelfUpdate step, which mutates the pipeline. Commented Jan 24, 2023 at 14:07
  • @fedonev I added the sample code that we are using for the Pipeline. Commented Jan 25, 2023 at 1:05
  • @JatinMehrotra thanks for the suggestion, it is well appreciated. But one of the requirements of the project is to use an AWS CDK code for it. Commented Jan 25, 2023 at 1:11

1 Answer 1

1

The self-mutation of a CDK Pipeline is only applied, when you change something on an application stage (precisely CDK Stage) or other phases after the synth codebuild job.

If you have something running before, e.g. unit tests, then you won't get into the self-update job.

So, what are your options now?

Well, changes according to a pipeline itself are mostly done manually. So you have to re-run a cdk deploy PipelineStack on your local machine with your changes committed to the source branch aside.

Sign up to request clarification or add additional context in comments.

3 Comments

By saying to run a cdk deploy PipelineStack, does that mean to redeploy the PipelineStack for it to read the changes to the AWS CodeBuild configuration?
exactly. i edited my answer to make it more clear hopefully.
@undefine97 See the docs for a description of the CDK pipeline's self-mutating behaviour and related advice about working on the pipeline.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.