build: modify build-docker.sh to behave nicely with things that are not branches

pull/2936/head core/bl2.1.0
matejcik 1 year ago
parent 5e0a2ed6d0
commit 1890e3c04d

@ -128,6 +128,7 @@ if [ "$OPT_BUILD_LEGACY" -eq 1 ]; then
fi fi
TAG="$1" TAG="$1"
COMMIT_HASH="$(git rev-parse "$TAG")"
PRODUCTION=${PRODUCTION:-1} PRODUCTION=${PRODUCTION:-1}
if which wget > /dev/null ; then if which wget > /dev/null ; then
@ -202,14 +203,13 @@ fi # init
# append common part to script # append common part to script
cat <<EOF >> "$SCRIPT_NAME" cat <<EOF >> "$SCRIPT_NAME"
$GIT_CLEAN_REPO $GIT_CLEAN_REPO
git fetch origin "$TAG" git fetch origin "$COMMIT_HASH"
git checkout -B "$TAG" "origin/$TAG" git checkout "$COMMIT_HASH"
git submodule update --init --recursive git submodule update --init --recursive
poetry install poetry install
cd core/embed/rust cd core/embed/rust
cargo fetch cargo fetch
git rev-parse HEAD > /build/git-rev
echo echo
echo ">>> AT COMMIT \$(git rev-parse HEAD)" echo ">>> AT COMMIT \$(git rev-parse HEAD)"
echo echo
@ -341,7 +341,7 @@ echo " docker rmi $SNAPSHOT_NAME"
# all built, show fingerprints # all built, show fingerprints
echo echo
echo "Built from commit $(cat build/git-rev)" echo "Built from commit $COMMIT_HASH"
echo echo
echo "Fingerprints:" echo "Fingerprints:"
for VARIANT in core legacy; do for VARIANT in core legacy; do

Loading…
Cancel
Save