![](/img/trans.png)
[英]Azure DevOps project - Service Fabric deploy - sample failing
[英]Deploy Service Fabric service with different names using Azure DevOps
我有一个带有一项服务 (MyService) 的 Service Fabric 应用程序。 现在,我正在使用构建管道构建应用程序,然后使用发布管道将工件部署到托管在 Azure 上的集群中。
我想要的是在同一个集群上创建多个具有不同名称的服务实例(如 DEV_MyService、QA_MyService)。 理想的选择是在发布管道中使用一个工件和多个阶段。
有没有办法通过 Azure DevOps 和发布管道实现这一目标?
我试图参数化服务名称,但它似乎不起作用。
您可以通过多种方式执行此操作:
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
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
如果您想使这个参数化,您可以使用替换文件内占位符的任务。
脚本文件(例如 #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 管道变量:
为每个阶段定义不同的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.