Skip to content

Commit

Permalink
Added a custom deployment executable location
Browse files Browse the repository at this point in the history
#3 To support agents that have a management studio installation on a non standard location there's an option to customize its location.
  • Loading branch information
avdbrink committed Mar 27, 2019
1 parent a9bc350 commit 40b50a4
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 19 deletions.
2 changes: 1 addition & 1 deletion BuildSSASTask/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 4
"Patch": 6
},
"demands": [ ],
"minimumAgentVersion": "1.95.0",
Expand Down
46 changes: 35 additions & 11 deletions DeploySSASTask/DeploySSASTask.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ try {
$OptimizationSettingsDeployment = Get-VstsInput -Name OptimizationSettingsDeployment -Require
$WriteBackTableCreation = Get-VstsInput -Name WriteBackTableCreation -Require
$mgmtVersion = Get-VstsInput -Name mgmtVersion -Require
$customMGMTVersion = Get-VstsInput -Name customMGMTVersion
$ImpersonationInformation = Get-VstsInput -Name ImpersonationInformation -Require
$ServiceAccountName = Get-VstsInput -Name ServiceAccountName
$ServiceAccountPassword = Get-VstsInput -Name ServiceAccountPassword
Expand All @@ -76,21 +77,44 @@ try {
if (Test-Path("C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Microsoft.AnalysisServices.Deployment.exe")) { $compiler = "C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Microsoft.AnalysisServices.Deployment.exe"}
if (Test-Path("C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Microsoft.AnalysisServices.Deployment.exe")) { $compiler = "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Microsoft.AnalysisServices.Deployment.exe"}
}
"custom" {
if (Test-Path($customMGMTVersion)) {
if ($customMGMTVersion.EndsWith(".exe","CurrentCultureIgnoreCase")) {
$compiler = $customMGMTVersion
} else {
if (!$customMGMTVersion.EndsWith('\')) {
$customMGMTVersion = $customMGMTVersion + '\'
}
$compiler = $customMGMTVersion + "Microsoft.AnalysisServices.Deployment.exe"
}
}
}
}
if (!(Test-Path($compiler))) {
Write-Host "##vso[task.logissue type=error;]Cannot access compiler. Selected version: $mgmtVersion"
} else {
Write-Host ("Deployment executable version: $compiler")
try {
if (!(Test-Path($compiler))) {
if ($mgmtVersion -eq "custom") {
Write-Host "##vso[task.logissue type=error;] Cannot access compiler. Selected version: $mgmtVersion : $customMGMTVersion"
} else {
Write-Host "##vso[task.logissue type=error;] Cannot access compiler. Selected version: $mgmtVersion"
}
Exit 1
} else {
Write-Host (Get-VstsLocString -key DeploymentExecutable0 -ArgumentList $compiler)
}
}
catch {
Write-Error (Get-VstsLocString -key CompilerNotFound)
Exit 1
}

if (Get-Module -ListAvailable -Name SqlServer) {
if (-not (Get-Module -Name "SqlServer")) {
# if module is not loaded
Import-Module "SqlServer" -DisableNameChecking
}
} else {
Write-Host "##vso[task.logissue type=error;]SqlServer Powershell module not installed"
if (Get-Module -ListAvailable -Name SqlServer) {
if (-not (Get-Module -Name "SqlServer")) {
# if module is not loaded
Import-Module "SqlServer" -DisableNameChecking
}
} else {
Write-Host "##vso[task.logissue type=error;]SqlServer Powershell module not installed"
}

if([System.Convert]::ToBoolean($ConfigurationSettingsDeployment)) {
$ConfigurationSettingsDeployment = "Retain"
Expand Down
24 changes: 18 additions & 6 deletions DeploySSASTask/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 4
"Patch": 6
},
"demands": [],
"minimumAgentVersion": "1.95.0",
Expand Down Expand Up @@ -175,11 +175,21 @@
"2012": "2012",
"2014": "2014",
"2016": "2016",
"2017": "2017"
"2017": "2017",
"custom": "Custom deployment wizard location"
},
"helpMarkDown": "Select Management Studio version on TFS Agent machines. Appropriate version of SQL Management Studio must be installed on agent! ",
"groupName": "options"
},
"helpMarkDown": "Select Management Studio version on TFS Agent machines. Appropriate version of SQL Management Studio must be installed on agent! ",
"groupName": "options"
}
{
"name": "customMGMTVersion",
"type": "string",
"label": "Custom Analysis Services Deployment executable path",
"defaultValue": "C:\\Program Files (x86)\\Microsoft SQL Server\\140\\Tools\\Binn\\ManagementStudio\\Microsoft.AnalysisServices.Deployment.exe",
"visibleRule": "mgmtVersion=custom",
"required": true,
"groupName": "options"
}
],
"instanceNameFormat": "Deploy SSAS $(DatabaseName)",
"execution": {
Expand All @@ -200,6 +210,8 @@
"ErrorDuringDeployment": "Error(s) occurred while deploying database! See above error codes for details",
"ErrorDuringProcessing": "Error(s) occurred while processing database! See above error codes for details",
"InternalError0": "Task_InternalError {0}",
"EndingTask": "Ending DeploySSASTask"
"EndingTask": "Ending DeploySSASTask",
"CompilerNotFound": "No compiler could be found! Do you have SQL Server Management Studio installed on your agent?",
"DeploymentExecutable0": "Deployment executable version: {0}"
}
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
> while defining your release. You should enter this once your database has been deployed for the first time. You can specify to not overwrite these settings
> for a next release.
> NOTE: the deployment uses the Management Studio executable Microsoft.AnalysisServices.Deployment.exe Make sure that this is installed on your build agent!
> Currently the Microsoft Hosted Agents DO NOT have Management Studio installed, so deployement from these hosts is unsupported. Setup a self hosted agent with SQL
> Server Managenment Studio installed on it to use the deployment component
> SECURITY WARNING: if you choose to use Windows username and password as impersonation mode the password you supply will be written in plaintext on disk at the deploy agent!
## Contribute
Expand All @@ -39,6 +41,7 @@
> * Added documentation
> * Upated to use fit in Azure piplines category
> * Added ImpersonationInformation option None, to skip impersonation settings altogether
> * Custom Management Studio location (Microsoft.AnalysisServices.Deployment.exe) for deployment component
## TODO:
> * a Lot!
2 changes: 1 addition & 1 deletion vss-extension.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifestVersion": 1,
"id": "VSTS-SSAS",
"version": "1.0.4",
"version": "1.0.6",
"name": "SSAS Build & Deploy",
"scopes": [ "vso.work", "vso.work_write" ],
"description": "Extension with Continuous Integration support for SSAS",
Expand Down

0 comments on commit 40b50a4

Please sign in to comment.