Skip to content

Commit

Permalink
chore: keep downloads in target/
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossg committed Dec 19, 2024
1 parent 1a52f1e commit b572860
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/tests/target/
*.tmp
.idea
/target/
11 changes: 7 additions & 4 deletions publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ from_linux=eclipse-temurin-17

pattern="# common for all images"

tmpdir=./target
mkdir -p "$tmpdir"

# we need gnu-sed on macos
if prefix="$(brew --prefix gnu-sed 2>&1)" && [ -d "${prefix}/libexec/gnubin" ]; then
PATH="${prefix}/libexec/gnubin:$PATH"
Expand Down Expand Up @@ -46,15 +49,15 @@ find . -iname Dockerfile -exec grep -Hl "ARG uri=" {} \; | while read -r file; d
uri=$(grep "ARG uri=" "$file" | sed -e 's/ARG uri=//')
zip=$(grep "ARG zip=" "$file" | sed -e 's/ARG zip=//')
hash=$(grep "ARG hash=" "$file" | sed -e 's/ARG hash=//')
if ! [ -f "/tmp/$zip" ]; then
if ! [ -f "$tmpdir/$zip" ]; then
echo "Downloading: $uri/$zip"
curl -sSLf -o "/tmp/$zip" "$uri/$zip"
curl -sSLf -o "$tmpdir/$zip" "$uri/$zip"
fi
IFS=" " read -r -a new_hash <<<"$(sha256sum "/tmp/$zip")"
IFS=" " read -r -a new_hash <<<"$(sha256sum "$tmpdir/$zip")"
echo "$file $uri/$zip $hash ${new_hash[0]}"
sed -i -e "s/ARG hash=.*/ARG hash=${new_hash[0]}/" "$file"
echo "Extracting JAVA_HOME from $zip"
if ! java_home="$( (unzip -t "/tmp/$zip" || true) | grep -m 1 "testing: " | sed -e 's#.*testing: \(.*\)/.*#\1#')"; then
if ! java_home="$( (unzip -t "$tmpdir/$zip" || true) | grep -m 1 "testing: " | sed -e 's#.*testing: \(.*\)/.*#\1#')"; then
echo >&2 "Failed to extract JAVA_HOME"
exit 1
fi
Expand Down

0 comments on commit b572860

Please sign in to comment.