【问题标题】:Deploy Service Fabric service with different names using Azure DevOps使用 Azure DevOps 部署具有不同名称的 Service Fabric 服务
【发布时间】:2020-09-28 13:11:41
【问题描述】:

我有一个带有一项服务 (MyService) 的 Service Fabric 应用程序。 现在,我正在使用构建管道构建应用程序,然后使用发布管道将工件部署到托管在 Azure 上的集群。

我想要的是在同一个集群上创建多个具有不同名称的服务实例(如 DEV_MyService、QA_MyService)。理想的选择是在发布管道中使用一个工件和多个阶段。

有没有办法通过 Azure DevOps 和发布管道实现这一目标?

我试图参数化服务名称,但它似乎不起作用。

【问题讨论】:

    标签: azure azure-devops azure-service-fabric


    【解决方案1】:

    您可以通过多种方式做到这一点:

    1. 在现有应用程序中创建一个新的service
    sfctl application create --app-name fabric:/TestApp --app-type TestAppType --app-version 1.0
    sfctl service create --app-id TestApp --name fabric:/TestApp/TestSvc1 --service-type TestServiceType --stateless --instance-count 1 --singleton-scheme
    sfctl service create --app-id TestApp --name fabric:/TestApp/TestSvc2 --service-type TestServiceType --stateless --instance-count 1 --singleton-scheme
    
    1. 在多个应用程序(一种应用程序类型)中创建服务:
    sfctl application create --app-name fabric:/TestApp1 --app-type TestAppType --app-version 1.0
    sfctl application create --app-name fabric:/TestApp2 --app-type TestAppType --app-version 1.0
    sfctl service create --app-id TestApp1 --name fabric:/TestApp/TestSvc --service-type TestServiceType --stateless --instance-count 1 --singleton-scheme
    sfctl service create --app-id TestApp2 --name fabric:/TestApp/TestSvc --service-type TestServiceType --stateless --instance-count 1 --singleton-scheme
    

    如果你想让这个参数化,你可以在文件中使用task that replaces placeholders

    脚本文件(例如 #1)如下所示:

    sfctl application create --app-name fabric:/__appName__ --app-type TestAppType --app-version 1.0
    sfctl service create --app-id __appName__ --name fabric:/__appName__/__serviceName__ --service-type TestServiceType --stateless --instance-count 1 --singleton-scheme
    

    您需要指定两个 Azure DevOps 管道变量:

    1. 应用名称
    2. 服务名称

    为每个阶段定义不同的值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-15
      • 2019-03-28
      • 2019-02-14
      • 2016-12-07
      • 2018-03-13
      • 2017-03-29
      • 2016-08-27
      • 2018-04-27
      相关资源
      最近更新 更多