适用于数据仓库的持续集成和部署Continuous integration and deployment for data warehousing

本简易教程概述如何将 SQL Server Data Tools (SSDT) 数据库项目集成到 Azure DevOps,并利用 Azure Pipelines 来设置持续集成和部署。This simple tutorial outlines how to integrate your SQL Server Data tools (SSDT) database project with Azure DevOps and leverage Azure Pipelines to set up continuous integration and deployment. 本教程是为数据仓库构建持续集成和部署管道的第二步。This tutorial is the second step in building your continuous integration and deployment pipeline for data warehousing.

准备阶段Before you begin

使用 Visual Studio 生成实现持续集成Continuous integration with Visual Studio build

  1. 导航到 Azure Pipelines 并创建新的生成管道。Navigate to Azure Pipelines and create a new build pipeline.

    新建管道New Pipeline

  2. 选择源代码存储库 (Azure Repos Git),然后选择 .NET Desktop 应用模板。Select your source code repository (Azure Repos Git) and select the .NET Desktop app template.

    管道设置Pipeline Setup

  3. 编辑 YAML 文件,以使用适当的代理池。Edit your YAML file to use the proper pool of your agent. YAML 文件应如下所示:Your YAML file should look something like this:

    YAMLYAML

现已创建一个简单的环境,在其中,只要签入到源代码管理存储库主分支,就会自动触发数据库项目的成功 Visual Studio 生成。At this point, you have a simple environment where any check-in to your source control repository master branch should automatically trigger a successful Visual Studio build of your database project. 通过在本地数据库项目中做出更改并将该项更改签入到主分支,来验证自动化是否能够自始至终正常运行。Validate the automation is working end to end by making a change in your local database project and checking in that change to your master branch.

使用 Azure SQL 数据仓库(或数据库)部署任务实现持续部署Continuous deployment with the Azure SQL Data Warehouse (or Database) deployment task

  1. 使用 Azure SQL 数据库部署任务添加一个新任务,并填写必填字段以连接到目标数据仓库。Add a new task using the Azure SQL Database deployment task and fill in the required fields to connect to your target data warehouse. 当此任务运行时,上一生成过程生成的 DACPAC 将部署到目标数据仓库。When this task runs, the DACPAC generated from the previous build process is deployed to the target data warehouse. 也可使用 Azure SQL 数据仓库部署任务You can also use the Azure SQL Data Warehouse deployment task.

    部署任务Deployment Task

  2. 如果使用自托管代理,请确保将环境变量设置为对 SQL 数据仓库使用正确的 SqlPackage.exe。If you are using a self-hosted agent, make sure you set your environment variable to use the correct SqlPackage.exe for SQL Data Warehouse. 路径应如下所示:The path should look something like this:

    环境变量Environment Variable

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150

    运行并验证管道。Run and validate your pipeline. 可以在本地进行更改,然后将更改签入到应生成自动生成和部署项目的源代码管理。You can make changes locally and check in changes to your source control that should generate an automatic build and deployment.

后续步骤Next steps