简体   繁体   English

Azure Devops:YAML 管道,用于为不同客户端独立部署 Single Tenant.Net MVC App

[英]Azure Devops : YAML Pipeline for independent Deployment of Single Tenant .Net MVC App for different clients

I need suggestions for creating a YAML pipeline for the independent deployment of the Single Tenant.Net MVC App for different clients.我需要有关为不同客户端独立部署 Single Tenant.Net MVC 应用程序创建 YAML 管道的建议。

  • Application Type: .Net MVC Web API应用类型:.Net MVC Web API
  • Web Server: IIS 10 Web 服务器:IIS 10
  • Database: MS SQL Server数据库:MS SQL 服务器
  • Environment: Private Data Center环境:私有数据中心
  • Number of Clients/tenant: 150+客户/租户数量:150+
  • Deployment: For each client/tenant, a separate IIS Web App is created.部署:为每个客户端/租户创建一个单独的 IIS Web 应用程序。 Also, a separate database is created for each client.此外,还会为每个客户端创建一个单独的数据库。
  • Expected Deployment: Manual mode (Not considering CD because CI and test suite are not available yet).预期部署:手动模式(不考虑 CD,因为 CI 和测试套件尚不可用)。

If you can guide me about the following points.如果你能指导我以下几点。

  • How pipeline should be created in such a way that I can use different configuration parameters per client/tenant?应该如何创建管道,以便我可以为每个客户端/租户使用不同的配置参数? (eg Database name and connection string) But at the same time, the common script for the deployment of generated release? (例如数据库名称和连接字符串) 但同时,为部署生成发布的通用脚本?
  • Should I create a single pipeline or there should be multiple?我应该创建一个管道还是应该有多个?
  • How I should use release, stage, jobs effectively for such a scenario?在这种情况下,我应该如何有效地使用发布、阶段、工作?
  • If I get some good articles for manual independent deployment for each client, I would like to study.如果我得到一些为每个客户端手动独立部署的好文章,我想学习。

Generally, if you want to deploy to different environments, you can set up a stage for each environment in a pipeline.一般来说,如果你想部署到不同的环境,你可以为管道中的每个环境设置一个阶段。 However, considering that you have 150+ different configurations, it is so torturous to set up 150+ stages in the pipeline.然而,考虑到你有 150+ 种不同的配置,在流水线中设置 150+ 个阶段实在是太折磨人了。

If all the deployments have the same deployment steps (same scripts, same input parameters), but different values of the input parameters, you can try using Multi-job configuration (the Matrix ) in the pipeline.如果所有部署都有相同的部署步骤(相同的脚本,相同的输入参数),但输入参数的值不同,您可以尝试在管道中使用多作业配置矩阵)。

With this way, you do not need to set up a stage or a job for each configurations, you just need to set up a stage or a job with all the common deployment steps.通过这种方式,您无需为每个配置设置阶段或作业,您只需设置具有所有常见部署步骤的阶段或作业。 But you need to enumerate all the configurations (150+) you require.但是你需要列举你需要的所有配置(150+)。 When running the pipeline, it will generate 150+ matrix jobs with the same deployment steps but different values of the input parameters.运行管道时,它将生成 150 多个矩阵作业,部署步骤相同,但输入参数的值不同。

[UPDATE] [更新]

Just curious, in this case of multi-job configuration, all the 150+ installations will be triggered in one go, right?只是好奇,在这种多作业配置的情况下,所有 150 多个安装都将在一个 go 中触发,对吧?

After the pipeline run is triggered, all the 105+ matrix jobs will be triggered and be in queue.触发流水线运行后,将触发所有 105+ 个矩阵作业并排队。 However, normally not all the 150+ jobs will be started up to run in parallel at the same time.但是,通常不会同时启动所有 150 多个作业以并行运行。 It depends on the maxParallel you set and how many available agents can be assigned to the run.这取决于您设置的maxParallel以及可以为运行分配多少可用代理。

I can't select the way, where deployment is started for let's say 5 of the client only.我不能以 select 的方式开始部署,假设只有 5 个客户端。

If you want that the deployment can be executed firstly for some clients and then for other clients, you can try using stages.如果您希望可以先为某些客户端执行部署,然后再为其他客户端执行部署,您可以尝试使用阶段。

For example, in stage_1 , execute the deployment job (multi-job configuration) for the first 5 clients.例如,在stage_1中,为前 5 个客户端执行部署作业(多作业配置)。 After stage_1 , start up stage_2 for another several clients, then stage_3 for other clients, etc..stage_1之后,为另外几个客户端启动stage_2 ,然后为其他客户端启动stage_3 ,等等。

You can use the dependsOn key to set the execution order of the stages, and use condition key to set a stage only runs when the specified condition is met.您可以使用dependsOn键设置阶段的执行顺序,使用condition键设置阶段仅在满足指定条件时运行。

To view more details, you can see " Add stages, dependencies, & conditions ".要查看更多详细信息,您可以查看“ 添加阶段、依赖项和条件”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM