【问题标题】:sync python code on GitHub repo and deploy on Azure function在 GitHub 存储库上同步 python 代码并在 Azure 函数上部署
【发布时间】:2021-05-23 22:56:05
【问题描述】:

我想同步代码(在 azure 函数文件夹中)。我按照文档创建了一个 github 操作 cd。但是,在我的功能部分功能的 azure 门户中,我的文件夹没有出现。任何人都知道问题是什么。我的工作流程没有错误。

当我尝试重新部署/同步我的代码时出现错误:未找到...

My Worflow File

【问题讨论】:

  • 你的函数应用中有哪些应用设置?
  • 嗨,这个问题怎么样?下面的答案是否解决了您的问题?如果没有,请告诉我有关此问题的最新信息吗?
  • @Vito Liu-MSFT 我也做了部署槽所示的工作流程,但我的功能没有出现。文件应该是文件夹中的 init.py 和 function.json 吗?因为它是
  • @MaxIvanov 这是我的设置ibb.co/mzcnxfn
  • 我也遇到了类似的问题,我的 github 操作没有更新 azure 函数代码

标签: azure github azure-functions github-actions


【解决方案1】:

只需发布我如何从 GitHub 存储库部署功能。

我的文件结构: https://github.com/Paprika-a11y/pythonfunc.git

  1. 导航到部署中心页面,配置设置:
  2. 保存设置后,在 GitHub Action 上查看部署过程:
  3. 如果你的函数项目在本地是正确的,那么它应该出现在门户上:

如果您需要工作流程,这里是自动生成的文件:

# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Python project to Azure Function App - pyfunctemp

on:
  push:
    branches:
      - main
  workflow_dispatch:

env:
  AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
  PYTHON_VERSION: '3.7' # set this to the python version to use (supports 3.6, 3.7, 3.8)

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - name: 'Checkout GitHub Action'
      uses: actions/checkout@master

    - 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: 'pyfunctemp'
        slot-name: 'production'
        package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
        publish-profile: ${{ secrets.AzureAppService_PublishProfile_xxxxxx }} 

【讨论】:

  • 我有相同的工作流程和部署槽,文件夹名称必须是 HttpTrigger1 吗?我在文件夹中有 init.py 和 function.json 文件
  • 我的函数应用中是否还有其他参数需要更改?我还刷新了我的函数应用中的发布配置文件,但没有成功。
  • 不,函数名是自定义的。我会用我的文件结构更新答案,你可以看看。部署前确保您的函数应用在本地计算机上成功运行。
  • 我已将我的 repo 与 vs 代码同步,并添加了所有丢失的文件。但它不起作用。部署中心没有错误。 (在我的工作流程中提供 Github 操作)。还有什么想法吗?我的门户上什么也没有出现。 :/ 如果你要检查的话,我的仓库有:github.com/Palme240/Azure-AWS-Google
  • 我还有一个问题:.vscode 对于 proxies.json 和 host.json 是强制性的?。
猜你喜欢
  • 1970-01-01
  • 2020-12-14
  • 1970-01-01
  • 2021-03-05
  • 2021-12-14
  • 2019-09-23
  • 1970-01-01
  • 1970-01-01
  • 2021-11-16
相关资源
最近更新 更多