mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
packaging: Catch error in packaging script and fail the build (#2627)
This is to fix the regression added in #2433. In this fix we're going to fail the build early if --use-timestamp is provided and working directory is *not* clean.
This commit is contained in:
parent
f77b1a7d00
commit
11075953f6
@ -162,11 +162,16 @@ function packaging() {
|
||||
cp "$PWD/$DISTRO/cloud.spec" "$RPMDIR/SPECS"
|
||||
|
||||
(cd "$RPMDIR"; rpmbuild --define "_topdir ${RPMDIR}" "${DEFVER}" "${DEFFULLVER}" "${DEFREL}" ${DEFPRE+"$DEFPRE"} ${DEFOSSNOSS+"$DEFOSSNOSS"} ${DEFSIM+"$DEFSIM"} -bb SPECS/cloud.spec)
|
||||
(cd $PWD/../; git reset --hard)
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ "$USE_TIMESTAMP" == "true" ]; then
|
||||
(cd $PWD/../; git reset --hard)
|
||||
fi
|
||||
echo "RPM Build Failed "
|
||||
exit 3
|
||||
else
|
||||
if [ "$USE_TIMESTAMP" == "true" ]; then
|
||||
(cd $PWD/../; git reset --hard)
|
||||
fi
|
||||
echo "RPM Build Done"
|
||||
fi
|
||||
exit
|
||||
@ -259,5 +264,16 @@ if [ -n "$unrecognized_flags" ]; then
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Fail early if working directory is NOT clean and --use-timestamp was provided
|
||||
if [ "$USE_TIMESTAMP" == "true" ]; then
|
||||
if [ -n "$(cd $PWD/../; git status -s)" ]; then
|
||||
echo "Erro: You have uncommitted changes and asked for --use-timestamp to be used."
|
||||
echo " --use-timestamp flag is going to temporarily change POM versions and"
|
||||
echo " revert them at the end of build, and there's no way we can do partial"
|
||||
echo " revert. Please commit your changes first or omit --use-timestamp flag."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Packaging CloudStack..."
|
||||
packaging "$PACKAGEVAL" "$SIM" "$TARGETDISTRO" "$RELEASE" "$BRANDING" "$USE_TIMESTAMP"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user