I am trying to set up automatic deployment for the Angular 2 app with AWS Pipeline, S3 and CodeBuild.
Following Andrés' tutorial I was able to connect CodeBuild the GitHub repo and the process works great.
However, our Angular app lives inside a subdirectory of the bigger repo.
Is there a way to specify a directory inside a repo, so that the build will only be triggered if the subdirectory changed?
Thanks a lot.
If you are GitHub webhooks in CodeBuild, you now have a file_path
option, which will allow you to trigger the build only when a specific file or directory is changed.
Documentation: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-github-pull-request.html#sample-github-pull-request-filter-webhook-events-console
It doesn't look like you can just pull down a certain folder but the artifact for the build spec you can specify the directories that are used for the build.
For GitHub, for the optional Source version value, type a commit ID, a pull request ID, a branch name, or a tag name that corresponds to the version of the source code you want to build. If a pull request ID is specified, it must use the format pr/pull-request-ID (for example, pr/25). If a branch name is specified, the branch's HEAD commit ID will be used. If Source version is blank, the default branch's HEAD commit ID will be used.
http://docs.aws.amazon.com/codebuild/latest/userguide/run-build.html
artifacts Optional sequence. Represents information about where AWS CodeBuild can find the build output and how AWS CodeBuild will prepare it for uploading to the Amazon S3 output bucket. This sequence is not required if, for example, you are building and pushing a Docker image to Amazon ECR, or you are running unit tests on your source code but not building it. files: Required sequence. Represents the locations containing the build output artifacts in the build environment. Contains a sequence of scalars, with each scalar representing a separate location where AWS CodeBuild can find build output artifacts, relative to the original build location. Locations can include the following: A single file (for example, my-file.jar). A single file in a subdirectory (for example, my-subdirectory/my-file.jar or my-parent-subdirectory/my-subdirectory/my-file.jar). '/' represents all files recursively. my-subdirectory/ represents all files in a subdirectory named my-subdirectory. my-subdirectory//* represents all files recursively starting from a subdirectory named my-subdirectory.
http://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With