Closed ChakshuGautam closed 1 year ago
Maybe we can add https://github.com/marketplace/actions/dive-action to the workflow
Maybe we can add https://github.com/marketplace/actions/dive-action to the workflow
I tried to implement this, but it seems that the code is not maintained and the implementation failed. I'm considering writing a new action. What features would you like to see in this new action @ChakshuGautam ? cc: @jayanth-kumar-morem @singhalkarun
Thanks for looking into this @PiyushRaj927. Here are some features that I think would be useful for this new action:
Size Tracking
: The action should be able to track the size of the Docker image and report it back in the PR. This will help us understand how much a particular PR is contributing to the overall size of the image.Once the Size Tracking
is in place, we can move to
Size Comparison
: It would be great if the action could also compare the size of the image before and after the changes in the PR. This will give us a clear idea of how much the image size is increasing or decreasing due to the PR.Size Limit
: We should be able to set a limit on the size of the Docker image. If a PR causes the image size to exceed this limit, the action should fail and prevent the PR from being merged.Proposed Solution:
For the initial implementation, the proposed solution involves introducing a workflow comment on the pull request (PR) that includes the following information: the total size of the PR, the size of each layer, and an analysis report generated by the dive
. This analysis report provides image efficiency and wasted bytes.
To facilitate a comparison of image sizes, the build workflow will be modified to upload an artifact containing information about the images built from the main branch. The workflow responsible for the PR comment will reference this artifact to gather the necessary data for its comment.
To enable the creation of comments, the solution will utilize the GitHub Script action available at https://github.com/actions/github-script. You can refer to a basic implementation at https://github.com/PiyushRaj927/WarpSQL/pull/1#issuecomment-1620592471.
I would appreciate it if someone could offer suggestions or recommendations on how to present information in a clear and easily understandable manner.
cc: @singhalkarun @jayanth-kumar-morem
It seems like you're on the right track with your proposed solution. Here's a suggestion to use Tables. You can use Markdown tables in your PR comments to display the size of each layer, the total size, and the wasted bytes.
Given this will increase in size over time, it would be important for us to be conscious about how much we are adding to the base image.