debug: add a script for investigating a jar - #1945
Conversation
BradLugo
left a comment
There was a problem hiding this comment.
Thanks for taking the time to publish this! I love debug tooling.
One more consideration I wanted to note: what happens in the case of whiteout files? Maybe not something worth worrying about, but I was curious.
I'd really like the env change so I can use this on my NixOS machine 🙂
| @@ -0,0 +1,106 @@ | |||
| #!/usr/bin/zsh | |||
There was a problem hiding this comment.
| #!/usr/bin/zsh | |
| #!/usr/bin/env zsh |
| # Find the jars across all the layers. | ||
| # | ||
| # Keeping an array and a map means when the list is presented in the next step, | ||
| # they're in the "correct" order: newer layers first. | ||
| local -a jarlist | ||
| local -A jarlayer | ||
| for l in $layers; do | ||
| tar taf ${opts[--ocidir]}/blobs/${l/://} | | ||
| grep -E '\.[jwe]ar$' | | ||
| while read -r n; do | ||
| jarlist+=($n) | ||
| jarlayer[$n]=$l | ||
| done | ||
| done |
There was a problem hiding this comment.
What happens when a jar is "overwritten" in another layer?
There was a problem hiding this comment.
I think this will only allow you to select the earliest file with a given path. We could fix this if it ever comes up, or I can hack at it some more.
Yeah, this doesn't contend with whiteouts at all. The idea is that a user of this script knows what to investigate; this just bundles it all up. |
This script automates the process of extracting a jar from an OCI image and running the `java/jar` "TestJAR" test against it. Signed-off-by: Hank Donnay <hdonnay@redhat.com> Change-Id: Ic17aafc00fd67d9c0964806f23ace5de6a6a6964
This script automates the process of extracting a jar from an OCI image and running the
java/jar"TestJAR" test against it.