0

Once deployed, I wish a script to executed on receiving tentacle, referencing the exe in package.

        Write-Host ("Initial path " + (Get-Location).Path)
    Write-Host ("Will run in " + $Octopus.Tentacle.CurrentDeployment.PackageFilePath)
    Set-Location $Octopus.Tentacle.CurrentDeployment.PackageFilePath

    Write-Host ("Running PingConfigurator")

    $CMD = ".\Tdc.PingConfigurator.App.exe"
    $arg1 = "-e AndersPing9"

    & $CMD $arg1

    Write-host("Migration PingConfigurator")

However, I get an exception in powershell, saying

Substituting variables in: F:\Octopus\Work\20180201102638-23-33\PostDeploy.ps1 
February 1st 2018 11:26:43Info
Initial path F:\Octopus\Work\20180201102638-23-33 
February 1st 2018 11:26:43Info
Will run in  
February 1st 2018 11:26:43Error
Set-Location : Cannot process argument because the value of argument "path" is  
February 1st 2018 11:26:43Error
null. Change the value of argument "path" to a non-null value. 
February 1st 2018 11:26:43Error
At F:\Octopus\Work\20180201102638-23-33\PostDeploy.ps1:3 char:1 
February 1st 2018 11:26:43Error

What 'path' are we talking about? What can I do to remedy?

Thanks, Anders

1 Answer 1

1

Here's how I've done this before:

[string]$nuGetDeployStepName = "that step there"
[string]$workingDirectory = $OctopusParameters["Octopus.Action[$nuGetDeployStepName].Output.Package.InstallationDirectoryPath"]

This returns the folder in which the NuGet file was unpacked.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.