This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathrelease.sh
executable file
·141 lines (122 loc) · 3.72 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
usage() {
echo "Usage: $0 "
echo "[-v RELEASE_VERSION (required) (e.g. 1.0.0)]"
echo "[-d DEVELOPMENT_VERSION (required) (e.g. 1.0.1)]"
echo "[-r RELEASE_CANDIDATE (default: 1)]"
1>&2; exit 1;
}
while getopts ":v:d:r:" OPTION; do
case $OPTION in
v) export RELEASE_VERSION=${OPTARG};;
d) export DEVELOPMENT_VERSION=${OPTARG};;
r) export RELEASE_CANDIDATE=${OPTARG};;
\?) usage; exit 1;;
esac
done
if [ -z "${RELEASE_VERSION}" ]; then
echo "RELEASE_VERSION (-v) is not set!";
usage
exit 1;
fi
if [ -z "${DEVELOPMENT_VERSION}" ]; then
echo "DEVELOPMENT_VERSION (-d) is not set!";
exit 1;
fi
if [ -z "${RELEASE_CANDIDATE}" ]; then
echo "RELEASE_CANDIDATE (-r) is not set";
echo "Using default value '1'";
exit 1;
fi
if [ -z `which docker` ]; then
echo "docker is not configured!";
exit 1;
fi
if [ -z `which gpg` ]; then
echo "gpg is not configured!";
exit 1;
fi
if [ -z `which mvn` ]; then
echo "mvn is not configured!";
exit 1;
fi
mkdir -p /tmp/streams_release_repository
rm -rf /tmp/streams_release_repository/*
mkdir -p /tmp/streams_release_source
rm -rf /tmp/streams_release_source/*
mkdir -p /tmp/streams_release_logs
rm -rf /tmp/streams_release_logs/*
printInfo() {
echo "\n"
mvn -v
echo "\n"
docker -v
echo "\n"
docker info
echo "\n\n"
git status
git log | head
}
checkStatus() {
local output=$1
if [[ -z "$(tail $output | egrep 'BUILD SUCCESS')" ]]; then
echo "Release failed!"
echo "Check $output for more details."
exit 1;
fi
}
#streams
git clone https://github.com/apache/streams.git /tmp/streams_release_source
cd /tmp/streams_release_source
printInfo
set -x
mvn -Pcheck \
apache-rat:check \
-Drat.excludeSubprojects=false \
-e -DskipTests=true \
| tee /tmp/streams_release_logs/streams_ratcheck.txt
checkStatus /tmp/streams_release_logs/streams_ratcheck.txt
mvn clean test \
| tee /tmp/streams_release_logs/streams_unittests.txt
checkStatus /tmp/streams_release_logs/streams_unittests.txt
mvn -Papache-release \
release:prepare \
-DpushChanges=false \
-DautoVersionSubmodules=true \
-DreleaseVersion=${RELEASE_VERSION} \
-DdevelopmentVersion=${DEVELOPMENT_VERSION}-SNAPSHOT \
-Dtag=apache-streams-${RELEASE_VERSION}-rc${RELEASE_CANDIDATE} \
| tee /tmp/streams_release_logs/streams_release-prepare.txt
checkStatus /tmp/streams_release_logs/streams_release-prepare.txt
mvn -Papache-release \
clean install release:perform \
-Darguments='-Dmaven.test.skip.exec=true' \
-Dgoals=deploy \
-DlocalRepoDirectory=. \
-DlocalCheckout=true \
| tee /tmp/streams_release_logs/streams_release-perform.txt
checkStatus /tmp/streams_release_logs/streams_release-perform.txt
git push origin master
git push origin apache-streams-$REL
cd -
cat << EOM
##################################################################
RELEASE COMPLETE
##################################################################
EOM