【问题标题】:How to download/inspect a transformed config file in an Azure DevOps release pipeline如何在 Azure DevOps 发布管道中下载/检查转换后的配置文件
【发布时间】:2020-10-29 15:51:01
【问题描述】:

在我的发布管道中,我有一个File Transform 任务将几个变量插入到我的app.config 文件中。任务成功完成,从日志看来,所有变量都被替换了,但是我的测试失败了,我觉得这是由于配置文件中的值错误造成的。我想检查该配置文件以验证值,但不知道如何下载它。

在日志中我有以下内容:

2020-10-21T20:49:07.4398446Z ##[debug]Substituting original value in place of temp_name: CONFIG_FILE_SETTINGS_TOKEN(ClientId)
2020-10-21T20:49:07.4399269Z ##[debug]Substituting original value in place of temp_name: CONFIG_FILE_SETTINGS_TOKEN(ImpersonatedUserGuid)
2020-10-21T20:49:07.4400093Z ##[debug]Substituting original value in place of temp_name: CONFIG_FILE_SETTINGS_TOKEN(AccountId)
2020-10-21T20:49:07.4400969Z ##[debug]Substituting original value in place of temp_name: CONFIG_FILE_SETTINGS_TOKEN(PrivateKey)
2020-10-21T20:49:07.4404687Z ##[debug]Substituting original value in place of temp_name: CONFIG_FILE_SETTINGS_TOKEN(Username)
2020-10-21T20:49:07.4405392Z ##[debug]Substituting original value in place of temp_name: CONFIG_FILE_SETTINGS_TOKEN(Password)
2020-10-21T20:49:07.4406068Z ##[debug]Substituting original value in place of temp_name: CONFIG_FILE_SETTINGS_TOKEN(tokenReplacementInSeconds)
2020-10-21T20:49:07.4406744Z Config file : D:\a\r1\a\testautomation\tests\NDS\bin\Release\net48\NDS.dll.config updated.
2020-10-21T20:49:07.4407872Z XML variable substitution applied successfully.
2020-10-21T20:49:07.4468956Z ##[section]Finishing: File Transform: app.config

从日志中我试图弄清楚如何下载已更新的文件D:\a\r1\a\testautomation\tests\NDS\bin\Release\net48\NDS.dll.config

有谁知道我如何做到这一点?即使将文件内容打印到日志文件也足以让我验证。

【问题讨论】:

  • 嗨@so cal cheesehead,刚刚检查一下这个问题现在是否仍然阻碍您?这个问题有什么更新吗?此外,我们还可以在 azure devops 管道中使用 power shell 脚本打印 .config 文件信息,然后检查日志中的变量。
  • @VitoLiu-MSFT 我认为我最好的选择是将文件复制到一个 azure blob 存储容器,但是我正在运行看起来像权限问题的 Azure Blob 文件复制操作:RESPONSE Status: 403 This request is not authorized to perform this operation using this permission.

标签: azure-devops azure-pipelines azure-pipelines-release-pipeline azure-pipelines-release-task azure-pipelines-tasks


【解决方案1】:

如果您在发布管道中使用它,您可以将任务移动到构建管道并将文件发布为工件。这是一种选择。

另一个选项可以是 Azure File Copy task,因此您可以将文件复制到 Azure Blob,然后您可以检查您的文件。

当然,您也可以从托管测试环境的地方获取文件。 (你没有提到它在哪里,所以我不能在这里多说)。

如果您有可用的 FTP,您可以将文件复制到那里 FTP Upload task

如果您只是将文件打印到输出中,您的秘密将被替换为 ***,因此您可能无法按照自己的意愿进行验证。

【讨论】:

  • 将文件复制到 azure blob 存储就可以了!仅供任何可能遇到此问题的人参考,我遇到了错误403 This request is not authorized to perform this operation using this permission. 正在创建容器,但尝试复制文件时会出错。我尝试添加许多不同的权限角色无济于事,为我解决的问题是使用 AzureBlob 文件复制任务版本3.* 最新版本4.* 完全相同的配置会因403 错误而失败。
猜你喜欢
  • 2019-08-01
  • 2019-07-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-06
  • 2021-02-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多