我想构建一个codepipeline,它将从github获取代码(java)构建一个jar文件并将其部署到aws lamda(或将jar存储在特定的S3存储桶中)。我只想使用AWS平台提供的工具。
如果我只使用Codebuild,我可以从github代码构建jar并将其存储到S3(https://docs.aws.amazon.com/codebuild/latest/userguide/getting-started.html),我使用部署lamda函数将代码部署到我的服务lamda。只要S3存储桶部署有任何变化,lamda就会被触发。
DrawBack:问题是我必须在提交更改到github后每次手动运行codebuild。我希望这个代码构建从github自动检测更改。
为了解决上述问题,我已经建立了一个代码管道,使用github webhooks检测代码更改,但这里是创建zip文件而不是jar
所以我实际上尝试的是:
GitHub(更改)---> codebuild - >将jar文件存储到具有特定名称的特定S3存储桶或部署到lambda
buildspec.yml
version: 0.2
phases:
build:
commands:
- echo Build started on `date`
- mvn test
post_build:
commands:
- echo Build completed on `date`
- mvn package
artifacts:
files:
- target/testfunction-1.0.0-jar-with-dependencies.jar