如何从 AWS Codebuild buildspec 文件中排除文件夹?

How do I exclude a folder from AWS Codebuild buildspec file?

所以我需要从我的工件中排除一个文件夹,但谷歌搜索找不到任何信息。

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:
    - '**/*'

1 解决方案 = 在 .gitingnore 文件中排除。 2 解决方案 = 将其添加到您的代码下方。 让我知道它是否有效

工件: 文件: - '**/' excluded_paths: - 文件夹名/

buildspec.yaml 不提供在构建工件时跳过某些文件或文件夹的方法。

因此,根据评论,解决问题的最简单方法是在 post_build 阶段 删除不需要的文件和文件夹

buildspec.yml 目前支持在工件部分排除路径。

  artifacts:
  exclude-paths: 
     - ./**/someFilePatternHere
     - ./**/otherFilePatternHere

它遵循与 files: 部分相同的逻辑,但不排除特定文件。 看: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.artifacts.exclude-paths