如何从 AWS Codebuild 构建规范文件中排除文件夹?

Mad*_*deo 2 amazon-web-services aws-codebuild

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

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:
    - '**/*'
Run Code Online (Sandbox Code Playgroud)

小智 8

buildspec.yml 当前支持排除工件部分中的路径。

  artifacts:
    exclude-paths: 
      - ./**/someFilePatternHere
      - ./**/otherFilePatternHere
Run Code Online (Sandbox Code Playgroud)

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

ps:exclude-paths 是相对于base-directory 属性的。

  • 请小心缩进 - `exclude-paths` 是 `artifacts` 的属性,应该缩进。 (2认同)