Skip to content

Commit 69ba9b6

Browse files
committed
[SPARK-31860][BUILD] only push release tags on succes
### What changes were proposed in this pull request? Only push the release tag after the build has finished. ### Why are the changes needed? If the build fails we don't need a release tag. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Running locally with a fake user in #28667 Closes #28700 from holdenk/SPARK-31860-build-master-only-push-tags-on-success. Authored-by: Holden Karau <hkarau@apple.com> Signed-off-by: Holden Karau <hkarau@apple.com>
1 parent e5c3463 commit 69ba9b6

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

dev/create-release/do-release.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# limitations under the License.
1818
#
1919

20+
set -e
21+
2022
SELF=$(cd $(dirname $0) && pwd)
2123
. "$SELF/release-util.sh"
2224

@@ -52,9 +54,6 @@ function should_build {
5254
if should_build "tag" && [ $SKIP_TAG = 0 ]; then
5355
run_silent "Creating release tag $RELEASE_TAG..." "tag.log" \
5456
"$SELF/release-tag.sh"
55-
echo "It may take some time for the tag to be synchronized to github."
56-
echo "Press enter when you've verified that the new tag ($RELEASE_TAG) is available."
57-
read
5857
else
5958
echo "Skipping tag creation for $RELEASE_TAG."
6059
fi
@@ -79,3 +78,12 @@ if should_build "publish"; then
7978
else
8079
echo "Skipping publish step."
8180
fi
81+
82+
if should_build "tag" && [ $SKIP_TAG = 0 ]; then
83+
git push origin $RELEASE_TAG
84+
if [[ $RELEASE_TAG != *"preview"* ]]; then
85+
git push origin HEAD:$GIT_BRANCH
86+
else
87+
echo "It's preview release. We only push $RELEASE_TAG to remote."
88+
fi
89+
fi

dev/create-release/release-build.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ BASE_DIR=$(pwd)
9292
init_java
9393
init_maven_sbt
9494

95-
rm -rf spark
96-
git clone "$ASF_REPO"
95+
# Only clone repo fresh if not present, otherwise use checkout from the tag step
96+
if [ ! -d spark ]; then
97+
git clone "$ASF_REPO"
98+
fi
9799
cd spark
100+
git fetch
98101
git checkout $GIT_REF
99102
git_hash=`git rev-parse --short HEAD`
100103
echo "Checked out Spark git hash $git_hash"

dev/create-release/release-tag.sh

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function exit_with_usage {
2525
cat << EOF
2626
usage: $NAME
2727
Tags a Spark release on a particular branch.
28+
You must push the tags after.
2829
2930
Inputs are specified with the following environment variables:
3031
ASF_USERNAME - Apache Username
@@ -105,19 +106,8 @@ sed -i".tmp7" 's/SPARK_VERSION_SHORT:.*$/SPARK_VERSION_SHORT: '"$R_NEXT_VERSION"
105106

106107
git commit -a -m "Preparing development version $NEXT_VERSION"
107108

108-
if ! is_dry_run; then
109-
# Push changes
110-
git push origin $RELEASE_TAG
111-
if [[ $RELEASE_VERSION != *"preview"* ]]; then
112-
git push origin HEAD:$GIT_BRANCH
113-
else
114-
echo "It's preview release. We only push $RELEASE_TAG to remote."
115-
fi
116-
117-
cd ..
118-
rm -rf spark
119-
else
120-
cd ..
109+
cd ..
110+
if is_dry_run; then
121111
mv spark spark.tag
122112
echo "Clone with version changes and tag available as spark.tag in the output directory."
123113
fi

0 commit comments

Comments
 (0)