1

I have a Web Extension for a Azure DevOps Server. I want to process external Files, generated by a Task inside a Buildpipeline, with that Extension. Is there a way to upload or provide these Files to the Extension?

enter image description here

Is there a common Way to do that?

Mar Tin
  • 2,132
  • 1
  • 26
  • 46

1 Answers1

1

I am afraid there is not a common way to upload files from build pipeline to web extension.

Using js to invoke a ps1 file might do the trick. write some scripts in ps1 file to read the external file.

In this way the external file can be passed to your web extension through the ps1 script.

var spawn = require("child_process").spawn;
var child = spawn("powershell.exe",["D:\\ProjectLabs\\LeviMicProject\\VSS\\script.ps1"]);
child.stdout.on("data",function(data){
   // "you can deal with the data passed from ps1 here"
});
child.stderr.on("data",function(data){
    console.log("Powershell Errors: " + data);
});
child.on("exit",function(){
    console.log("Powershell Script finished");
});
Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43
  • thanks for your response. I found a alternate way to provide files for web extensions. I describe the approach [here](https://stackoverflow.com/questions/57622361/azure-devops-share-files-with-web-extension). Currently I don't know a better way, but it enables me to provide about 50 to 100 `*.htm` **ReportGenerator** output files to my web extension while I convert the content of the files to a `base64 string` and upload it as a **json-document** to the extension. Inside the extension I use `atob(Base64String)` to load the file in the cache. – Mar Tin Sep 03 '19 at 04:16
  • I was thinking if js could call powershell scripts. and i got a clue from [here](https://stackoverflow.com/questions/10179114/execute-powershell-script-from-node-js). I think you can write a ps1 script to read the external file, and invoke this script in js. I updated my answer – Levi Lu-MSFT Sep 05 '19 at 12:58