0
0
Jenkinsdevops~5 mins

HTML reports publishing in Jenkins - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: HTML reports publishing
O(n)
Understanding Time Complexity

When Jenkins publishes HTML reports, it processes files to display results. Understanding how the time to publish grows helps us plan for bigger projects.

We want to know: How does publishing time change as the number of report files grows?

Scenario Under Consideration

Analyze the time complexity of the following Jenkins pipeline snippet that publishes HTML reports.


    stage('Publish HTML Reports') {
      steps {
        publishHTML(target: [
          allowMissing: false,
          alwaysLinkToLastBuild: true,
          keepAll: true,
          reportDir: 'reports',
          reportFiles: '**/*.html',
          reportName: 'Test Report'
        ])
      }
    }
    

This code publishes HTML reports from a directory after tests run, making them visible in Jenkins.

Identify Repeating Operations

Look for repeated work inside the publishing step.

  • Primary operation: Reading and processing each HTML report file in the specified directory.
  • How many times: Once per report file found in the 'reports' folder.
How Execution Grows With Input

As the number of HTML files grows, Jenkins reads and processes each one.

Input Size (n files)Approx. Operations
1010 file reads and processing steps
100100 file reads and processing steps
10001000 file reads and processing steps

Pattern observation: The work grows directly with the number of files. Double the files, double the work.

Final Time Complexity

Time Complexity: O(n)

This means the time to publish reports grows linearly with the number of HTML files.

Common Mistake

[X] Wrong: "Publishing HTML reports takes the same time no matter how many files there are."

[OK] Correct: Each file must be read and processed, so more files mean more work and longer time.

Interview Connect

Understanding how Jenkins handles report publishing helps you explain build pipeline efficiency and scaling in real projects. This skill shows you can think about how tools behave as projects grow.

Self-Check

"What if we changed reportFiles from '**/*.html' to 'index.html'? How would the time complexity change?"