Skip to content

Commit

Permalink
Adjusted autogen script to have a stable length abbreviated hash
Browse files Browse the repository at this point in the history
Also check the hash to ensure it is unique or fail the script.

Ticket: ENT-10419
Changelog: none
  • Loading branch information
craigcomstock committed Aug 9, 2023
1 parent 8c7ab0d commit e1b4975
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions build-scripts/autogen
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,27 @@ for p in $projects
do
(cd $BASEDIR/$p && NO_CONFIGURE=1 ./autogen.sh) || false
done
# %h (abbreviated commit hash) is not deterministic for length on different systems
# so far (up to Aug 2023) this didn't matter because one system (bootstrap-oslo-dc)
# was responsible for doing this autogen work and all other systems used the result.
# When we migrated from travis to github actions we needed things to be stable between
# bootstrap-oslo-dc and other systems so will force a length of 7 and check that
# the result is unique.
export CORE_ABBREV=7 # adjust this up if need be
git config --global --add core.abbrev $CORE_ABBREV

for i in $GITSHAOF
do
if [ -d $BASEDIR/$i ] && [ ! -f $BASEDIR/$i/revision ]
then
R=$(cd $BASEDIR/$i && git log --pretty='format:%h' -1 -- .) || false
(
cd $BASEDIR/$i
if ! git show $R --oneline; then
echo "abbreviated commit hash of $CORE_ABBREV is not unique. Consider increasing the value in the script $0."
exit 1
fi
)
echo $R | tr -d '\n' > $BASEDIR/$i/revision
fi
done
Expand Down

0 comments on commit e1b4975

Please sign in to comment.