只有在Function App未执行的情况下,才能在推送上使用GitHub操作在Azure Function上部署



我有一个函数应用程序,它基本上是从web上抓取数据。这是一个长期运行的项目,通常每天需要9个小时。我已经为build&通过GitHub操作进行部署。

问题:当我们向GitHub推送任何更改,并且函数应用程序正在运行时,它会造成混乱,因为运行中的函数将在部署后停止并触发。

我希望在每次推送时都能部署一个解决方案,但只能在功能应用程序未运行时部署。

yml文件的内容:

name: dev-workflow
on:
push:
branches:
- main
env:
AZURE_FUNCTIONAPP_NAME: test-github-actions
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
PYTHON_VERSION: '3.7'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
uses: actions/setup-python@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 'Resolve Project Dependencies Using Pip'
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
python -m pip install --upgrade pip
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.PUBLISH_PROFILE }}

根据chrispat的这篇帖子回复(6个月前(任何本机功能,以防止当前Github Actions上的重复工作流。

但是,此操作可能有助于防止重复操作以启动

另一种选择是限制并发工作流运行,您可以在本文中找到更多信息。

相关内容

最新更新