【问题标题】:Running powershell script in Octopus Deploy w ref to exe in package在 Octopus 中运行 powershell 脚本 将 w ref 部署到包中的 exe
【发布时间】:2018-02-01 10:33:08
【问题描述】:

部署后,我希望在接收到 tentacle 时执行一个脚本,引用包中的 exe。

        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")

但是,我在 powershell 中遇到异常,说

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

我们在谈论什么“路径”?我能做些什么来补救?

谢谢,安德斯

【问题讨论】:

    标签: powershell octopus-deploy


    【解决方案1】:

    这是我之前的做法:

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

    这将返回解压 NuGet 文件的文件夹。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-10
      • 2014-12-21
      • 1970-01-01
      • 2018-01-31
      • 1970-01-01
      • 2017-12-10
      • 1970-01-01
      相关资源
      最近更新 更多