Azure Dev ops在发布管道中按环境替换令牌 [英] Azure Dev ops replace tokens per environment in release pipeline

本文介绍了Azure Dev ops在发布管道中按环境替换令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用替换令牌扩展名 https://marketplace.visualstudio.com/items ?itemName = qetza.replacetokens 替换**/*.config文件中的变量

i am using the Replace token extension https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens to replace variable in **/*.config files

我们的构建管道创建了一个需要部署到所有环境的工件

Our build pipeline creates one artifact that needs to be deployed to all environments

我们的发布管道(DEV,QA)中有2个环境

we have 2 environments in our release pipeline(DEV ,QA)

每个环境都配置了一组变量

Each environment has a set of variables configured

我已将替换令牌任务添加到我们的发布管道中

I have added the replace token task onto our release pipeline

我的配置文件如下

令牌不会被替换,我是Azure DevOps的新手,我在这里缺少任何内容吗?

The the tokens are not replaces , i Am new to Azure DevOps , am i missing anything here?

推荐答案

发布活动在发布代理上运行 .在应用程序部署到应用程序服务后 ,您正在运行令牌替换,因此不会部署令牌替换.

Release activities run on the release agent. You're running token replacement after the application is deployed to the app service, so the token replacement isn't getting deployed.

那是一个问题.

另一个问题是Web部署程序包是zip存档,因此令牌替换不会影响zip文件中包含的文件.您不应将令牌替换与Web部署结合使用.您应该使用Web部署转换(parameters.xmlSetParameters.xml),您正在使用的Web部署任务支持这些转换. parameters.xml允许您定义xpath表达式以定位要转换的元素,并且setparameters.xml文件包含要在转换中使用的值.

Another issue is that web deploy packages are zip archives, so token replacement isn't going to affect the files contained in the zip file. You shouldn't use token replacement in conjunction with web deploy. You should use web deploy transforms (parameters.xml and SetParameters.xml), which are supported by the web deploy task that you're using. parameters.xml allows you to define xpath expressions for locating elements to transform, and the setparameters.xml files contain the values to use in the transformation.

这篇关于Azure Dev ops在发布管道中按环境替换令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆