forked from jbosstm/narayana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
narayana-release-process.sh
executable file
·218 lines (204 loc) · 7.99 KB
/
narayana-release-process.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#!/bin/bash
# You can run this script with 0, 1 or 3 arguments.
# Arguments are then tranformed to env varibales CURRENT, NEXT and WFLYISSUE
# Release process releases version ${CURRENT} and prepares github with commits to ${NEXT}-SNAPSHOT
# If WFLYISSUE is not defined then script tries to create new jira with upgrade component.
#
# 0 argument: information about CURRENT, NEXT is taken from pom.xml, WFLYISSUE is ignored
# CURRENT is taken as what is version from pom.xml without '-SNAPSHOT' suffix,
# NEXT is CURRENT with increased micro version
# e.g. pom.xml talks about version 5.7.3.Final-SNAPSHOT, CURRENT is 5.7.3.Final and NEXT is 5.7.4.Final
# 1 argument: same as 0 argument but taken in care WFLYISSUE thus script don't try to create new issue
# 3 arguments: `./narayana-release-process.sh CURRENT NEXT WFLYISSUE`
if [[ $(uname) == CYGWIN* ]]
then
docker-machine env --shell bash
if [[ $? != 0 ]]; then
exit
fi
eval "$(docker-machine env --shell bash)"
read -p "ARE YOU RUNNING AN ELEVATED CMD PROMPT docker needs this" ELEV
if [[ $ELEV == n* ]]
then
exit
fi
fi
read -p "You will need: VPN, credentials for jbosstm@filemgmt, jira admin, github permissions on all jbosstm/ repo and nexus permissions. Do you have these?" ENVOK
if [[ $ENVOK == n* ]]
then
exit
fi
read -p "Have you configured ~/.m2/settings.xml with repository 'jboss-releases-repository' and correct username/password?" M2OK
if [[ $M2OK == n* ]]
then
exit
fi
command -v mvn >/dev/null 2>&1 || { echo >&2 "I require mvn but it's not installed. Aborting."; exit 1; }
command -v ant >/dev/null 2>&1 || { echo >&2 "I require ant but it's not installed. Aborting."; exit 1; }
command -v awestruct >/dev/null 2>&1 || { echo >&2 "I require awestruct (http://awestruct.org/getting_started) but it's not installed. Aborting."; exit 1; }
if [ $# -eq 0 ]; then
. scripts/pre-release-vars.sh
CURRENT=`echo $CURRENT_SNAPSHOT_VERSION | sed "s/-SNAPSHOT//"`
NEXT=`echo $CURRENT_SNAPSHOT_VERSION | sed "s/.Final//"`
NEXT="${NEXT%.*}.$((${NEXT##*.}+1))".Final
elif [ $# -eq 1 ]; then
. scripts/pre-release-vars.sh
CURRENT=`echo $CURRENT_SNAPSHOT_VERSION | sed "s/-SNAPSHOT//"`
NEXT=`echo $CURRENT_SNAPSHOT_VERSION | sed "s/.Final//"`
NEXT="${NEXT%.*}.$((${NEXT##*.}+1))".Final
WFLYISSUE=$1
elif [ $# -lt 2 ]; then
echo 1>&2 "$0: not enough arguments: CURRENT NEXT <WFLYISSUE>(versions should end in .Final or similar)"
exit 2
elif [ $# -gt 3 ]; then
echo 1>&2 "$0: too many arguments: CURRENT NEXT <WFLYISSUE>(versions should end in .Final or similar)"
exit 2
else
CURRENT=$1
NEXT=$2
WFLYISSUE=$3
fi
set +e
git fetch upstream --tags
git tag | grep $CURRENT
if [[ $? != 0 ]]
then
set -e
JENKINS_JOBS=narayana,narayana-catelyn,narayana-codeCoverage,narayana-documentation,narayana-hqstore,narayana-jdbcobjectstore,narayana-quickstarts,narayana-quickstarts-catelyn ./scripts/release/pre_release.py
set +e
git status | grep "nothing to commit"
if [[ $? != 0 ]]
then
git status
exit
fi
git status | grep "ahead"
if [[ $? != 1 ]]
then
git status
exit
fi
git log -n 5
read -p "Did the log before look OK?" ok
if [[ $ok == n* ]]
then
exit
fi
set -e
(cd ./scripts/ ; ./pre-release.sh $CURRENT $NEXT)
git fetch upstream --tags
#./scripts/release/update_jira.py -k JBTM -t 5.next -n $CURRENT
else
set -e
fi
if [ -z "$WFLYISSUE" ]
then
#./scripts/release/update_upstream.py -s WFLY -n $CURRENT
read -p "Enter WFLY issue: " WFLYISSUE
if [ ! -d "jboss-as" ]
then
(git clone [email protected]:jbosstm/jboss-as.git -o jbosstm; cd jboss-as; git remote add upstream [email protected]:wildfly/wildfly.git)
fi
(cd jboss-as; git fetch upstream; git checkout -b ${WFLYISSUE}; git reset --hard upstream/master)
cd jboss-as
CURRENT_VERSION_IN_WFLY=`grep 'narayana>' pom.xml | cut -d \< -f 2|cut -d \> -f 2`
if [[ $(uname) == CYGWIN* ]]
then
sed -i "s/narayana>$CURRENT_VERSION_IN_WFLY/narayana>$CURRENT/g" pom.xml
else
sed -i "" "s/narayana>$CURRENT_VERSION_IN_WFLY/narayana>$CURRENT/g" pom.xml
fi
git add pom.xml
git commit -m "${WFLYISSUE} Upgrade Narayana to $CURRENT"
git push --set-upstream jbosstm ${WFLYISSUE}
git checkout 5_BRANCH
git reset --hard jbosstm/5_BRANCH
cd -
fi
cd ~/tmp/narayana/$CURRENT/sources/documentation/
git checkout $CURRENT
if [[ $? != 0 ]]
then
echo 1>&2 documentation: Tag '$CURRENT' did not exist
exit
fi
rm -rf $PWD/localm2repo
mvn clean install -Dmaven.repo.local=${PWD}/localm2repo -Prelease
rm -rf $PWD/localrepo
cd -
cd ~/tmp/narayana/$CURRENT/sources/narayana/
git checkout $CURRENT
if [[ $? != 0 ]]
then
echo 1>&2 narayana: Tag '$CURRENT' did not exist
exit
fi
MAVEN_OPTS="-XX:MaxPermSize=512m"
if [[ $(uname) == CYGWIN* ]]
then
ORSON_PATH=`cygpath -w $PWD/ext/`
else
ORSON_PATH=$PWD/ext/
fi
rm -rf $PWD/localm2repo
mvn clean install -Dmaven.repo.local=${PWD}/localm2repo -DskipTests -gs tools/maven/conf/settings.xml -Dorson.jar.location=$ORSON_PATH -Pcommunity
if [[ $? != 0 ]]
then
echo 1>&2 Could not install narayana
exit
fi
mvn clean deploy -Dmaven.repo.local=${PWD}/localm2repo -DskipTests -gs tools/maven/conf/settings.xml -Dorson.jar.location=$ORSON_PATH -Prelease,community
if [[ $? != 0 ]]
then
echo 1>&2 Could not deploy narayana to nexus
exit
fi
mvn clean deploy -Dmaven.repo.local=${PWD}/localm2repo -DskipTests -gs tools/maven/conf/settings.xml -Prelease -f blacktie/utils/cpp-plugin/pom.xml
if [[ $? != 0 ]]
then
echo 1>&2 Could not deploy blacktie cpp-plugin to nexus
exit
fi
mvn clean deploy -Dmaven.repo.local=${PWD}/localm2repo -DskipTests -gs tools/maven/conf/settings.xml -Prelease -f blacktie/pom.xml -pl :blacktie-jatmibroker-nbf -am
if [[ $? != 0 ]]
then
echo 1>&2 Could not deploy jatmibroker to nexus
exit
fi
git archive -o ../../narayana-full-$CURRENT-src.zip $CURRENT
ant -f build-release-pkgs.xml -Dawestruct.executable="awestruct" all
if [[ $? != 0 ]]
then
echo 1>&2 COULD NOT BUILD Narayana RELEASE PKGS
exit
fi
cd -
echo "build and retrieve the centos54x64 and vc9x32 binaries from http://narayanaci1.eng.hst.ams2.redhat.com/view/Release/"
wget --post-data='json={"parameter": {"name": "TAG_NAME", "value": "'${CURRENT}'"}, "parameter": {"name": "WFLY_PR_BRANCH", "value": "'master'"}}' http://narayanaci1.eng.hst.ams2.redhat.com/view/Release/job/release-narayana/build?delay=0sec
wget --post-data='json={"parameter": {"name": "TAG_NAME", "value": "'${CURRENT}'"}, "parameter": {"name": "WFLY_PR_BRANCH", "value": "'master'"}}' http://narayanaci1.eng.hst.ams2.redhat.com/view/Release/job/release-narayana-catelyn/build?delay=0sec
echo "Press enter when the artifacts are available"
read
wget http://narayanaci1.eng.hst.ams2.redhat.com/view/Release/job/release-narayana/lastSuccessfulBuild/artifact/blacktie/blacktie/target/blacktie-${CURRENT}-centos54x64-bin.tar.gz
wget http://narayanaci1.eng.hst.ams2.redhat.com/view/Release/job/release-narayana-catelyn/lastSuccessfulBuild/artifact/blacktie/blacktie/target/blacktie-${CURRENT}-vc9x32-bin.zip
scp blacktie-${CURRENT}-centos54x64-bin.tar.gz [email protected]:/downloads_htdocs/jbosstm/${CURRENT}/binary/
scp blacktie-${CURRENT}-vc9x32-bin.zip [email protected]:/downloads_htdocs/jbosstm/${CURRENT}/binary/
# Building and pushing the lra coordinator docker image
read -p "You will need: docker.io account with permission to push under https://hub.docker.com/u/jbosstm/. Do you have these? y/n: " ENVOK
if [[ $ENVOK == n* ]]
then
exit
fi
docker login docker.io
[ $? -ne 0 ] && echo "Login to docker.io was not succesful" && exit
cd ~/tmp/narayana/$CURRENT/sources/jboss-dockerfiles/lra/lra-coordinator
git checkout $CURRENT
if [[ $? != 0 ]]
then
echo 1>&2 jboss-dockerfiles: Tag $CURRENT did not exist
exit
fi
docker build -t lra-coordinator --build-arg NARAYANA_VERSION=${CURRENT} .
docker tag lra-coordinator:latest docker.io/jbosstm/lra-coordinator:${CURRENT}
docker tag lra-coordinator:latest docker.io/jbosstm/lra-coordinator:latest
docker push docker.io/jbosstm/lra-coordinator:${CURRENT}
docker push docker.io/jbosstm/lra-coordinator:latest