-
-
Notifications
You must be signed in to change notification settings - Fork 99
feat(core): export pipeline report to disk [experimental] #4898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The goal is to be more explicity on the goal of this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the functionality to export pipeline reports to disk while sanitizing resource configurations and updating report IDs for consistency. Key changes include:
- Introducing ReportConfig methods in resource plugins to filter sensitive data.
- Adding functions to initialize and export reports in YAML format.
- Updating report generation in core pipeline and engine to incorporate the sanitized configuration and sorted hash generation.
Reviewed Changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pkg/plugins/resources/* | Added ReportConfig methods for dockerfile, dockerdigest, csv, cargopackage, and awsami to expose a sanitized configuration. |
pkg/core/udash/publish.go | Removed the inline UpdateID call, deferring report ID updates to a later stage. |
pkg/core/tmp/main.go | Introduced ReportDirectory and InitReport function to manage local report storage. |
pkg/core/result/* | Updated Source, Condition, and Target structs to include Config and SourceID fields. |
pkg/core/reports/report.go | Updated UpdateID to generate consistent report IDs using sorted keys; added additional logic if no configuration is available. |
pkg/core/reports/export.go | Added a new function to export reports to YAML files with timestamp-based filenames. |
pkg/core/pipeline/* and pkg/core/engine/* | Adjusted functions to update report configurations during pipeline execution and integrated report export in the engine run flow. |
pkg/core/engine/exportReport.go | Added a new export function to log and handle report YAML exports under experimental mode. |
Comments suppressed due to low confidence (1)
pkg/core/engine/exportReport.go:26
- [nitpick] Concatenating 'pipeline.Name' and 'err.Error()' directly without a clear separator could result in unclear error messages. Consider using a formatted string to clearly separate the pipeline name from the error message.
errs = append(errs, pipeline.Name+err.Error())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request enhances the Updatecli report functionality by exporting pipeline reports to disk with a sanitized configuration and improving report consistency. Key changes include:
- Implementation of ReportConfig methods in various resource plugins to remove sensitive data.
- Addition of a YAML report export feature with new temporary directory initialization.
- Updates to the report ID generation logic and cleanup of report updates in the pipeline.
Reviewed Changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pkg/plugins/resources/dockerfile/main.go | Added ReportConfig method for sanitized Dockerfile configuration |
pkg/plugins/resources/dockerdigest/main.go | Added ReportConfig method for DockerDigest |
pkg/plugins/resources/csv/main.go | Added ReportConfig method for CSV resources |
pkg/plugins/resources/cargopackage/main.go | Added ReportConfig method for CargoPackage |
pkg/plugins/resources/awsami/main.go | Added ReportConfig method for AWS AMI |
pkg/core/udash/publish.go | Removed redundant UpdateID call |
pkg/core/tmp/main.go | Introduced ReportDirectory and InitReport function |
pkg/core/result/* | Added Config (and SourceID for Target and Condition) fields to report models |
pkg/core/reports/report.go | Revised UpdateID logic with sorted map keys and enhanced hash generation |
pkg/core/reports/export.go | New export to YAML feature |
pkg/core/pipeline/* | Updated report updates in sources, conditions, targets, and resource configuration |
pkg/core/engine/{run.go,exportReport.go} | Updated engine run flow to update report IDs and export reports after execution |
pkg/core/pipeline/sources_test.go | Extended tests to cover scenarios with skipped and warning sources |
Comments suppressed due to low confidence (1)
pkg/core/engine/exportReport.go:26
- [nitpick] Consider adding a separator between the pipeline name and the error message (for example, using ' - ') to improve readability of the combined error string.
errs = append(errs, pipeline.Name+err.Error())
This pull request introduces a few changes around Pipeline report visualization.
Please note that pipeline report are saved in the following directory
/tmp/updatecli/report/<reportID>/<timestamp>.yaml
So running the same Updatecli pipeline multiple time will create multiple report in the directory
/tmp/updatecli/report/<reportID>/
Report Example
Console Output
Test
To test this pull request, you can run the following commands:
go build -o bin/updatecli . ./bin/updatecli diff --config e2e/updatecli.d/success.d/dependsonchangeor.yaml --experimental
A report should be available in
/tmp/updatecli/report/38705491d468396f781fc2d6c22e3b6f25591e8c82f1af0d229e03f2b02fc515/
Additional Information
Checklist
Tradeoff
Only resource spec are sanitized, so parameters like
kind
ortransformers
are passed directly to the report.Considering that report is publicly available, that could be an issue in the future, but I don't think we'll store secret information there.
Another option would be to restrict even more parameters shared with the report
Regarding the new plugin interface method, I hesitated for a long time between using this approach versus using custom tag in the yaml marshaller but due to early design decision made in Updatecli, resource spec are of type
interface{}
which would require some refactoring first.Potential improvement