This is an automated email from the ASF dual-hosted git repository.

slawrence pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/daffodil.git


The following commit(s) were added to refs/heads/master by this push:
     new d2c151f  Improve release candidate script handling of errors
d2c151f is described below

commit d2c151ff9a888bda16e73ebaca00c2dc94ad5e34
Author: Steve Lawrence <[email protected]>
AuthorDate: Fri May 14 15:57:31 2021 -0400

    Improve release candidate script handling of errors
    
    - Because of the use of `set -e`, any failure that occurs when running
      the daffodil-release-candidate script will immediately halt the
      script. This is the right behavior, but the failure may not create an
      obvious error message when the script just stops, so could be
      confusing to the user what happened. Additionally, it's not obvious
      what the release manager should do as a result of the failure. This
      traps ERR and calls a function that makes it very clear that an error
      occurred and directs the user what to do.
    - When committing changes to the website, it's possible there are no
      actual changes. This is very likely in the case of an rc2 where
      docs have already been updated in rc1. If there are no changes, `git
      commit` exits with a non-zero exit code, which causes processing to
      stop. To avoid this, check to see if there are any changes to commit,
      and only execute `git commit` if any are found.
    - Fix typo in "Committing site changes"
    - Replace "Delete" with "Drop" when referencing how to undo staged jars.
      This is the correct terminology that shows up at repository.apache.org
    
    DAFFODIL-2518
---
 .../release-candidate/daffodil-release-candidate   | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/containers/release-candidate/daffodil-release-candidate 
b/containers/release-candidate/daffodil-release-candidate
index 414c171..a9580e4 100755
--- a/containers/release-candidate/daffodil-release-candidate
+++ b/containers/release-candidate/daffodil-release-candidate
@@ -17,6 +17,21 @@
 
 set -e
 
+function trap_err {
+  echo
+  echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+  echo "!!! An error occurred while creating the release candidate !!!"
+  echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+  echo
+  echo "Perform the following steps:"
+  echo
+  echo "- Drop the staged files (if they exist) at 
https://repository.apache.org";
+  echo "- Type 'exit', fix the issues, and start over"
+  echo
+}
+
+trap 'trap_err' ERR
+
 function usage {
   BN=$(basename $0)
   cat <<USAGE >&2
@@ -244,9 +259,9 @@ git tag -as -u $PGP_SIGNING_KEY_ID -m "Release 
v$VERSION-$PRE_RELEASE" v$VERSION
 popd &> /dev/null
 
 pushd $DAFFODIL_SITE_DIR &> /dev/null
-echo "Comitting Site Changes..."
+echo "Committing Site Changes..."
 git add .
-git commit -m "Stage release v$VERSION-$PRE_RELEASE"
+git diff-index --quiet HEAD || git commit -m "Stage release 
v$VERSION-$PRE_RELEASE"
 popd &> /dev/null
 
 echo "Adding Release Files..."
@@ -290,8 +305,9 @@ EOF
   echo
   echo "If anything looks incorrect, do the following:"
   echo
-  echo "- Delete the staged files at https://repository.apache.org";
+  echo "- Drop the staged files at https://repository.apache.org";
   echo "- Type 'exit', fix the issues, and start over"
+  echo
 fi
 
 echo

Reply via email to