简体   繁体   English

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

[英]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.

相关问题 如何从 buildspec 文件中获取 CodeBuild 项目名称 - How to get CodeBuild project name from buildspec file 您如何编写用于 NodeJS 和 AWS CodeBuild 的 buildspec.yml? - How do you write buildspec.yml for use with NodeJS and AWS CodeBuild? 如何使用 AWS CodePipeline 为 Laravel 应用程序正确创建 buildspec.yml 文件 - How do I properly create buildspec.yml file for Laravel Application using AWS CodePipeline 我们如何通过 Boto3 API 从每个代码构建项目中获取 buildspec.yml 文件的内容 - how can we get contents of a buildspec.yml file from each codebuild project through Boto3 API AWS Lambda Python - 将密钥复制到“文件夹”会创建嵌套的“文件夹”。 如何从监视中排除“文件夹” - AWS Lambda Python - copying keys to a "folder" creates nested "folders". How do I exclude a "folder" from being monitored AWS CodeBuild - BuildSpec.yml - 导出变量未解析值 - AWS CodeBuild - BuildSpec.yml - exported-variables are not resolving values AWS Codecommit - Codebuild 将分支名称传递给 buildspec.yml - AWS Codecommit - Codebuild pass branch name to buildspec.yml 图像未从代码构建发送到 ecr,而构建规范没有错误 - Image not sent to ecr from codebuild while buildspec has no error CDK中的CodeBuild如何获取暴露变量? - How Do I Obtain Exposed Variables From CodeBuild In The CDK? AWS Copilot 管道失败,为什么 CodeBuild 找不到 buildspec.yml? - AWS Copilot pipeline fails, why cant CodeBuild find buildspec.yml?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM