Hi,
I am unpacking and repacking my ccpkg file so I can do substitutions on the config files. This process is working for the most part except now I want to add NewRelic to my worker/website. This requires 2 msi’s and a cmd file be added to the role.
My predeploy unpacks the ccpkg then tries ot unpack each role but that isn’t working anymore… apparently because there are msi’s in the archive.
Error 11:32:15
cannot access the file 'D:\Octopus Tentacle\Applications\UAT\Playup.Api\0.0.161
Error 11:32:15
-fb-3d55512\worker\approot\NewRelicAgent_x64_3.9.146.0.msi' because it is
Error 11:32:15
being used by another process."
Error 11:32:15
At D:\Octopus
Error 11:32:15
Tentacle\Applications\UAT\Playup.Api\0.0.161-fb-3d55512\predeploy.ps1:19 char:2
Error 11:32:15
+ [System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile,
Error 11:32:15
$destination)```
So this error is kind of ridiculous because prior to extracting it creates the folder (so there are NO existing files), it then unzips the archive and gets this crazy error message about a process already using a file it has just extracted... its almost like its unzipping the twice, simultaneously. But theres nothing in the output that would indicate that is happening.
My predeploy.ps1 is
load the assembly required
function Unzip($zipFile, $destination)
{
#Delete destination folder if it exists
If (Test-Path $destination){
Write-Host "Path Exists… Deleting $destination"
Remove-Item $destination -Recurse
}
else{
Write-Host “Path Does Not Exist… $destination”
}
#Create the destination folder
New-Item -ItemType directory -Force -Path $destination
#Unzip
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $destination)
}
function Get-ScriptDirectory ()
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value;
if($Invocation.PSScriptRoot)
{
$Invocation.PSScriptRoot;
}
Elseif($Invocation.MyCommand.Path)
{
Split-Path $Invocation.MyCommand.Path
}
else
{
$Invocation.InvocationName.Substring(0,$Invocation.InvocationName.LastIndexOf(""));
}
}
$path = Get-ScriptDirectory
#Unzips the cspkg file
Unzip “$path\PlayUp.Api.CloudService.ccproj.cspkg” “$path\azurePackage”
#Unzips the .cssx file that was contained in the cspkg file
Unzip (Get-Item (join-path -path “$path\azurePackage” -childPath “PlayUp.Api.Web_*.cssx”)) “$path\website”
#Unzip “$path\azurePackage\PlayUp.Api.Web..cssx" "$path\website"
Unzip (Get-Item (join-path -path “$path\azurePackage” -childPath "PlayUp.Api.Media_.cssx”)) “$path\worker”
So this makes no sense to me. I can run the predeploy on my local machine without error but it always fails on Octopus Deploy.
I sometimes also have this process fail (before I added newrelic) with the same error different file (RemoteForwarder.msi i think it is). That msi is added automatically for the remote desktop support.