Foozinator
Foozinator

Reputation: 400

Azure Pipelines folder path

The Azure DevOps UI allows you to group Pipelines into folders and subfolders, but I don't see any way to read those folder names from a task in yaml. I couldn't find anything in the Microsoft Docs that looks helpful.

I'm not talking about file structure, but the pipelines themselves. The "Recent" view shows the folder path under the pipeline name, and the "All" view shows the pipelines in a tree view.

TeamCity allows you to attach variables at the folder level, which subfolders and build configurations inside inherit. Is there any way to group variable settings outside the library or to select libraries based on pipeline folder or other pipeline-specific value?

Upvotes: 0

Views: 1326

Answers (1)

jsprovoke
jsprovoke

Reputation: 29

So it seems like you have two questions here:

  1. "but I don't see any way to read those folder names from a task in yaml."

    • I may not be understanding your question here, so please correct me. Are you asking how you might see the child folders/files of your pipelines folder? If so you don't need a task, you just need to run shell script cd into the folder and then ls -R. If you have multiple folders you store your pipelines in that a simple find -L <directory_to_search__use_~_to_search_from_root> -type f \( -name "*.yml" -o -name "*.yaml" \) -exec sh -c 'for d; do dirname "$d"; done' sh {} + will find all the folders containing *.yaml or *.yml files. If you want to pipe them to file add a | sort -u -o <filename_you_want> to the end of that command.
  2. Is there any way to group variable settings outside the library or to select libraries based on pipeline folder or other pipeline-specific value?

    • Define "group". Selecting the library based on path is relatively straightforward simply grep out the path and apply your logic to output the variable library's name based on the path.

Hope this helps, but let me know if you have further questions etc.

Upvotes: 0

Related Questions