[英]How do I exclude a folder from AWS Codebuild buildspec file?
So I need to exclude a folder from my artifacts, but googling around could not find any info.所以我需要从我的工件中排除一个文件夹,但谷歌搜索找不到任何信息。
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
build:
commands:
- echo Build started on `date`
- echo Compiling the Node.js code
- mocha test.js
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- '**/*'
buildspec.yml currently support excluding paths in the artifacts section. buildspec.yml 当前支持在工件部分中排除路径。
artifacts:
exclude-paths:
- ./**/someFilePatternHere
- ./**/otherFilePatternHere
It follows the same logic as the files: section but does exclude particular files.它遵循与 files: 部分相同的逻辑,但不排除特定文件。 See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.artifacts.exclude-paths请参阅: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.artifacts.exclude-paths
buildspec.yaml does not provide a way to skip some files or folders when constructing artifacts. buildspec.yaml不提供在构建工件时跳过某些文件或文件夹的方法。
Thus, based on the comments, the easiest solution to the problem was to simply delete unneeded files and folders in the post_build
stage.因此,根据评论,解决该问题的最简单方法是在post_build
阶段简单地删除不需要的文件和文件夹。
1 Solution = exclude in.gitingnore file. 1 解决方案 = 排除 in.gitingnore 文件。 2 Solution = add this in below your code. 2 解决方案 = 将其添加到您的代码下方。 Let me know if it works让我知道它是否有效
artifacts: files: - '**/ ' excluded_paths: - foldername/工件:文件:-'**/ 'excluded_paths:-文件夹名/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.