Skip to content

Conversation

@skudasov
Copy link
Contributor

@skudasov skudasov commented Mar 2, 2025


Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.

Why

The changes introduce enhancements and debugging features to the CI analysis tool, including new visualizations, detailed job and step analysis, and debugging capabilities. It also updates dependencies and adds a new testing utility for CI.

What

  • book/src/framework/components/analyze_ci.md
    • Added an image to visualize CI components.
    • Included sections to guide users on what to look for in their CI pipeline analysis, emphasizing execution times, pipeline flakiness, and cancellations.
    • Updated examples to reflect new commands for analyzing E2E test jobs and steps, and specifying time ranges for the analysis.
  • book/src/framework/components/img_1.png
    • Added a new binary file, likely an image to assist in visualizing or explaining concepts in the documentation.
  • framework/cmd/ci.go
    • Introduced new structures and constants to enhance the analysis capabilities of CI jobs and steps, including detailed statistics and rate limiting.
    • Added functions for adjusting debug directories, writing structured debug information, and computing statistical percentiles.
    • Implemented a comprehensive analysis function to analyze jobs and steps, including sorting and summarizing the data.
    • Added utility functions to assist in the analysis process, such as color coding, summary printing, and filtering skipped jobs or steps.
  • framework/cmd/ci_fake.go
    • Created a new file introducing a fake GitHub Actions client for testing purposes.
  • framework/cmd/ci_test.go
    • Added a new unit test file for the CI analysis functionality, covering various scenarios including handling of no jobs found, job quantiles, and step analysis.
  • framework/cmd/main.go
    • Modified the CI command section to include new flags for specifying the analysis type, enabling debug mode, and defining start and end times for the analysis.
  • framework/examples/myproject/go.mod & go.sum
    • Updated dependencies, reflecting changes in the testing framework and other libraries.

The enhancements aim to provide users with more detailed insights into their CI processes, focusing on efficiency and reliability. Debugging capabilities allow for a deeper examination of CI workflows, jobs, and steps, facilitating optimization and troubleshooting.

@skudasov skudasov requested a review from a team as a code owner March 2, 2025 22:10
@skudasov skudasov force-pushed the ctf-ci-more-analytics branch from 6e621b9 to 0dc94c9 Compare March 2, 2025 22:17
@skudasov skudasov force-pushed the ctf-ci-more-analytics branch from 0dc94c9 to a692472 Compare March 2, 2025 22:30
@skudasov skudasov force-pushed the ctf-ci-more-analytics branch from a692472 to 04a730d Compare March 2, 2025 22:33
@skudasov skudasov changed the title re-write, separate steps/jobs analysis, test re-write CI analysis command, separate steps/jobs, tests Mar 2, 2025
@skudasov skudasov force-pushed the ctf-ci-more-analytics branch 2 times, most recently from f9e5e93 to 4a468ec Compare March 2, 2025 22:41
@skudasov skudasov force-pushed the ctf-ci-more-analytics branch from 4a468ec to 7bb8f39 Compare March 2, 2025 23:24
@skudasov skudasov force-pushed the ctf-ci-more-analytics branch from 7bb8f39 to da6e88d Compare March 3, 2025 11:56
@cl-sonarqube-production
Copy link

// analyze jobs
for _, j := range jobs.Jobs {
stats.Mu.Lock()
defer stats.Mu.Unlock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it a bad practice to call defer inside for loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It leaks memory, true, however, this loop is not inside any service and runtime is very limited, so IMO that's fine.

} else {
stats.Jobs[name].Successes++
}
if j.Conclusion != nil && *j.Conclusion == "cancelled" {
Copy link
Contributor

@Tofel Tofel Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: define these status strings as constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, lemme check if GHA is exposing them

name = name[:MaxNameLen]
}
switch typ {
case "jobs":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: define constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's do this next time we'll be iterating on it

@skudasov skudasov merged commit bda6f16 into main Mar 10, 2025
72 of 83 checks passed
@skudasov skudasov deleted the ctf-ci-more-analytics branch March 10, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants