[英]Pass pipeline variable to release variable Azure DevOps
Created CICD pipeline with trigger release, and Pipeline variable set in to Azure Devops Rest API. Getting variable in pipeline and set Output true using PowerShell.创建了带有触发器释放的 CICD 管道,并将管道变量设置为 Azure Devops Rest API。在管道中获取变量并使用 PowerShell 设置 Output 为真。
Write-Host $(webAppName)
echo "##vso[task.setvariable variable=webAppName;isoutput=true]$webAppName"
And set the release pipeline variable using WebAppName= ${{variables.webAppName}} on the variable tab.并使用变量选项卡上的 WebAppName= ${{variables.webAppName}} 设置发布管道变量。 It's not working, don't have idea how can we retrive the pipeline variable in release.
它不起作用,不知道我们如何在发布中检索管道变量。
The is no official way to pass variables from Build to Release.这不是将变量从 Build 传递到 Release 的官方方法。
Using Variable Groups in Azure Pipeline Library is a good option: https://learn.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=yaml在 Azure 管道库中使用变量组是一个不错的选择: https://learn.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=yaml
Another work around, you could store the variable values in a file and attach that as a Build Artifact.另一种解决方法是,您可以将变量值存储在文件中并将其作为构建工件附加。 That way you can read the file in the release pipeline by downloading Build Artifacts and set the variable again.
这样您就可以通过下载 Build Artifacts 读取发布管道中的文件并再次设置变量。 You could check my answer here: is there any way to pass variables from CI to CD pipeline
你可以在这里查看我的答案: is there any way to pass variables from CI to CD pipeline
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.