colindembovsky / cols-agent-tasks

Colin's ALM Corner Custom Build Tasks
MIT License
83 stars 67 forks source link

Use Dacpac compare in release pipelines #137

Closed arajbanshi closed 4 years ago

arajbanshi commented 4 years ago

Hi Colin,

Is it possible to use the dacpac compare extension in release pipelines? I added the task and I'm seeing the following warning. Please advise.

2019-11-19T19:21:26.7189611Z ##[debug]Leaving Invoke-VstsTool. 2019-11-19T19:21:26.8776667Z ##[debug]Dac Framework installed with Visual Studio found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\SqlPackage.exe on machine fv-az639 2019-11-19T19:21:26.9441999Z ##[debug]Using sqlPackage path C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe 2019-11-19T19:21:26.9451046Z Attempting to get System.AccessToken 2019-11-19T19:21:26.9523627Z ##[debug]SYSTEM_ACCESSTOKEN: '*' 2019-11-19T19:21:26.9531934Z Successfully obtained System.AccessToken 2019-11-19T19:21:26.9684327Z ##[debug]GET https://dev.azure.com/kpmgtaxtech/0d59d88e-848e-4fc8-9df1-8ddac8db0c0c/_apis/build/builds?definitions=1&resultFilter=succeeded&$top=1&api-version=2.0 with 0-byte payload 2019-11-19T19:21:27.0447664Z ##[debug]received 22-byte response of content type application/json; charset=utf-8; api-version=2.0 _2019-11-19T19:21:27.1091620Z ##[warning]There appears to be no successful build to compare.**_ 2019-11-19T19:21:27.1100024Z ##[debug]Processed: ##vso[task.logissue type=warning]There appears to be no successful build to compare. 2019-11-19T19:21:27.1100237Z ##[debug]Leaving D:\a_tasks\DacPacReport_1ebf2967-63b3-4372-89f7-6799108a22f0\1.2.114\DacPacReport.ps1.

faiqg commented 4 years ago

In Release pipeline, before deployment to the target database, it will be nice to see what changes were deployed. You could argue that having the report in build is good enough, but not all builds get deployed all the way to production. If the task could publish Schema Change Summary and Change Script by comparing the to-be deployed dacpac with the target database schema, it would provide much needed clarity on what changes are going into each environment. This task could then also be used as a pre-deployment approval step in a pipeline where only after reviewing the SQL, the database/application/operations administrator/owner would be able to approve the deployment.

colindembovsky commented 4 years ago

Hi @Faiqg and @arajbanshi This isn't the intent of this task. This task is trying to give an idea of model changes between source versions of the model. What you're asking for is a comparison from the built model and the target database. To do this, you can simply add a SQLPackage.exe invocation to your pipeline, as described in this doc.