Skip to content

Commit

Permalink
add script to list versions in all dockerfiles
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <[email protected]>
  • Loading branch information
lachlan-roberts committed Jun 28, 2022
1 parent c4346b6 commit 7409c15
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions showVersions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

paths=( "$@" )
if [ ${#paths[@]} -eq 0 ]; then
paths=( $(find -mindepth 4 -maxdepth 5 -name "Dockerfile" | sed -e 's/\.\///' | sed -e 's/\/Dockerfile//' | sort -nr) )
fi
paths=( "${paths[@]%/}" )

declare -A versionToPaths
for path in "${paths[@]}"; do
version=$(cat "$path"/Dockerfile | egrep "ENV JETTY_VERSION" | sed "s|.*ENV JETTY_VERSION \(.*\)|\1|")
versionToPaths["$version"]+=" $path"
done

for version in "${!versionToPaths[@]}"; do
echo "Version: $version"
paths=( "${versionToPaths[$version]}" )
for path in $paths; do
echo " - $path"
done
done

0 comments on commit 7409c15

Please sign in to comment.