Unfortunately, I’d say that the author of the step template (and code reviewer, aka me) did not take offline drop targets in to account when it was built.
I’m working on a fix to the step template that will look for Calamari in the current working directory if the default path ($OctopusParameters['env:TentacleHome'] + "\Calamari") does not exist.
My apologies for the inconvenience caused by this issue.
Just letting you know that the step template has been updated on the community library (should be available in your Octopus instance once the community library sync happens, or you can run it manually to get access to it immediately).
However, overnight all our releases to machines using Listening tentacles failed with the following error.
Did I need to change anything for this update to work?
PowerShell version...
August 8th 2018 04:19:08Info
Name Value
August 8th 2018 04:19:08Info
---- -----
August 8th 2018 04:19:08Info
PSVersion 5.1.14409.1012
August 8th 2018 04:19:08Info
PSEdition Desktop
August 8th 2018 04:19:08Info
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
August 8th 2018 04:19:08Info
BuildVersion 10.0.14409.1012
August 8th 2018 04:19:08Info
CLRVersion 4.0.30319.42000
August 8th 2018 04:19:08Info
WSManStackVersion 3.0
August 8th 2018 04:19:08Info
PSRemotingProtocolVersion 2.3
August 8th 2018 04:19:08Info
SerializationVersion 1.1.0.1
August 8th 2018 04:19:08Info
Path = c:\inetpub\wwwroot\wss\VirtualDirectories\80
August 8th 2018 04:19:08Info
Getting target files...
August 8th 2018 04:19:08Info
Found 1 file(s)
August 8th 2018 04:19:08Info
Will use Octostache.dll (TentacleVersion 3.21.0)
August 8th 2018 04:19:08Info
\
August 8th 2018 04:19:08Info
Looking for Octostache.dll...
August 8th 2018 04:19:08Info
Loading from C:\Octopus\Calamari\\Octostache.dll
August 8th 2018 04:19:08Error
Add-Type : Cannot bind parameter 'Path' to the target. Exception setting "Path": "Cannot find path
August 8th 2018 04:19:09Error
'C:\Octopus\Calamari\Octostache.dll' because it does not exist."
August 8th 2018 04:19:09Error
At C:\Octopus\Work\20180807181905-21778-5474\Script.ps1:86 char:17
August 8th 2018 04:19:09Error
+ ... dd-Type -Path "$CalamariPath\$LatestInstalledCalamari\Octostache.dll"
August 8th 2018 04:19:09Error
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
August 8th 2018 04:19:09Error
+ CategoryInfo : WriteError: (:) [Add-Type], ParentContainsErrorRecordException
August 8th 2018 04:19:09Error
+ FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.AddTypeCommand
August 8th 2018 04:19:09Error
August 8th 2018 04:19:09Fatal
The remote script failed with exit code 1
I’ve fixed up the step template and it’s going through the motions of being pushed to the library site, update should be available in the next half an hour.
Again, my sincere apologies for the inconvenience caused by this bug.
My apologies, I thought I had pushed the last changes, but turns out I hadn’t. I’ve pushed them now and will let you know once they’re up on the library site.
My sincere apologies for the delay in getting this fixed.
I got latest step and unfortunately offline drop is still failing with the following error and I can’t find a work around this time.
Our only option with this deployment target is offline so I’m temp disabling variable replacement step and am on client site today to manually merge config.
If you need any further info just let me know and I’ll get it to you ASAP.
Getting target files...
Found 1 file(s)
Will use Octostache.dll (TentacleVersion )
Checking for Calamari install in \Calamari
\Calamari does not exist, falling back to working folder
Looking for Calamari install in C:\temp\Offline Package Drop\HCF\Dev Internal\e5Foundation\2018.3.1786\Calamari
Finding latest Calamari install in C:\temp\Offline Package Drop\HCF\Dev Internal\e5Foundation\2018.3.1786\Calamari
% : Cannot convert value "de" to type "System.Version". Error: "Version string portion was too short or too long."
At C:\temp\Offline Package Drop\HCF\Dev Internal\e5Foundation\2018.3.1786\Script.ps1:84 char:86
+ ... Path | ? { $_.PSIsContainer } | % { [System.Version]$_.Name } | Sort ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [ForEach-Object], RuntimeException
+ FullyQualifiedErrorId : InvalidCastParseTargetInvocation,Microsoft.PowerShell.Commands.ForEachObjectCommand
##octopus[stdout-verbose]
Adding journal entry:
<Deployment Id="4a058e97-91d7-4619-aa29-cc023d7fb150" EnvironmentId="Environments-41" TenantId="Tenants-104" ProjectId="Projects-82" PackageId="" PackageVersion="" InstalledOn="2018-08-09 12:14:32" ExtractedFrom="" ExtractedTo="" RetentionPolicySet="Tenants-104/Environments-41/Projects-82/Step-Sharepoint - Variables Substitute in web.config/Machines-222/<default>" CustomInstallationDirectory="" WasSuccessful="True" />
I just tested locally with the latest version of the step template from the library and I’m unable to replicate the issue you are seeing.
So could you send through the value of the variable Octopus.Action[StepNameOfTheSubstituteVariablesStepTemplate].Script.ScriptBody from the *.Variables file in the Variables folder in your offline drop package.
That variables file seems to be encrypted. I’m assuming that would be a problem for you.
I believe the step is looking for Calamari version folder .e.g. “4.7.6” but this does not exist. The offline package adds the Calamari assemblies directly to the Calamari folder.
My guess is that it may be trying to pass one of the following to a System.Version type which won’t work; “2018.3.1786” or “Calamari”
Cannot convert value "de" to type "System.Version". Error: "Version string portion was too short or too long."
That’s the thing, the fix I did for offline drop targets was that it shouldn’t try and go looking for versioned Calamari folders. See code for relevant logic below:
# Default Calamari installs folder when running on a Tentacle
$CalamariPath = $OctopusParameters['env:TentacleHome'] + "\Calamari"
# If we're running as part of an Offline Drop target deployment Calamari isn't in the same spot as when running on a Tentacle.
# Check if the $CalamariPath exists, if it doesn't look for it in the current working directory.
$findLatestCalamariInstall = $True
if(-not (Test-Path $CalamariPath)) {
Write-Output "$CalamariPath does not exist, falling back to working folder"
$CalamariPath = "$PWD\Calamari"
Write-Output "Looking for Calamari install in $CalamariPath"
$findLatestCalamariInstall = $False
}
# If we're running as part of an Offline Drop target deployment we don't need to check for the latest Calamari version
if ($findLatestCalamariInstall) {
Write-Output "Finding latest Calamari install in $CalamariPath"
$LatestInstalledCalamari = (Get-ChildItem $CalamariPath | ? { $_.PSIsContainer } | % { [System.Version]$_.Name } | Sort -Descending)[0].ToString() }
}
So if the default path doesn’t exist, then it shouldn’t get to the line where it’s getting the latest installed Calamari version folder…
I’m assuming you updated the step template under Library -> Step Templates, updated the step template in your project and then created a new release?
Could you add the variable OctopusPrintEvaluatedVariables with a value of True, create a new release and deploy that, and then send through the raw log from that deployment, this should let me view the script for the step that is being used.