如何使用 DevOps 从同一项目中发布多个 Azure Functions

问题描述 投票:0回答:1

我正在尝试协助一个团队将许多遗留项目的部署策略转变为使用 DevOps 发布管道。 API 不是问题,因为我很了解该领域,但我正在努力处理 C# Azure Functions 项目。

该项目包含 3 个独立的计时器触发函数,这些函数之前已通过手动 webdeploy 部署到 Azure 中的 3 个不同的函数应用程序。

我想要弄清楚的是如何设置我假设的 3 个管道任务,这些任务需要从同一个工件发布到 3 个不同的函数应用程序,并为每个任务选择标有 FunctionNameAttribute 的正确类一个。

我希望我只是错过了一些明显的东西,但任何帮助都会非常受欢迎

azure azure-devops azure-functions azure-pipelines-release-pipeline
1个回答
-1
投票

我使用 Artifact 构建了一个 Azure Function,并同时创建了具有 2 个 Function 应用程序部署的发布管道,并且成功了,请参阅以下内容:-

通过 参考我的 SO 线程答案此处,使用 Azure DevOps Yaml 管道创建构建工件。

我的 Azure 存储库及其功能代码:-

enter image description here

如果您的函数代码中有多个触发器,您可以使用此处给出的相同步骤在单个函数应用程序中部署它们,该应用程序将包含多个触发器或多个 3 函数应用程序。

现在使用从上面生成的构建工件所以线程答案或直接在发布管道中包含源代码的Azure DevOps存储库,如下所示:-

enter image description here

Azure 存储库:-

enter image description here

并配置Azure发布管道任务:-

为您的 3 个功能应用程序创建 3 个不同的任务,将您的功能一起部署在 3 个应用程序中,如下所示:-

在第一个 Azure Function App 部署任务中选择 functionapp85:-

enter image description here

在第二个 Azure Function App 部署任务中选择了 valleuyfunc542:-

enter image description here

创建了发布管道,并将函数部署在两个函数应用程序中,如下所示:-

输出:-

功能应用程序1:-(functionapp85)

enter image description here

函数App2:-(valleyfunc542)

enter image description here

输出:-

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.