Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to read file from Azure DevOps YAML?

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.

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

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?

like image 365
cdie Avatar asked Feb 05 '19 19:02

cdie


1 Answers

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

like image 61
4c74356b41 Avatar answered Oct 07 '22 02:10

4c74356b41