Python Azure Functions 和 Bitbucket Pipelines - 如何压缩需求?

标签 python azure azure-functions bitbucket bitbucket-pipelines

我一直在尝试了解如何使用 Bitbucket 管道将我的 Python 函数应用程序部署到 Azure。

我在网上读过一些答案,一旦我压缩了我的 python 应用程序,它看起来就很简单了。 使用这个答案可以轻松完成:Azure Function and BitBucket build pipelines

script:
  - pipe: microsoft/azure-functions-deploy:1.0.2
    variables:
      AZURE_APP_ID: $AZURE_APP_ID
      AZURE_PASSWORD: $AZURE_PASSWORD
      AZURE_TENANT_ID: $AZURE_TENANT_ID
      FUNCTION_APP_NAME: '<string>'
      ZIP_FILE: '<string>'

但是,我一生都无法找到 Azure Functions 期望 zip 文件采用的格式。

需求去哪里了?更好的是 - 在创建备受追捧的 ZIP_FILE 的管道规范之前,有哪些管道规范?

谢谢!

最佳答案

我尝试了这个解决方案并且也为我工作,但是存在一个弃用问题。管道 microsoft/azure-functions-deploy 正在使用 azure cli 的已弃用镜像:microsoft/azure-cli ,您可以阅读此here 。 所以你可以使用这个pipe的atlassian版本但对于 python 来说,它对我不起作用,因为在命令中:

az functionapp 部署源配置-zip...

没有指定 --build-remote。

所以我的解决方案不是使用管道,而是使用 azure-cli 命令编写步骤:


- step:
    name: Deploy on Azure
    image: mcr.microsoft.com/azure-cli:latest
    script:
    - az login --service-principal --username ${AZURE_APP_ID} --password ${AZURE_PASSOWRD} --tenant ${AZURE_TENANT_ID}
    - az functionapp deployment source config-zip -g ${RESOURCE_GROUP_NAME} -n 'functioAppName' --src 'function.zip' --build-remote

这是一个适用于我的情况的步骤,另一个解决方案可以编写一个使用 this 的步骤。

关于Python Azure Functions 和 Bitbucket Pipelines - 如何压缩需求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66161947/

相关文章:

Azure 数据库用户和权限报告

python - 使用azure函数标识访问存储容器

azure - 在 Azure 移动服务中自定义创建架构

azure - 通过 REST API 将 secret 变量传递到 Azure DevOps 发布管道时出错

node.js - 我在哪里可以看到本地主机上的控制台日志以及该功能何时部署?

azure - 插入 Azure 表存储中的新项目无法立即可用

python - 在Windows上将代理转发与paramiko一起使用

python - 任何 Python OLAP/MDX ORM 引擎?

python - Plotnine 中的错误栏

python - 注销无法正常工作 Django 1.9