What is the maximum length of a variable in Azure Pipelines?

▼魔方 西西 提交于 2020-05-15 10:13:08

问题


I got this warning after adding a long string generated programmatically as an Azure Pipelines variable (as a quick and easy way to test changes instead of pushing a file to my repo):

##[warning]Environment variable 'INPUT_SCRIPT' exceeds the maximum supported length. Environment variable length: 40384 , Maximum supported length: 32766

The warning is pretty clear to understand and seems appropriate given a regular environment variable, but the task that used this new pipelines variable works as expected (assuming the entire string is there). Is this warning relevant? Will it bite me in the back later if I just ... leave it in?


回答1:


The theoretical maximum length of an environment variable is around 32,760 characters. All environment variables must live together in a single environment block, which itself has a limit of 32767 characters.In practice, you have to share the environment block with all the other variables in the block, so your random call to SetEnvironmentVariable with a 32,760-character string is unlikely to succeed.It also depends on how you’re setting the variable; i.e., the code that your environment-variable-setting technique passes through before it gets to the SetEnvironmentVariable call. For details ,please refer to this link.

Here are two cases with the same warning for reference: 1 and 2

Is this warning relevant? Will it bite me in the back later if I just ... leave it in?

For this issue, I have not found the errors caused by this warning. Since you have already paid attention to this issue, if you encounter errors, you can share them here. Let us investigate them further.



来源:https://stackoverflow.com/questions/56534338/what-is-the-maximum-length-of-a-variable-in-azure-pipelines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!