octopus-deploy - Octopus Deploy 可以有变量中的变量吗

标签 octopus-deploy

这是一个系统 Octopus 部署变量:

#{Octopus.Action[Deploy To Server].Output.Package.InstallationDirectoryPath}

文本“部署到服务器”是我项目中将 Nuget 包部署到服务器的步骤的名称。此变量提供 NugetPackage 的安装位置。

我想知道我是否可以使它更通用:

#{Octopus.Action[#{DeploymentStep}].Output.Package.InstallationDirectoryPath}

#{DeploymentStep}本身是一个变量,其值为“Deploy to Server”?

我试过了,但它在尝试运行时没有进行替换。但我希望变量替换中的变量有不同的语法。

(我想这样做是为了将其设为步骤模板的默认值。)

最佳答案

这是可以做到的;但是你需要使用稍微不同的语法!

变量替换语法: http://docs.octopusdeploy.com/display/OD/Variable+Substitution+Syntax

$deploymentStep = "#{DeploymentStep}"

$installationDirectory = $OctopusParameters["Octopus.Action[$deploymentStep].Output.Package.InstallationDirectoryPath"]

关于octopus-deploy - Octopus Deploy 可以有变量中的变量吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41581221/

相关文章:

powershell - Octopus Deploy - 用于在 IIS 上设置 SSL 绑定(bind)的 Deploy.ps1 脚本

octopus-deploy - 在 Octopus Deploy 中返回/恢复单一环境

nuget - 内置 Octopus 部署存储库

asp.net - 如何清除 Microsoft Azure 服务器上的 iis 缓存?

azure - 远程执行平台

powershell - Octopus Deploy.ps1 DACPAC 部署失败

c# - 如何正确添加 C# 独立脚本作为 Octopus Deploy 中的一个步骤?

iis-8 - Octopus 部署 : Enable SNI on IIS HTTPS binding?

azure-devops - VSTS + Octopus 部署?为什么我看到很多 CI/CD 设置都有这两者?

azure - 如何在 azure 网站上备份和恢复文件