Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Enabled tetra bash autocompletion in the Tetragon image #2965

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

PhilipSchmid
Copy link
Collaborator

@PhilipSchmid PhilipSchmid commented Oct 1, 2024

Description

Minor UX improvement when troubleshooting inside the Tetragon container image:

77a8a8762616:/# tetra    # pressing <tab><tab>
bugtool          (Produce a tar archive with debug information)                probe            (Probe for eBPF system features availability)
completion       (Generate the autocompletion script for the specified shell)  stacktrace-tree  (Manage stacktrace trees)
cri              (connect to CRI)                                              status           (Print health status)
getevents        (Print events)                                                tracingpolicy    (Manage tracing policies)
help             (Help about any command)                                      version          (Print version from CLI and server)
loglevel         (Get and dynamically change the log level)

TODOs

  • Check if there's a better way to install bash-completion in a separate stage and only copying over the relevant files. Why? See outputs of grype👇

Without bash-completion installed:

 ✔ Vulnerability DB                [no update available]
 ✔ Loaded image                                                                                                                                                                 af7eb1d3b2a6
 ✔ Parsed image                                                                                                      sha256:af7eb1d3b2a6396945a08f836e6aaca937027c985cd07e4bf6f3bccb216d50a8
 ✔ Cataloged contents                                                                                                       1bebc98c8d0b81c46ab1f3e5ccda178d7b838a9c291a445f32c650c333291194
   ├── ✔ Packages                        [310 packages]
   ├── ✔ File digests                    [188 files]
   ├── ✔ File metadata                   [188 locations]
   └── ✔ Executables                     [78 executables]
 ✔ Scanned for vulnerabilities     [0 vulnerability matches]
   ├── by severity: 0 critical, 0 high, 0 medium, 0 low, 0 negligible
   └── by status:   0 fixed, 0 not-fixed, 0 ignored
No vulnerabilities found

With bash-completion installed:

 ✔ Vulnerability DB                [no update available]
 ✔ Loaded image                                                                                                                                                                 dd56dbaea46f
 ✔ Parsed image                                                                                                      sha256:dd56dbaea46f5212cbc49f3f68d023f8084f9c05f894be49828cbebec7da0830
 ✔ Cataloged contents                                                                                                       eb044ca6d3b763ff5a1e187ea2725791a08bb6f183e5b8ad8fecabaa83166846
   ├── ✔ Packages                        [312 packages]
   ├── ✔ File digests                    [696 files]
   ├── ✔ File metadata                   [696 locations]
   └── ✔ Executables                     [78 executables]
 ✔ Scanned for vulnerabilities     [0 vulnerability matches]
   ├── by severity: 0 critical, 0 high, 0 medium, 0 low, 0 negligible
   └── by status:   0 fixed, 0 not-fixed, 0 ignored
No vulnerabilities found

188 files vs. 696 files and 188 locations vs. 696 locations

Release Note

Enabled `tetra` bash autocompletion in the Tetragon image

Signed-off-by: Philip Schmid <phisch@cisco.com>
@kkourt kkourt added the release-note/minor This PR introduces a minor user-visible change label Oct 1, 2024
@PhilipSchmid PhilipSchmid force-pushed the pr/philip/tetra_bash_completion branch from 99b1e1c to 3d0cd12 Compare October 1, 2024 12:41
@PhilipSchmid
Copy link
Collaborator Author

I think I found a nicer solution using an additional build stage:

$ grype 31cacc9ba92e
 ✔ Vulnerability DB                [no update available]
 ✔ Loaded image                                                                                                                                                                 31cacc9ba92e
 ✔ Parsed image                                                                                                      sha256:31cacc9ba92e4e388b31edbc214808fe2d53b4e972beb56b5e0892264c2a6e42
 ✔ Cataloged contents                                                                                                       478dd146768a114465cb0cc641c85387355ddabda8bc3690e082709533a6de92
   ├── ✔ Packages                        [310 packages]
   ├── ✔ File digests                    [188 files]
   ├── ✔ File metadata                   [188 locations]
   └── ✔ Executables                     [78 executables]
 ✔ Scanned for vulnerabilities     [0 vulnerability matches]
   ├── by severity: 0 critical, 0 high, 0 medium, 0 low, 0 negligible
   └── by status:   0 fixed, 0 not-fixed, 0 ignored
No vulnerabilities found
$ docker run --rm -it --entrypoint /bin/bash 31cacc9ba92e
328a2ed64090:/# ip
address     help        l2tp        maddress    mroute      neighbour   nexthop     route       stats       token       vrf
addrlabel   ila         link        monitor     mrule       netconf     ntable      rule        tap         tunnel      xfrm
fou         ioam        macsec      mptcp       neighbor    netns       ntbl        sr          tcpmetrics  tuntap
328a2ed64090:/# tetra
bugtool          (Produce a tar archive with debug information)                probe            (Probe for eBPF system features availability)
completion       (Generate the autocompletion script for the specified shell)  stacktrace-tree  (Manage stacktrace trees)
cri              (connect to CRI)                                              status           (Print health status)
getevents        (Print events)                                                tracingpolicy    (Manage tracing policies)
help             (Help about any command)                                      version          (Print version from CLI and server)
loglevel         (Get and dynamically change the log level)
328a2ed64090:/#

@PhilipSchmid PhilipSchmid marked this pull request as ready for review October 1, 2024 12:57
@PhilipSchmid PhilipSchmid requested a review from a team as a code owner October 1, 2024 12:57
@PhilipSchmid PhilipSchmid requested a review from tixxdz October 1, 2024 12:57
@PhilipSchmid
Copy link
Collaborator Author

I'll squash 982dc75 and 3d0cd12, if we agree using an additional multi-stage step is the better solution.

Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

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

Looks good, just a small comment to look before merging this. Adding a stage for completion is fine if it reducing the image size/number of files in the end, it's better like that!

@PhilipSchmid PhilipSchmid reopened this Oct 2, 2024
@PhilipSchmid PhilipSchmid force-pushed the pr/philip/tetra_bash_completion branch from cd5d3f8 to 66f171d Compare October 2, 2024 13:19
@PhilipSchmid PhilipSchmid removed the request for review from tixxdz October 2, 2024 13:30
@mtardy
Copy link
Member

mtardy commented Oct 2, 2024

did you want to squash 982dc75 and 66f171d or we merge as is?

Signed-off-by: Philip Schmid <phisch@cisco.com>
@PhilipSchmid PhilipSchmid force-pushed the pr/philip/tetra_bash_completion branch from 66f171d to ce932cd Compare October 2, 2024 15:20
@PhilipSchmid
Copy link
Collaborator Author

@mtardy Sure, thanks! I just squshed them.

Copy link

netlify bot commented Oct 2, 2024

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit ce932cd
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/66fd64b7f1e578000885fa14
😎 Deploy Preview https://deploy-preview-2965--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mtardy mtardy merged commit 3dd1378 into cilium:main Oct 2, 2024
43 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
release-note/minor This PR introduces a minor user-visible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants