Merge multiple html files into one

Hi Team,

I need advice as how to merge multiple html files that have been created as part octopus artifacts as seen from below screenshot

I have tried few methods like(looping through files and merging in bash script in Run a Script) , inline assets from cypress. Alternatively my Visual Studio code outputs one merged file when used with cypress multi reporters and cypress mochawesome reporter within cypress.config.js file

And Octopus Deploy doesn’t seem to be doing the same job of merging the files instead creates blank file or just ends up with one html file contents.

Happy to provide more info in this regard if need be.


Hi Pari,

Thanks for getting in touch!

Octopus doesn’t perform any actions on files uploaded as artifacts other than storing them, and modifying them further at that point isn’t supported.

A better solution here would be to amend your script to perform the required merging of these files and then upload the output as a single artifact.


Thanks for the reply Paul.

I have done exactly that by trying not one but 4 methods - it just doesn’t work.

  1. Looping through files and merging - results in just one file contents
  2. inline assets - creates blank file
  3. installed dependencies like cypress multi reporters - works on VSC but not here
  4. cypress mochawesome reporter - works on VSC but not here

Thought you might have some tips to keep these pity issues away, which aids in a big way as end result.


Octopus is essentially just a script runner for this kind of action, so anything that works in Powershell or Bash outside of Octopus should work when run as part of a deployment process.

Looking at your original screenshot, I noticed that the script step runs on a worker. Is this a different machine from the deployment target on which the IIS deploy step is running? Would the script you’re attempting to run need to be executed on the same machine on which the deployment occurs?

Yes you are right, the first option of looping through the files and merging should have worked but its not on OD. Its overwriting the files instead of appending. Which was the hope i had for an merged html file.

Yes, they are two different machines IIS deploy(windows) and Worker(Ubuntu). Worker is on Ubuntu where cypress smoke tests run within a container and outputs the results.

Am I missing anything here?


The only functional difference when running the script within Octopus is that it would be executed in a non-interactive session, which I wouldn’t expect to make a difference in this scenario.

If you’d like to send over the script you were using to loop and append the files we can take a look and see if we can get it working.

Hi @parnithakaleru,

Thanks for sending over that script for our team to review.

It looks like you’re echoing each complete HTML file into the output file. This will technically put all of the data into the output file but browsers will only render the first instance of the tags <HTML> to </HTML>.

If you want all results to be rendered, all of the data for each file would need to be between these tags. I’m not an expert in bash, but this Stackoverflow article had a pretty good answer to help merge the content of files between headers. Hopefully you can adapt this to your use case.

Please let us know if that helps get you a bit further.


Hi Garrett,

Thanks for pointing in the right direction with the script. I did try the article solution but the merged html file returned as blank. I will try amending few bits to make it work.


1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.