kbendick commented on a change in pull request #3322:
URL: https://github.com/apache/iceberg/pull/3322#discussion_r732331761



##########
File path: dev/source-release.sh
##########
@@ -72,54 +77,73 @@ scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> 
/dev/null && pwd )"
 projectdir="$(dirname "$scriptdir")"
 tmpdir=$projectdir/tmp
 
-if [ -d $tmpdir ]; then
+if [ -d "$tmpdir" ]; then
   echo "Cannot run: $tmpdir already exists"
   exit 1
 fi
 
 tag="apache-iceberg-$version"
 tagrc="${tag}-rc${rc}"
 
+# Get original version hash to return to in test mode
+original_version_hash=$(git rev-list HEAD 2> /dev/null | head -n 1 )
+if [ $testing = true ]; then
+  echo "In test mode: will revert to current hash $original_version_hash when 
done"
+fi
+
 echo "Preparing source for $tagrc"
 
 echo "Adding version.txt and tagging release..."
-echo $version > $projectdir/version.txt
-git add $projectdir/version.txt
+echo "$version" > "$projectdir/version.txt"
+git add "$projectdir/version.txt"
 git commit -m "Add version.txt for release $version" $projectdir/version.txt
 
-set_version_hash=`git rev-list HEAD 2> /dev/null | head -n 1 `
+set_version_hash=$(git rev-list HEAD 2> /dev/null | head -n 1 )
+
+# We need to tag the release candidate, even in test mode, so the rest of the 
script works.
+echo "Tagging the release candidate"
 git tag -am "Apache Iceberg $version" $tagrc $set_version_hash
 
-echo "Pushing $tagrc to $remote..."
-git push $remote $tagrc
+# Only push the tag when we're not testing to keep remote environment pristine.
+if [ $testing != true ]; then
+  echo "Pushing $tagrc to $remote..."
+  git push $remote $tagrc
+else
+  echo "In test mode: Not pushing the tagged release candidate to $remote. A 
tarball will be available at the end"
+fi
 
-release_hash=`git rev-list $tagrc 2> /dev/null | head -n 1 `
+release_hash=$(git rev-list "$tagrc" 2> /dev/null | head -n 1 )

Review comment:
       Unrelated linter stuff. I think I'm gonna do the linter stuff in another 
PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to