Skip to content
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

show extensions when pack inspect #1611

Merged
merged 6 commits into from
Feb 1, 2023

Conversation

itsdarshankumar
Copy link
Contributor

@itsdarshankumar itsdarshankumar commented Jan 27, 2023

Summary

pack insepct command output should include Extensions if extensions were used while building the image

Output

image

Before

image

After

Image With Extension:
image

Image Without Extension:
image

Related

Resolves #1486

@itsdarshankumar itsdarshankumar requested review from a team as code owners January 27, 2023 20:17
@github-actions github-actions bot added this to the 0.29.0 milestone Jan 27, 2023
@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label Jan 27, 2023
@codecov
Copy link

codecov bot commented Jan 27, 2023

Codecov Report

Merging #1611 (7f3951a) into main (66fa019) will increase coverage by 0.05%.
The diff coverage is 100.00%.

❗ Current head 7f3951a differs from pull request most recent head 54f846f. Consider uploading reports for the commit 54f846f to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1611      +/-   ##
==========================================
+ Coverage   80.58%   80.63%   +0.05%     
==========================================
  Files         156      156              
  Lines       10544    10508      -36     
==========================================
- Hits         8496     8472      -24     
+ Misses       1542     1534       -8     
+ Partials      506      502       -4     
Flag Coverage Δ
os_linux 79.44% <100.00%> (+0.05%) ⬆️
os_macos 77.49% <100.00%> (+0.04%) ⬆️
os_windows 80.54% <100.00%> (+0.05%) ⬆️
unit 80.63% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@itsdarshankumar itsdarshankumar force-pushed the pack-inspect branch 14 times, most recently from 6fe8e77 to d96f28e Compare January 30, 2023 06:27
type BOMEntryDisplay struct {
Name string `toml:"name" json:"name" yaml:"name"`
Version string `toml:"version,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
Metadata map[string]interface{} `toml:"metadata" json:"metadata" yaml:"metadata"`
Buildpack dist.ModuleRef `json:"buildpacks" yaml:"buildpacks" toml:"buildpacks"`
}

type BOMEntryWithExtensionDisplay struct {
Copy link
Member

Choose a reason for hiding this comment

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

I have the feeling that this should name BOMEntryWithExtension? I mean, a Display contains entries of this struct, right?

@@ -48,3 +70,31 @@ func displayBOM(bom []buildpack.BOMEntry) []BOMEntryDisplay {

return result
}

func displayBOMWithExtension(bom []buildpack.BOMEntry) []BOMEntryWithExtensionDisplay {
Copy link
Member

Choose a reason for hiding this comment

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

Based on my previous comment, if the struct name is changed to BOMEntryWithExtension then the method's name make sense to what is returning.

if info == nil {
return nil
return nil, &InfoWithExtensionDisplay{
Copy link
Member

Choose a reason for hiding this comment

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

Nice!


// List of extensions that passed detection, ran their generate
// phases and made a contribution to this image.
Extensions []buildpack.GroupElement
Copy link
Member

Choose a reason for hiding this comment

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

@itsdarshankumar I have a doubt, which problems did you face if you just add Extensions []buildpack.GroupElement into ImageInfo struct? I mean, it an ImageInfo could have extension, then is this new struct totally necessary? did you face issues trying to print the output in that way? I just want to understand why do we need this new one.

Signed-off-by: Darshan Kumar <itsdarshankumar@gmail.com>
Signed-off-by: Darshan Kumar <itsdarshankumar@gmail.com>
Signed-off-by: Darshan Kumar <itsdarshankumar@gmail.com>
Signed-off-by: Darshan Kumar <itsdarshankumar@gmail.com>
@itsdarshankumar itsdarshankumar force-pushed the pack-inspect branch 2 times, most recently from 7228bca to d8f2fe2 Compare January 30, 2023 19:56
Signed-off-by: Darshan Kumar <itsdarshankumar@gmail.com>
Copy link
Member

@jjbustamante jjbustamante left a comment

Choose a reason for hiding this comment

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

Nice work @itsdarshankumar.

Thanks a lot for your contributions!

@@ -19,12 +19,16 @@ type BOMEntryDisplay struct {
Version string `toml:"version,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
Metadata map[string]interface{} `toml:"metadata" json:"metadata" yaml:"metadata"`
Buildpack dist.ModuleRef `json:"buildpacks" yaml:"buildpacks" toml:"buildpacks"`
Extension dist.ModuleRef `json:"extensions" yaml:"extensions" toml:"extensions"`
Copy link
Member

Choose a reason for hiding this comment

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

I had the occasion to go back and look at this PR, and actually I don't think this is what we want. A "bom entry" is an outdated concept that only applies to buildpacks. It appears that we're basically just repeating information but under the header "extensions"... (cc @jjbustamante )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pack inspect when image built with extensions should show the extensions
4 participants