我正在尝试CI / CD管道以实现无服务器框架。
我为SAM框架做了类似的事情,并使它起作用。SAM框架有两个步骤,即打包和部署(部署由cloudformation操作处理)
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
#trying after adding the art effect in code deploy
build:
commands:
- npm install time
- export BUCKET=lambda-loadeo-git
- aws cloudformation package --template-file template.yml --s3-bucket $BUCKET --output-template-file outputtemplate.yml
artifacts:
type: zip
files:
- template.yml
- outputtemplate.yml
但是我不确定无服务器应该如何工作。我知道无服务器只有“部署”阶段,没有任何包装。
我不知道在CI / CD中如何处理无服务器部署。这在无服务器部署命令中给出了错误。
这是我的buildspec.yaml文件
version: 0.1
phases:
install:
commands:
- npm install
- npm install -g mocha
- npm install -g serverless
build:
commands:
- serverless deploy
post_build:
commands:
- echo build complete
正在尝试部署此模板:
service: serverless
frameworkVersion: '2'
provider:
name: aws
runtime: python2.7
profile: default
functions:
getInfo:
handler: handler.getInfo
events:
- http:
path: users/info
method: get
createInfo:
handler: handlerpost.createInfo
events:
- http:
path: users/create
method: post
patchInfo:
handler: handlerpatch.patchInfo
events:
- http:
path: users/update
method: patch
有人可以帮我解决部分构建和部署问题吗?
基于评论和聊天讨论。
存在一些导致问题的问题:
serverless.yml
。它通过重命名template.yml
为来解决serverless.yml
。本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句