From d2aea6782b795a0720f77649338f65276e4822a7 Mon Sep 17 00:00:00 2001 From: Colin Dembovsky Date: Thu, 29 Sep 2016 14:27:18 -0700 Subject: [PATCH 1/2] ADding extra args to dacpac compare --- Tasks/DacPacReport/DacPacReport.ps1 | 12 +++++++----- Tasks/DacPacReport/TestScript.ps1 | 1 + Tasks/DacPacReport/task.json | 14 +++++++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Tasks/DacPacReport/DacPacReport.ps1 b/Tasks/DacPacReport/DacPacReport.ps1 index ae62a9e..6381578 100644 --- a/Tasks/DacPacReport/DacPacReport.ps1 +++ b/Tasks/DacPacReport/DacPacReport.ps1 @@ -9,6 +9,7 @@ Trace-VstsEnteringInvocation $MyInvocation $dropName = Get-VstsInput -Name "dropName" -Require $targetDacpacPath = Get-VstsInput -Name "targetDacpacPath" -Require $dacpacName = Get-VstsInput -Name "dacpacName" -Require +$extraArgs = GEt-VstsInput -Name "extraArgs" function Get-LatestBuild { param( @@ -122,25 +123,26 @@ function Create-Report { param( [string]$SlPackagePath, [string]$SourceDacpac, - [string]$TargetDacpac + [string]$TargetDacpac, + [string]$ExtraArgs ) $SourceDacpac = Resolve-Path -Path $SourceDacpac $TargetDacpac = Resolve-Path -Path $TargetDacpac Write-Verbose "Generating report: source = $SourceDacpac, target = $TargetDacpac" - $commandArgs = "/a:{0} /sf:`"$SourceDacpac`" /tf:`"$TargetDacpac`" /tdn:Test /op:`"{1}`"" + $commandArgs = "/a:{0} /sf:`"$SourceDacpac`" /tf:`"$TargetDacpac`" /tdn:Test /op:`"{1}`" {2}" if (-not (Test-Path -Path "./SchemaCompare")) { mkdir "SchemaCompare" } - $reportArgs = $commandArgs -f "DeployReport", "./SchemaCompare/SchemaCompare.xml" + $reportArgs = $commandArgs -f "DeployReport", "./SchemaCompare/SchemaCompare.xml", $ExtraArgs $reportCommand = "`"$SqlPackagePath`" $reportArgs" $reportCommand Run-Command -command $reportCommand - $scriptArgs = $commandArgs -f "Script", "./SchemaCompare/ChangeScript.sql" + $scriptArgs = $commandArgs -f "Script", "./SchemaCompare/ChangeScript.sql", $ExtraArgs $scriptCommand = "`"$SqlPackagePath`" $scriptArgs" $scriptCommand Run-Command -command $scriptCommand @@ -209,7 +211,7 @@ if ($compareBuild -ne $null) { if ($targetDacpac -ne $null) { Write-Verbose -Verbose "Found target dacpac $($targetDacpac)" - Create-Report -SqlPackagePath $SqlPackagePath -SourceDacpac $sourceDacpac -TargetDacpac $targetDacpac + Create-Report -SqlPackagePath $SqlPackagePath -SourceDacpac $sourceDacpac -TargetDacpac $targetDacpac -ExtraArgs $extraArgs $reportPath = ".\SchemaCompare\SchemaCompare.xml" Convert-Report diff --git a/Tasks/DacPacReport/TestScript.ps1 b/Tasks/DacPacReport/TestScript.ps1 index f7199f4..1a180ce 100644 --- a/Tasks/DacPacReport/TestScript.ps1 +++ b/Tasks/DacPacReport/TestScript.ps1 @@ -26,6 +26,7 @@ $env:SYSTEM_DEFINITIONID=9 # FabFiberExpress-DACPAC $env:INPUT_DROPNAME="drop" $env:INPUT_DACPACNAME="fabFiber.Schema" $env:INPUT_TARGETDACPACPATH="C:\mData\ws\col\dac" +$env:INPUT_EXTRAARGS="/v:Hello=Bye" # invoke the script Invoke-VstsTaskScript -ScriptBlock { . .\DacPacReport.ps1 } -Verbose \ No newline at end of file diff --git a/Tasks/DacPacReport/task.json b/Tasks/DacPacReport/task.json index bc7513c..72f1776 100644 --- a/Tasks/DacPacReport/task.json +++ b/Tasks/DacPacReport/task.json @@ -14,9 +14,9 @@ "sqlpackage" ], "version": { - "Major": "0", - "Minor": "0", - "Patch": "2" + "Major": "1", + "Minor": "1", + "Patch": "31" }, "minimumAgentVersion": "1.103.0", "instanceNameFormat": "DacPac Schema Compare $(dacpacName).dacpac", @@ -44,6 +44,14 @@ "defaultValue": "", "required": true, "helpMarkDown": "Path to find the target dacpac (typically the artifact staging path where the dacpac will be uploaded from)." + }, + { + "name": "extraArgs", + "type": "string", + "label": "Extra SQLPackage args", + "defaultValue": "", + "required": false, + "helpMarkDown": "Extra args to use for running the SQLPackage.exe schema compare command." } ], "execution": { From 5e4d0af9e1b82ed5e700a122de125be0b99e5e01 Mon Sep 17 00:00:00 2001 From: Colin Dembovsky Date: Mon, 3 Oct 2016 11:36:43 -0700 Subject: [PATCH 2/2] Adding group --- Tasks/DacPacReport/task.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tasks/DacPacReport/task.json b/Tasks/DacPacReport/task.json index 72f1776..721b113 100644 --- a/Tasks/DacPacReport/task.json +++ b/Tasks/DacPacReport/task.json @@ -20,6 +20,13 @@ }, "minimumAgentVersion": "1.103.0", "instanceNameFormat": "DacPac Schema Compare $(dacpacName).dacpac", + "groups": [ + { + "name": "advanced", + "displayName": "Advanced", + "isExpanded": false + } + ], "inputs": [ { "name": "dropName", @@ -51,7 +58,8 @@ "label": "Extra SQLPackage args", "defaultValue": "", "required": false, - "helpMarkDown": "Extra args to use for running the SQLPackage.exe schema compare command." + "helpMarkDown": "Extra args to use for running the SQLPackage.exe schema compare command.", + "groupName": "advanced" } ], "execution": {