简体   繁体   English

重试失败 Firebase Function 使用 Github 操作部署失败

[英]Retry on failure Firebase Function deploy failing using Github Action

I have a firebase function that is triggers on firestore doc OnCreate with failurePolicy set to true like so:我有一个 firebase function 在firestore doc OnCreate上触发, failurePolicy设置为true ,如下所示:

const webhookHandler = functions
  .runWith({
    failurePolicy: true,
    memory: '512MB',
    timeoutSeconds: 60,
  }).firestore.document(`${COLLECTIONS.eventsQueue}/{event_queue_id}`)
  .onCreate(async (snap, context) => {

   //some code here...
})

Locally, using Firebase CLI i can deploy successfully, but requires I acknowledge that this function will retried on failure, do you still want to deploy?在本地,使用 Firebase CLI 我可以成功部署,但需要我承认此 function 将在失败时重试,您还想部署吗? Yes/No .是/否

once Yes is selected the function deploys successfully.一旦选择,function 部署成功。

I'm using Github Actions to deploy the firebase functions automatically on PR merge.我正在使用 Github 操作在 PR 合并时自动部署 firebase 功能。 and Once i added the above function the github action deploy fails.一旦我添加了上述 function github 动作部署失败。

My assumption is that github action deploy is failing because the prompt.我的假设是 github 操作部署失败,因为提示。

My github deploy github action script does have --non-interactive and also tried with --force and it keeps failing.我的 github deploy github 动作脚本确实有--non-interactive并且也尝试了--force并且它一直失败。

Seems the --force does not enforce on this function deploy locally or in github deploy.似乎--force不会在此 function 本地部署或 github 部署中强制执行。 Any suggestions to resolve this.任何解决此问题的建议。

You can use the yes command included with most linux distros.您可以使用大多数 linux 发行版附带的yes命令。

yes | firebase deploy...

credit to @nVitus helped solve this.感谢@nVitus 帮助解决了这个问题。

the exact script that solves it:解决它的确切脚本:

yes | firebase deploy --only functions --force

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM