Hi Sunaina,

If you want to merge the HTML reports from multiple GoCD Jobs into a single 
HTML document, you will need a process that runs after all of the relevant 
Jobs has completed.

The simplest way to accomplish this in GoCD is to add a new Stage that can 
consume the artifacts generated in the previous Stage:

   1. Stage 1: Do stuff in multiple Jobs. Generate multiple HTML reports.
   2. Stage 2: Merge HTML reports from Stage 1.

Another way to accomplish this is to add a Job to the existing Stage where 
the first Task is to wait for all other Jobs in the Stage to complete:

   1. Job 1:
   1. Task 1: Do stuff
      2. Task 2: Create HTML report
      2. Job 2:
   1. Task 1: Do stuff
      2. Task 2: Create HTML report
      3. Job 3:
   1. Task 1: Wait for all other Jobs to complete
      2. Task 2: Merge HTML reports from all other Jobs
      
There are some downsides to this approach. Job 3 will often have a much 
longer runtime than is required to do its work. If you're not using Elastic 
Agents this means that Job 3 needlessly ties up one of your Agents while 
waiting for the other Jobs to complete. Depending on the specifics of your 
GoCD infrastructure configuration, it is even possible for Jobs to be 
scheduled in such a way that the Pipeline Stage gets blocked. Imagine this 
as a Template in a setup with just 2 static Agents and 2 Pipelines based on 
this Template. It is possible, in this scenario, that Pipeline 1 Job 3 gets 
started on Agent 1 and Pipeline 2 Job 3 gets started on Agent 2 before Job 
1/2 from either Pipeline, resulting in both Pipelines being blocked as Job 
3 runs forever waiting for the other Jobs to finish and the other Jobs 
stuck waiting for an Agent on which they can run.

A third way to do it is to add a Task to end of each Job that does the 
merge work if it is the last Job running for the Stage:

   1. Job 1:
      1. Task 1: Do stuff
      2. Task 2: Generate HTML report
      3. Task 3: Am I the only unfinished Job? If yes, merge all reports.
   2. Job 2:
      1. Task 1: Do stuff
      2. Task 2: Generate HTML report
      3. Task 3: Am I the only unfinished Job? If yes, merge all reports.
   3. ...
   4. Job N:
      1. Task 1: Do stuff
      2. Task 2: Generate HTML report
      3. Task 3: Am I the only unfinished Job? If yes, merge all reports.
   
This solution is subject to race conditions, though, because GoCD Jobs do 
not complete until all Artifacts have been uploaded and Artifacts are not 
uploaded until after all Tasks complete. This means that it is possible for 
the last Job to run its "am I the last?" check while the second-to-last Job 
is still uploading Artifacts. If this happens then the last Job will not 
recognize that it is the last one and will not run the HTML merge task.

Hope this helps.

Regards,
Jason


On Wednesday, 5 August 2020 06:13:08 UTC-4, Sunaina Awadhiya wrote:
>
> Thanks Sim,
>
> Really helpful information. I did create different folder path for html 
> report for 2 separate jobs which are executing in parallel and i have got 
> html reports successfully for both jobs but most of the times only 1 job 
> return html report. So just curious to know what could be the reason behind 
> and can you please help me how to merge all jobs report and put in one 
> single html.
>
> More detail steps with example would be more helpful.
>
> Thanks and Regards,
> Sunaina
>
> On Mon, Aug 3, 2020 at 1:17 AM Sasa Mitrovic <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>> You need to create test artifacts for every single one you need. Path 
>> where to save it must be different file or folder. Important part is that 
>> this folder names becomes Artifact path after job finish and upload  
>> content to GOCD Server and you will see results in Artifacts Tab from UI. 
>> Now create Custom tabs and set source to point into this Artifacts. Your 
>> full nice report will be rendered inside custom tab. If you want to include 
>> only one report to show all of them, this report format need to include 
>> nice HTML page report created from all source jobs as one page with sub 
>> pages where all of them are in separate folder per each job you have. Use 
>> pure html or JS to create this summary page. This of this as HTML page with 
>> other source pages in different folders.
>>
>> I hope this will give you way and direction of thinking to better use 
>> Test Artifacts and Artifacts location on server after upload and 
>> combination with Custom Tabs. In this way Reporting becomes must powerful 
>> way how to do it from any other known CI/CD software. 
>>
>> P.S Not forget that all these paths are relative from Agent working 
>> directory so test it and learn it.
>>
>> B. Regards
>>
>> четвртак, 30. јул 2020. 19.20.26 UTC+2, Sunaina Awadhiya је написао/ла:
>>>
>>> Can anyone help me with the steps to get reports in custom tab from all 
>>> jobs running in parallel in one stage, AS i have noticed i am getting 
>>> report only for 1 stage and other stage reports are lost. I have created 
>>> custom tab for report
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "go-cd" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/go-cd/3291b8ad-06ba-4810-8684-19a565972ccco%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/go-cd/3291b8ad-06ba-4810-8684-19a565972ccco%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Sunaina Awadhiya
> Bangalore
>

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/b7836d8e-66fb-4c2d-a6b2-ca9b15480f7bo%40googlegroups.com.

Reply via email to