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

[aws-codebuild] addFileSystemLocation() doesn't append fileSystemLocation #10442

Closed
y13i opened this issue Sep 19, 2020 · 1 comment · Fixed by #10460
Closed

[aws-codebuild] addFileSystemLocation() doesn't append fileSystemLocation #10442

y13i opened this issue Sep 19, 2020 · 1 comment · Fixed by #10460
Assignees
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild bug This issue is a bug. effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. p1

Comments

@y13i
Copy link

y13i commented Sep 19, 2020

addFileSystemLocation() doesn't append the fileSystemLocation to the Project.

Reproduction Steps

  1. Set up an app $ cdk init app --language=typescript

  2. Implement this

import { Stack, Construct, StackProps } from "@aws-cdk/core";
import {
  Project,
  BuildSpec,
  FileSystemLocation,
  Artifacts,
  Source,
} from "@aws-cdk/aws-codebuild";
import { Bucket } from "@aws-cdk/aws-s3";
import { Repository } from "@aws-cdk/aws-codecommit";

export class App4Stack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const buildSpec = BuildSpec.fromObject({
      version: "0.2",
      phases: {
        build: {
          commands: ['echo "Hello world!"'],
        },
      },
    });

    const fileSystemLocation1 = FileSystemLocation.efs({
      identifier: "efs1",
      location: "fs-11111111.efs.eu-west-1.amazonaws.com:/",
      mountPoint: "/efs1",
    });

    const fileSystemLocation2 = FileSystemLocation.efs({
      identifier: "efs2",
      location: "fs-22222222.efs.eu-west-1.amazonaws.com:/",
      mountPoint: "/efs2",
    });

    // This works
    const project1 = new Project(this, "project1", {
      buildSpec,
      fileSystemLocations: [fileSystemLocation1],
    });

    // This also works
    const project2 = new Project(this, "project2", {
      buildSpec,
      fileSystemLocations: [fileSystemLocation1],
    });
    project2.addFileSystemLocation(fileSystemLocation2);

    // This doesn't work
    const project3 = new Project(this, "project3", {
      buildSpec,
    });
    project3.addFileSystemLocation(fileSystemLocation1);

    // This also doesn't work
    const project4 = new Project(this, "project4", {
      buildSpec,
      fileSystemLocations: [],
    });
    project4.addFileSystemLocation(fileSystemLocation1);

    // Debug output shows no difference
    console.log({
      project1: (project1 as any)._fileSystemLocations,
      project3: (project3 as any)._fileSystemLocations,
      project4: (project4 as any)._fileSystemLocations,
    });

    // .addSecondarySource() works btw
    project3.addSecondarySource(
      Source.codeCommit({
        repository: Repository.fromRepositoryName(this, "repo", "repo"),
        identifier: "secondarySource1",
      })
    );

    // .addSecondaryArtifact() works as well
    project4.addSecondaryArtifact(
      Artifacts.s3({
        bucket: Bucket.fromBucketName(this, "bucket", "bucket"),
        identifier: "secondaryArtifact1",
      })
    );
  }
}
  1. Synthesize cfn template cdk synth

What did you expect to happen?

All projects project1, project2, project3 and project4 to have FileSystemLocations property as defined.

What actually happened?

project3 and project4 lacks FileSystemLocations property for each resource definition on cfn template output.

Environment

  • CLI Version : 1.63.0 (build 7a68125)
  • Framework Version: aws-cdk=1.63.0,@aws-cdk/assets=1.63.0,@aws-cdk/aws-applicationautoscaling=1.63.0,@aws-cdk/aws-autoscaling-common=1.63.0,@aws-cdk/aws-cloudwatch=1.63.0,@aws-cdk/aws-codebuild=1.63.0,@aws-cdk/aws-codecommit=1.63.0,@aws-cdk/aws-codeguruprofiler=1.63.0,@aws-cdk/aws-ec2=1.63.0,@aws-cdk/aws-ecr=1.63.0,@aws-cdk/aws-ecr-assets=1.63.0,@aws-cdk/aws-events=1.63.0,@aws-cdk/aws-iam=1.63.0,@aws-cdk/aws-kms=1.63.0,@aws-cdk/aws-lambda=1.63.0,@aws-cdk/aws-logs=1.63.0,@aws-cdk/aws-s3=1.63.0,@aws-cdk/aws-s3-assets=1.63.0,@aws-cdk/aws-sqs=1.63.0,@aws-cdk/aws-ssm=1.63.0,@aws-cdk/cloud-assembly-schema=1.63.0,@aws-cdk/core=1.63.0,@aws-cdk/custom-resources=1.63.0,@aws-cdk/cx-api=1.63.0,@aws-cdk/region-info=1.63.0,jsii-runtime=node.js/v14.11.0
  • Node.js Version: v14.11.0
  • OS : macOS Mojave 10.14.6
  • Language (Version): TypeScript (at least)

Other

The implementation of addFileSystemLocation() looks very similar to addSecondaryArtifact(). But addSecondaryArtifact() works fine as long as I tested.


This is 🐛 Bug Report

@y13i y13i added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 19, 2020
@github-actions github-actions bot added the @aws-cdk/aws-codebuild Related to AWS CodeBuild label Sep 19, 2020
@skinny85
Copy link
Contributor

Hey @y13i ,

thanks for opening the issue. Confirming I was able to reproduce it. Working on a fix.

Thanks,
Adam

@skinny85 skinny85 added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Sep 21, 2020
skinny85 added a commit to skinny85/aws-cdk that referenced this issue Sep 21, 2020
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Sep 21, 2020
@mergify mergify bot closed this as completed in #10460 Sep 22, 2020
mergify bot pushed a commit that referenced this issue Sep 22, 2020
…roviding locations at construction (#10460)

Fixes #10442

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild bug This issue is a bug. effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. p1
Projects
None yet
3 participants