有没有办法从Azure DevOps YAML读取文件? [英] Is there a way to read file from Azure DevOps YAML?

查看:134
本文介绍了有没有办法从Azure DevOps YAML读取文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用YAML文件格式的Azure DevOps上进行CI时,我试图读取csproj文件以提取有关版本的信息,以创建将遵循csproj版本的NuGet程序包.

When doing my CI on Azure DevOps with the YAML file format, I'm trying to read my csproj files to extract informations about version to create NuGet packages that will follow the csproj version.

我正在使用NuGetCommand@2进行包装(由于versioningScheme: byPrereleaseNumber)

I'm using NuGetCommand@2 for packaging (because of versioningScheme: byPrereleaseNumber)

是否有内置任务或一种方法可以从csproj文件中提取此信息作为正则表达式并将其传递给NuGetCommand@2?

Is there a built-in task or a way to extract this info from csproj file as a regex and pass them to NuGetCommand@2?

推荐答案

我相当确定对此没有内置功能,但是您可以使用任何喜欢的脚本语言来解析文件并吐出"任何东西您需要将其作为构建变量并在以后使用.这是我一直在做的事情:

I'm fairly sure there is nothing built-in for this, but you can use any scripting language you like to parse the file and "spit out" whatever you need as a build variable and consume it later on. here's what I've been doing:

- script: echo "##vso[task.setvariable variable=dp]$(cat $(Build.Repository.LocalPath)/deployment/dp)"
- script: az group delete -n $(dp)-k8s -y --no-wait

您显然可以在脚本步骤中执行任何自定义操作,并以您希望的任何方式使用结果.

you can obviously do any custom thing in the script step and consume the result in anyway you like to.

https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md

这篇关于有没有办法从Azure DevOps YAML读取文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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