简体   繁体   中英

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.

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

It follows the same logic as the files: section but does exclude particular files. See: 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.

Thus, based on the comments, the easiest solution to the problem was to simply delete unneeded files and folders in the post_build stage.

1 Solution = exclude in.gitingnore file. 2 Solution = add this in below your code. Let me know if it works

artifacts: files: - '**/ ' excluded_paths: - foldername/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM