Skip to content

Commit

Permalink
Moved processing out of the deployment
Browse files Browse the repository at this point in the history
Processing is done after deployment because of the invalid JSON that is created by the deployment wizard
  • Loading branch information
avdbrink committed Mar 13, 2019
1 parent 2e82ad4 commit f9d3033
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 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": 1
"Patch": 2
},
"demands": [ ],
"minimumAgentVersion": "1.95.0",
Expand Down
33 changes: 32 additions & 1 deletion DeploySSASTask/DeploySSASTask.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ try {
$xml = [xml](Get-Content $DeploymentOptions)
$xml.Data.Course.Subject
$node = $xml.DeploymentOptions
$node.ProcessingOption = $ProcessingOption
$node.ProcessingOption = "DoNotProcess" # Never use anything else or it will break. Porcessing is handled after deployment
$node.TransactionalDeployment = $TransactionalDeployment
$node.PartitionDeployment = $PartitionDeployment
$node.RoleDeployment = $RoleDeployment
Expand Down Expand Up @@ -254,6 +254,37 @@ try {
$xml.return.root.Messages.Error | % { Write-Host ($_.ErrorCode + ": " + $_.Description) }
Write-Error (Get-VstsLocString -key ErrorDuringDeployment)
}

if ($ProcessingOption -ne "DoNotProcess") {
Write-Host (Get-VstsLocString -Key ProcessingDatabase0 -ArgumentList $ProcessingOption)

# Determine the desired processing option and translate to the correct command for the json we're going to generate
if ($ProcessingOption -eq "Full") {
$type = "full"
} else {
$type = "automatic"
}
# Create a JSON file containing the processing command
$fileContent = @"
{
"refresh": {
"type": "$type",
"objects": [
{
"database": "$DatabaseName"
}
]
}
}
"@
Set-Content -Path $path\processing.json -Value ($fileContent)
Invoke-ASCmd -InputFile $path\processing.json -Server $ServerName | Out-File $path\ProcessingResult.xml
$xml = [xml](Get-Content $path\ProcessingResult.xml)
if ($xml.return.root.Messages.Error) {
$xml.return.root.Messages.Error | % { Write-Host ($_.ErrorCode + ": " + $_.Description) }
Write-Error (Get-VstsLocString -key ErrorDuringProcessing)
}
}

} catch {
Write-Error (Get-VstsLocString -Key InternalError0 -ArgumentList $_.Exception.Message)
Expand Down
6 changes: 4 additions & 2 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": 1
"Patch": 2
},
"demands": [],
"minimumAgentVersion": "1.95.0",
Expand Down Expand Up @@ -193,9 +193,11 @@
"AsDBFile0AccessDenied": "Cannot access asdatabase file path: {0}",
"AsDBFile0": "Asdatabase file path: {0}",
"CreatingXmlFromAsDatabase": "Creating .xmla file from .asdatabase...",
"DeployingDatabase0": "Deploying {0} database ...",
"DeployingDatabase0": "Deploying database {0} ...",
"ProcessingDatabase0": "Processing the database with processing option {0} ...",
"Database0DeploySuccess": "{0} database has been deployed successfully",
"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"
}
Expand Down
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.1",
"version": "1.0.2",
"name": "SSAS Build & Deploy",
"scopes": [ "vso.work", "vso.work_write" ],
"description": "Extension with Continuous Integration support for SSAS",
Expand Down

0 comments on commit f9d3033

Please sign in to comment.