rhtyd commented on a change in pull request #2627: Catch error in packagin 
script and fail the build
URL: https://github.com/apache/cloudstack/pull/2627#discussion_r186267387
 
 

 ##########
 File path: packaging/package.sh
 ##########
 @@ -162,11 +162,12 @@ 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
+        (cd $PWD/../; git reset --hard)
         echo "RPM Build Failed "
         exit 3
     else
+        (cd $PWD/../; git reset --hard)
 
 Review comment:
   Should the `git reset --hard` be part of the packaging script at all?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to