Azure DevOps:"替换令牌任务 "在设置来自JSON的变量文件时存在问题。

问题描述 投票:0回答:1

我正试图设置一个''。替换代币任务'为我的构建管道从一个JSON文件,将持有环境变量如下。

enter image description here

然后是我的JSON环境文件

enter image description here

用来替换标记的JavaScript目标文件。

enter image description here

不幸的是,我得到了下面的错误。

enter image description here

我错过了什么?

azure-devops continuous-integration devops azure-pipelines-release-pipeline
1个回答
0
投票

我在这里遗漏了什么?

enter image description here

我可以在我这边重现同样的问题,我认为这只能说明你的以下问题 Variable files(JSON) 输入。

enter image description here

请确保变量是 顺利 从变量json文件中加载。

1.确保你的 env-config.json 文件有以下内容。

{
    "alambda.endpoint":"ForTest"
}

2.仔细检查你的 env-config.json 档!(在我看来,你的问题更像是 (在我看来,你的问题更像是一个关于你的问题。路径问题~)如果任务无法找到并加载文件,它也会抛出 variable not found. 为此。

  • 确保相对路径正确
  • 试着把长路径切掉,我不知道是不是因为路径太长导致的问题。试着用 **/env-config.json 而不是很长的路径。
  • 如果上面的提示不能奏效,我建议你可以移动 env-config.json 文件到根目录 $(System.DefaultWorkingDirectory)复制任务 或什么。 (关于 System.DefaultWorkingDirectory 看到 此处). 然后再试试用 **/env-config.json.
© www.soinside.com 2019 - 2024. All rights reserved.