microsoft/azure-pipelines-vscode

Simulate template expansion locally

ChristopherHX opened this issue · 0 comments

Imagine you are working on a big azure pipeline yaml file collection which are heavily relying on template files and you don't want to commit everything to see if your change is syntactically correct.

For the entrypoint yaml file this official endpoint can be used for this purpose https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/preview/preview?view=azure-devops-rest-6.1

  • This would be processed by the azure pipelines server, which is good since it has access to all variables and resources to the pipline
  • A big is problem is that if you work on nested template files you cannot directly upload it without a git push

I started reimplementing the Azure Pipelines Template Engine (last year in 2022) to do what the official api endpoint does locally in .net6.0+ (my vscode extension currently consumes it via the net8.0 browser-wasm target and a javascript binding, ca. 11 MB of compiled wasm files)

What I'm currently working on can be found here and on the vscode marketplace
https://github.com/ChristopherHX/runner.server/blob/main/src/azure-pipelines-vscode-ext/README.md

  • Live Preview of expanded yaml file
    • any edit to dependent templates result in an update of the preview, which might take a while if your template is really big
    • errors in template expressions are reported back as error annotations
    • a evaluation log is available to debug evaluation failures, caused by either bugs in the template engine or of the user template files
      • Debug logs of evaluating template expressions ( those are not checked yet by the official extension )
  • Task definitions to configure...
    • input parameters
    • input variables
    • where external repositories are cloned
      • needed if nested template is outside of the current repository
      • also editis of that extenal template can be done locally and you see the result
  • The validate mode only checks for errors with the given inputs of parameters, variables and external repository locations.

azure-pipelines-vscode-ext is an univeral vscode extension, which means it runs both in vscode desktop and web on any vscode platform, these are more platforms than the official extension is available on

@50Wliu Suggested that this (I have only provided a very short summary) would be great addition to the official extension

(Btw, in response to "I'm working on another vscode extension, which can simulate template expansion locally", I would gladly take that as a contribution into azure-pipelines-vscode, if you're interested!)

microsoft/azure-pipelines-language-server#157 (comment)

To make what I'm currently building part as a contribution into azure-pipelines-vscode, requires some discussion with the maintainers of this vscode extensions.

Currently this can be installed side by side with this extension and both can enhance each other without beeing in the same extension.