What are the challenges you face when working across database platforms? Take the survey
Options

Redgate SCA Devops build pipeline cannot overwrite the nuget package - build fails

We recently had to change out build pipeline from using LocalDB to a full SQL instance (using full text searching so need full DB to build).

Since we changed the pipeline configuration, we cannot get a second build to succeed without manually removing the output nupkg from the build agent.

We are using self-hosted agents, and I have tried using both v3 and v4 of the SCA build task.

V3 gives this error:

##[error]RedGate.Versioning.Automation.Shared.Errors.TerminatingException: The file already exists and can't be overwritten: 'E:\Agent_6\_work\203\s\PCISDatabase.1.0.nupkg'
at RedGate.Versioning.Automation.Compare.BuildArtifacts.BuildArtifactExporter.HandleOverwrite(Boolean overwrite, String filePath)
at RedGate.Versioning.Automation.Compare.BuildArtifacts.BuildArtifactExporter.ExportAsNuGetFromFolder(String sourceFolder, String outputDirectory, String id, String version, String packageDescription, Boolean overwrite)
at RedGate.Versioning.Automation.Compare.BuildArtifacts.BuildArtifactExporter.Export(String outputDirectory, IBuildArtifact buildArtifact, Boolean force, BuildArtifactOutputFormat outputFormat, Action checkForAbort)
at RedGate.Versioning.Automation.PowerShell.Commands.ExportDatabaseBuildArtifactCommandImpl.Process()
at RedGate.Versioning.Automation.PowerShell.DlmAutomationCommandImpl`1.ProcessRecord()
at RedGate.PowerShell.CommandBase`2.DelegateTo(Action doImplementation)

V4 give this error:
Export-DatabaseBuildArtifact, SQL Change Automation 4.6.23298.2367, Copyright © Red Gate Software Ltd 2014-2023
##[error]The file already exists and can't be overwritten: 'E:\Agent_6\_work\203\s\PCISDatabase.1.0.nupkg'
##[error]Exit code 1 returned from process: file name 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe', arguments '-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". ([scriptblock]::Create('if ([Console]::InputEncoding -is [Text.UTF8Encoding] -and [Console]::InputEncoding.GetPreamble().Length -ne 0) { [Console]::InputEncoding = New-Object Text.UTF8Encoding $false } if (!$PSHOME) { $null = Get-Item -LiteralPath ''variable:PSHOME'' } else { Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1'')) ; Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1'')) }')) 2>&1 | ForEach-Object { Write-Verbose $_.Exception.Message -Verbose } ; Import-Module -Name 'E:\Agent_6\_work\_tasks\RedgateSqlChangeAutomationBuild_7345fe1b-d099-46f0-a0d1-7292cd17feee\4.0.2012161408\ps_modules\VstsTaskSdk\VstsTaskSdk.psd1' -ArgumentList @{ NonInteractive = $true } -ErrorAction Stop ; $VerbosePreference = 'SilentlyContinue' ; $DebugPreference = 'SilentlyContinue' ; Invoke-VstsTaskScript -ScriptBlock ([scriptblock]::Create('. ''E:\Agent_6\_work\_tasks\RedgateSqlChangeAutomationBuild_7345fe1b-d099-46f0-a0d1-7292cd17feee\4.0.2012161408\SqlChangeAutomationBuild.ps1'''))"'.
Async Command Start: Upload Artifact
Tagged:

Answers

Sign In or Register to comment.