Deploy Firebase Functions from multiple Repos without deleting them

huangapple go评论93阅读模式
英文:

Deploy Firebase Functions from multiple Repos without deleting them

问题

I have multiple firebase functions in a repo that belongs to a service and therefore we've them within that repo. Apart from those firebase functions we also have another ones living in other repos because they belong to that repo. Until now we were deploying them manually but we are now looking for automating the deployment via Github actions!

Imagine my surprise when I almost messed up production Deploy Firebase Functions from multiple Repos without deleting them The good part is that the pipeline failed because of not being non-interactive! Thanks Google for that!

Now focusing on the matter! So my goal is to be able to deploy all functions from a centralized pipeline without deleting the ones that already exist in the same firebase account!

The initial setup I was doing a simple firebase deploy --only functions, but as far as I understood the way to go is to specify all the functions that we want to deploy in the form of: firebase deploy --only functions:addMessage,functions:makeUppercase,etc... which brings the real problem

We have like 20 functions and each file can have like 2 or 3 different functions. Having to specify each one of the firebase functions and pass it to the pipeline looks like an insane thing to do but also the only one that I can't think of after seeing that there is not much about the subject.

TL;DR: Want to deploy firebase functions from multiple repos without deleting the ones already present! How do I extract from the src folder all the firebase functions so that I can use it in the `firebase deploy --only functions:function1,functions:function2,etc. Is there a better way than creating a script for this?

英文:

I have multiple firebase functions in a repo that belongs to a service and therefore we've them within that repo. Apart from those firebase functions we also have another ones living in other repos because they belong to that repo. Until now we were deploying them manually but we are now looking for automating the deployment via Github actions!

Imagine my surprise when I almost fucked up production Deploy Firebase Functions from multiple Repos without deleting them The good part is that the pipeline failed because of not being non-interative! Thanks Google for that!

Now focusing on the matter!
So my goal is to be able to deploy all functions from a centralized pipeline without deleting the ones that already exists in the same firebase account!

The initial setup i was doing a simple firebase deploy --only functions, but as far as I understood the way to go is to specify all the functions that we want to deploy in the form of: firebase deploy --only functions:addMessage,functions:makeUppercase,etc... which brings the real problem

We have like 20 functions and each file can have like 2 or 3 different functions.
Having to specify each one of the firebase functions and pass it to the pipeline looks like an insane thing to do but also the only one that I can't think of after seeing that there is not much about the subject.

TL;DR: Want to deploy firebase functions from multiple repos without deleting the ones already present! How do I extract from the src folder all the firebase functions so that I can use it in the `firebase deploy --only functions:function1,functions:function2,etcc. Is there a better way than creating a script for this?

答案1

得分: 1

这可以通过在firebase.json文件中添加"codebase": "repoA"来实现。

在添加存储库的"codebase"时,函数将仅部署查看该存储库,而忽略来自其他存储库的其他函数。

谷歌的文档解释得很好,尽管我在理解多库存储结构时感到困惑!

文档链接: https://firebase.google.com/docs/functions/organize-functions#managing_multiple_repositories

英文:

Well I guess I should not read documentation late at night!

This can be achieved by having "codebase": "repoA" in the firebase.json file.

When adding codebase in the repositories, the functions will deploy only looking at that repo and ignoring the other functions from another repos.

The documentation from google explains it well even though i got confused with the monorepos structure!

Link to documentation: https://firebase.google.com/docs/functions/organize-functions#managing_multiple_repositories

huangapple
  • 本文由 发表于 2023年3月21日 03:15:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/75794415-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定