我正在尝试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
有人可以帮助我进行构建和部署吗?
答案 0 :(得分:1)
基于评论和聊天讨论。
有几个问题引起了问题:
serverless.yml
。通过将template.yml
重命名为serverless.yml
可以解决此问题。