Building docker image....... /usr/bin/env: ‘sh\r’: No such file or directory execution failed
complete script
#!/bin/bash
echo "Building docker image......."
. gradle.properties
IMAGE="$dockerRegistry/$1"
IMAGE_TAG="$releaseVersion-$(git log -1 --pretty=%h)"
if ./gradlew clean :$1:jibDockerBuild -x test; then
echo "Pushing docker image...."
docker tag $IMAGE $IMAGE:$IMAGE_TAG
docker push $IMAGE:$IMAGE_TAG
else
echo "execution failed"
exit 1
fi
exit 0
$'\r'
is the carriage return. Your code is presumably saved as a DOS/Windows text file, not a UNIX one. DOS text files separate lines with aCRLF
sequence ($'\r\n'
), whereas UNIX text files end lines (including the last one) with a linefeed alone ($'\n'
). – Walhallaenv
orsh
. Maybe it's your copy ofgradlew
that's checked in that way? Either way, whichever program it is, the bug is as described above. – Walhallaset -x
to narrow down which command exactly fails your script. – Latinalatinate