aws-codebuild-docker-images icon indicating copy to clipboard operation
aws-codebuild-docker-images copied to clipboard

Add support for excluding files/directories from mounted source

Open rkgrep opened this issue 4 years ago • 5 comments

When local agent mounts source path, it includes all sub-directories including .git, node_modules, etc. This either makes DOWNLOAD_SOURCE step very long or breaks local development environment most of the time, there must be some way to control which files are being mounted.

rkgrep avatar Mar 23 '20 03:03 rkgrep

I also struggled with the 'DOWNLOAD_SOURCE' times but then re-read the flags and added '-m' so that the CodeBuild image mounts the specified source directory directly instead of creating a temporary copy.

./codebuild_build.sh -i <image> -s <path_to_repo> -m

adanemayer avatar Apr 24 '20 03:04 adanemayer

Another workaround is to mount an empty folder with a compressed version of your code using git archive or tar then extract it in your buildspec.

kevin-brotcke avatar Jul 21 '20 08:07 kevin-brotcke

It feels like -m should be the default behavior honestly considering this is used for local testing.

jeremyj563 avatar Sep 01 '20 13:09 jeremyj563

Mount the source directory directly might be created unexpected side effect. For example, npm install will be one of the steps in pre_build. The working directory will be polluted with mounting approach since node_modules are existed when development. Also, developers would expect the build is running is an isolated environment.

hermanho avatar Dec 05 '20 10:12 hermanho

So I see 4 years later this is still not done. From what I understand we don't have the source for the local_builder so we can't do this ourselves, what have people been doing to avoid having the node_modules in the build?

dangeReis avatar Mar 08 '24 15:03 dangeReis