Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ for dir in "${directories[@]}"; do
dockerfile="$(git show "$commit:$dir/Dockerfile")"

# extract "FROM" and "GROOVY_VERSION" from Dockerfile
from="$(awk <<<"$dockerfile" 'toupper($1) == "FROM" { print $2; exit }')"
version="$(awk <<<"$dockerfile" -F '[=[:space:]]+' 'toupper($1) == "ENV" && $2 == "GROOVY_VERSION" { print $3; exit }')"
read -r from version <<<"$(awk <<<"$dockerfile" -F '[=[:space:]]+' '
toupper($1) == "FROM" && !from { from = $2 }
toupper($1) == "ENV" && $2 == "GROOVY_VERSION" && !version { version = $3 }
from && version { exit }
END { print from, version }
')"
# add a patch version of 0 if missing
if [[ "$version" =~ ^[0-9]+\.[0-9]+$ ]]; then
version="${version}.0"
Expand Down
Loading