AWS CodeBuild Git连接-仅刷新更新的代码

问题描述 投票:1回答:1

我正在使用AWS打包我的node10.x lambda代码和我的站点的依赖项。我有按功能划分的git存储库-因此,我有一个专用于我的rest-auth lambda的存储库作为示例(我仍在积极开发此存储库,因此缺少buildspec和功能文件)。

我的git repo具有以下布局:

.
├── buildspec
│   ├── postmark.yml
│   ├── rest-auth-login.yml
│   ├── rest-auth-password-link.yml
│   └── rest-auth-register.yml
├── function_code
│   ├── login.js
│   ├── password-link.ext
│   ├── postmark.js
│   ├── register.js
│   └── rgistration-confirm.js
├── .gitignore
└── README.md

现在,当我将更新推送到github时,所有4个buildspec配置启动并在S3存储桶中创建4个zip文件供我的lambda读取。

但是,即使仅更改了其基础代码之一,也将重新创建所有4个zip文件-我知道我可以将每个函数拆分为自己的存储库,但是有一种方法可以将AWS CodeBuild配置为仅触发更新给定的buildspec是否在仓库中更改了特定文件?

是否仅在更改postmark.yml文件后才运行postmark.js

示例postmark.yml

version: 0.2

phases:
  install:
    runtime-versions:
      nodejs: 10  
    commands:
      - npm install postmark
artifacts:
  files:
    - 'function_code/postmark.js'
    - 'node_modules/**/*'
amazon-web-services aws-codebuild
1个回答
1
投票

是。您可以使用“ file_path”选项仅在按https://docs.aws.amazon.com/codebuild/latest/userguide/sample-github-pull-request.html#sample-github-pull-request-filter-webhook-events-console

中所述更改特定文件时触发

在邮戳构建的源代码中添加以下内容将导致该构建仅在更新postmark.js文件时触发

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