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

问题描述 投票:0回答:3

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

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:
    - '**/*'
amazon-web-services aws-codebuild
3个回答
8
投票

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

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


4
投票

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

因此,根据评论,解决问题的最简单方法是在post_build阶段简单地

删除不需要的文件和文件夹


-1
投票

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

工件: 文件: - '**/' 排除路径: -文件夹名/

© www.soinside.com 2019 - 2024. All rights reserved.