1 Star 0 Fork 0

Serverless Devs Registry / fc-plan

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

流程

服务

  1. 获取配置:线上配置【remote】、缓存(本地上次部署的结果配置)【state】、本地配置【local】
  2. 转换配置
  3. 检测没有配置的权限: TODO
  4. 检测如果 remote 不存在:返回获取的配置,标记不需要交互,远端不存在
  5. 转换日志配置 - 检测线上不存在日志配置:删除 remote.logConfig 字段 - 检测线上存在日志配置,并且本地日志配置是 auto:local.logConfig = remote.logConfig
  6. 转换专有网络配置 - 检测线上不存在专有网络配置:删除 remote.vpcConfig 字段 - 检测线上存在专有网络配置,并且本地专有网络配置是 auto:local.vpcConfig = remote.vpcConfig; - 检测线上存在专有网络配置,并且本地也存在专有网络配置:兼容 vSwitchIds/vswitchIds 字段
  7. 转换存储配置 - 检测线上不存在存储配置:删除 remote.nasConfig 字段 - 检测线上存在存储配置,先转换成本地的配置方式;如果本地存储配置是 auto,复用转化配置后的配置
  8. 转换链路追踪 - 检测线上存在链路追踪配置:remote.tracingConfig = 'Enable' - 检测线上不存在链路追踪配置:delete remote.tracingConfig 字段
  9. 服务角色处理 - TODO
  10. remote 删除系统字段 'vendorConfig', 'serviceName', 'serviceId', 'createdTime', 'lastModifiedTime'
  11. diff 转换后的 local 和 remote,记录 diff
  12. 判断转换前的 remote 是否和 state 全等:
  • 全等说明托管给了工具则标记 deploy 不交互
  • 不全等,根据步骤三的 diff 结果判断是否交互,配置有变动则标记 deploy 交互,配置没有变动则标记 deploy 不交互
  1. 返回remote、state、转化后的 local 配置、diff、needInteract

函数

  1. 获取配置:线上配置【remote】、缓存(本地上次部署的结果配置)【state】、本地配置【local】
  2. 转换配置
  3. 检测没有配置的权限: TODO
  4. 检测如果 remote 不存在:返回获取的配置,标记不需要交互,远端不存在
  5. 检测 remote 示例类型是否是 g1,如果不是则 delete remote.gpuMemorySize 字段
  6. 检测 remote customDNS、preStop、preFreeze、initializer,不存在则 是否存在,不存在则删除相关字段
  7. remote 删除系统字段:'lastModifiedTime', 'createdTime', 'codeChecksum', 'codeSize', 'functionName', 'functionId'
  8. 如果 local 存在 environmentVariables,将 environmentVariables 的值强制转化成 string 类型
  9. 如果存在 local 存在 customDNS,深度遍历将 customDNS 的值强制转化成 string 类型
  10. 删除 local 的代码配置:codeUri、ossBucket、ossKey
  11. diff 转换后的 local 和 remote,记录 diff
  12. 将删除的 local 的代码配置回写
  13. 判断转换前的 remote 是否和 state 全等:
  • 全等说明托管给了工具则标记 deploy 不交互
  • 不全等,根据步骤三的 diff 结果判断是否交互,配置有变动则标记 deploy 交互,配置没有变动则标记 deploy 不交互
  1. 返回remote、state、转化后的 local 配置、diff、needInteract

触发器

  1. 获取配置:线上配置【remote】、缓存(本地上次部署的结果配置)【state】、本地配置【local】
  2. 转换配置
  3. 检测没有配置的权限: TODO
  4. 检测如果 remote 不存在:返回获取的配置,标记不需要交互,远端不存在
  5. 将 remote 配置转化成 fc 组件规范的字段
  6. sourceArn 的处理【方案一】:远端的 sourceArn 做拆分处理,还原 trigger.config 配置;然后 local 根据配置组装 sourceArn;这样都会存在两份配置,就做到了配置统一
  7. sourceArn 的处理【方案二】:然后 local 根据配置组装 sourceArn,然后删除组装的字段。PS:这样是否会影响接口的调用待确认
  8. diff 转换后的 local 和 remote,记录 diff
  9. 判断转换前的 remote 是否和 state 全等:
  • 全等说明托管给了工具则标记 deploy 不交互
  • 不全等,根据步骤三的 diff 结果判断是否交互,配置有变动则标记 deploy 交互,配置没有变动则标记 deploy 不交互
  1. 返回remote、state、转化后的 local 配置、diff、needInteract

自定义域名

  1. 获取配置
  2. 获取缓存(本地上次部署的结果配置)【state】
  3. 获取本地配置【local】。当本地配置的名称是 auto 时,则读取缓存里面的 domainName,如果缓存 name 不存在则默认为 domain name 是 `${functionName}.${serviceName}.${userId}.${region}.fc.devsapp.net`.toLocaleLowerCase()
  4. 根据 local 获取线上配置【remote】
  5. 转换配置 // TODO
  6. diff 转换后的 local 和 remote,记录 diff
  7. 判断转换前的 remote 是否和 state 全等:
  • 全等说明托管给了工具则标记 deploy 不交互
  • 不全等,根据步骤三的 diff 结果判断是否交互,配置有变动则标记 deploy 交互,配置没有变动则标记 deploy 不交互
  1. 返回remote、state、转化后的 local 配置、diff、needInteract
MIT License Copyright (c) 2020 Serverless Devs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

None 展开 收起
TypeScript 等 2 种语言
MIT
取消

发行版 (39)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/devsapp/fc-plan.git
git@gitee.com:devsapp/fc-plan.git
devsapp
fc-plan
fc-plan
master

搜索帮助