Skip to content

pipelines: fleet property dropped when merging CodeBuildOptions #35664

@isker

Description

@isker

Describe the bug

Same bug as #35562 but for fleets.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

fleet is propagated through CodeBuildOptions merging, down to CodeBuild project configuration, such that projects comprising pipeline steps use the configured Fleet.

Current Behavior

That doesn't happen, and the projects stay running on on-demand CodeBuild compute.

Reproduction Steps

const cdkPipeline = new CodePipeline(this, "CodePipeline", {
  synth: new CodeBuildStep("Synth", {
    input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', {
    connectionArn:
      'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41',
    commands: ['npm ci', 'npm run build', 'npx cdk synth'],
  }),
  codeBuildDefaults: {
    buildEnvironment: {
      fleet: new Fleet(this, "Fleet", {
        computeType: FleetComputeType.CUSTOM_INSTANCE_TYPE,
        environmentType: EnvironmentType.LINUX_CONTAINER,
        computeConfiguration: {
          instanceType: new InstanceType("t3.medium"),
        },
      }),
    },
  },
});

Synths things like this:

    "PipelineBuildSynthCdkBuildProjectD03FD7AF": {
      "Properties": {
        // [...]
        "Environment": {
          "ComputeType": "BUILD_GENERAL1_SMALL",
          // Fleet is missing here!
          // "Fleet": {
          //  "FleetArn": {
          //    "Fn::GetAtt": [
          //      "Fleet30813DF3",
          //      "Arn",
          //    ],
          //  },
          // },
          "Image": "aws/codebuild/standard:7.0",
          "ImagePullCredentialsType": "CODEBUILD",
          "PrivilegedMode": false,
          "Type": "LINUX_CONTAINER",
        },
        // [...]
      },
      "Type": "AWS::CodeBuild::Project",
    },

Possible Solution

Repeat https://github.com/aws/aws-cdk/pull/35584/files for fleet.

While you're in there, consider putting both dockerServer and fleet into serializeBuildEnvironment which is right next to mergeBuildEnvironments. These things should be present there.

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.219.0

AWS CDK CLI version

2.1029.4

Node.js Version

N/A

OS

N/A

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/pipelinesCDK Pipelines librarybugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions