gpt4 book ai didi

amazon-web-services - AWS 代码管道中用于无服务器框架的 Buildspec.yml

转载 作者:行者123 更新时间:2023-12-04 03:55:50 25 4
gpt4 key购买 nike

我正在尝试为无服务器框架开发 CI/CD 管道。

我曾为 SAM 框架做过类似的事情,并且让它工作了。SAM框架有打包和部署两个步骤(部署由cloudformation actions处理)

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

谁能帮我构建和部署其中的一部分?

最佳答案

基于评论和聊天讨论。

一些问题导致了问题:

  1. 缺少 serverless.yml。通过将 template.yml 重命名为 serverless.yml 解决了这个问题。
  2. 无服务器提供商的配置文件错误。此问题已通过移除得到解决。
  3. 缺少 CodeBuild 角色的权限。通过向该角色添加 codeformation、s3 和 cloudwatch 日志权限来纠正此问题。

关于amazon-web-services - AWS 代码管道中用于无服务器框架的 Buildspec.yml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63933864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com