简体   繁体   English

Ubuntu Agent-无法在Powershell任务中访问管道变量

[英]Ubuntu Agent - Can't access pipeline variables in powershell task

I have created a build with an Ubuntu agent, and I'm trying to access my pipeline variables through a powershell task, but it always returns an empty value. 我已经使用Ubuntu代理创建了一个构建,并且试图通过powershell任务访问管道变量,但是它始终返回一个空值。 By contrast, when I run the same script on a Windows agent it can get the value correctly. 相比之下,当我在Windows代理上运行相同的脚本时,它可以正确获取值。

The script that I use is: 我使用的脚本是:

Write-Host "My Variable is $env:URLAPI"
Write-Host "My Another Variable is $env:Build.BuildNumber"

I just want to know why this works on Windows Agent and not on the Ubuntu Agent. 我只是想知道为什么这适用于Windows Agent而不适用于Ubuntu Agent。

Thank you 谢谢

你也可以在linux中运行powershell,我解决了问题,有一些我不知道的事情..在linux机器中,管道变量将字符串转换为大写,所以我只是改为$ env:BUILD.BUILDNUMBER它的工作原理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Powershell代理任务管道 - Azure Powershell agent task pipeline Powershell 无法访问运行时环境变量 - Powershell can't access runtime environment variables Azure DevOps 发布管道 Azure CLI Powershell 任务找不到 Z2F2D399F0EA80FE47B3459 - Azure DevOps Release pipeline Azure CLI Powershell task can't find powershell Azure Devops Powershell 任务:生成变量的编程访问 - Azure Devops Powershell task: Programmatic Access of Build Variables 无法访问我的 Docker 堆栈 Yaml 文件中的 Azure 管道变量 - Can't access Azure pipeline variables in my Docker stack Yaml file 使用 REGEX 内容替换动态变量作为 Azure CD 管道 Powershell 任务中的变量 - Replacing dynamic variables using REGEX content as variable in Azure CD Pipeline Powershell Task Azure 管道在其他任务之前找不到脚本 - Azure pipeline can't find script when preceded by other task 无法在 Azure DevOps 管道“解析错误”中运行 PowerShell 脚本 - Can't run PowerShell script in Azure DevOps Pipeline 'parse error' 无法在 Azure DevOps 发布管道任务中更改服务连接 - Can't change service connection in Azure DevOps release pipeline task 如何确保 Azure Dev Ops Pipeline 中的代理具有对存储帐户的防火墙访问权限? - How can you make sure, that an Agent in an Azure Dev Ops Pipeline has firewall access to a storage account?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM