summaryrefslogtreecommitdiffstats
path: root/jenkins-builds/promote-latest-builds.sh
blob: 519ef826339fa4cbeaa9f0e810598cb288eebc37 (plain)
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#! /bin/bash

##
#
# Will end up with an aggregated folder, webstart enabled,
# but not pack200 compressed and not signed.
#
# promote-latest-builds.sh <branch-name> [secure]
#
##

branch=$1
shift
if [ ! -z "$1" ] ; then
    option=$1
    shift
fi
let secure=0
if [ "$option" == "secure" ] ; then
    let secure=1
fi

version=autobuild

sdir=`dirname $0`

thisdir=`pwd`

logfile=$thisdir/`basename $0 .sh`.log

. $sdir/funcs_promotion.sh
. $sdir/../deployment/funcs_jnlp_relocate.sh

archivedir=/srv/www/jogamp.org/deployment/archive/$branch
rootdir=/srv/www/jogamp.org/deployment/autobuilds/$branch

os_and_archs_minus_one="linux-i586 linux-armv6 linux-armv6hf android-armv6 android-aarch64 macosx-universal windows-amd64 windows-i586 solaris-i586 solaris-amd64"
masterpick="linux-amd64"
os_and_archs="$masterpick $os_and_archs_minus_one"

cd $rootdir

dest=tmp-archive
rm -rf $dest

function promote-latest-builds() {
    echo
    echo "Promotion of latest files"
    echo
    echo "  branch: $branch"
    echo "  option: $option"
    echo "    secure: $secure"
    echo
    echo `date`
    echo
    prom_setup $dest

    gluegenslave=`prom_lslatest gluegen-b`
    bgluegenslave=`prom_buildnumber_2 $gluegenslave`
    gluegenmaster=`prom_lslatest gluegen-master-b`
    bgluegenmaster=`prom_buildnumber_3 $gluegenmaster`
    echo
    echo GLUEGEN
    echo
    echo slave  build $bgluegenslave - $gluegenslave
    echo master build $bgluegenmaster - $gluegenmaster
    echo
    echo "gluegen.build.number=$bgluegenslave" >> $dest/log/aggregated.artifact.properties

    prom_promote_module gluegen $gluegenslave $dest

    cp -a $gluegenmaster/artifact.properties $dest/log/gluegen-master.artifact.properties
    cp -a $gluegenmaster/javadoc.7z $dest/archive/gluegen-javadoc.7z
    cd $dest/javadoc
    echo "INFO: gluegen master gluegen-javadoc 7z"
    prom_extract ../archive/gluegen-javadoc.7z gluegen
    cd $rootdir

    joalslave=`prom_lslatest joal-b`
    bjoalslave=`prom_buildnumber_2 $joalslave`
    joalmaster=`prom_lslatest joal-master-b`
    bjoalmaster=`prom_buildnumber_3 $joalmaster`
    echo
    echo JOAL
    echo
    echo slave  build $bjoalslave - $joalslave
    echo master build $bjoalmaster - $joalmaster
    echo
    echo "joal.build.number=$bjoalslave" >> $dest/log/aggregated.artifact.properties

    prom_promote_module joal $joalslave $dest
    
    cp -a $joalmaster/artifact.properties $dest/log/joal-master.artifact.properties
    cp -a $joalmaster/javadoc.7z $dest/archive/joal-javadoc.7z
    cd $dest/javadoc
    prom_extract ../archive/joal-javadoc.7z joal
    cd $rootdir

    joaldemosslave=`prom_lslatest joal-demos-b`
    bjoaldemosslave=`prom_buildnumber_3 $joaldemosslave`
    joaldemosmaster=`prom_lslatest joal-demos-master-b`
    bjoaldemosmaster=`prom_buildnumber_4 $joaldemosmaster`
    echo
    echo JOAL DEMOS
    echo
    echo slave   build $bjoaldemosslave - $joaldemosslave
    echo
    echo "joal-demos.build.number=$bjoaldemosslave" >> $dest/log/aggregated.artifact.properties

    cp -a $joaldemosslave/artifact.properties $dest/log/joal-demos.artifact.properties

    prom_promote_demos joal-demos slave $joaldemosslave $dest

    joglslave=`prom_lslatest jogl-b`
    bjoglslave=`prom_buildnumber_2 $joglslave`
    joglmaster=`prom_lslatest jogl-master-b`
    bjoglmaster=`prom_buildnumber_3 $joglmaster`
    echo
    echo JOGL
    echo
    echo slave  build $bjoglslave - $joglslave
    echo master build $bjoglmaster - $joglmaster
    echo
    echo "jogl.build.number=$bjoglslave" >> $dest/log/aggregated.artifact.properties

    prom_promote_module jogl $joglslave $dest

    cp -a $joglmaster/artifact.properties $dest/log/jogl-master.artifact.properties
    cp -a $joglmaster/javadoc.7z $dest/archive/jogl-javadoc.7z
    cd $dest/javadoc
    prom_extract ../archive/jogl-javadoc.7z jogl
    cd $rootdir

    jogldemosslave=`prom_lslatest jogl-demos-b`
    bjogldemosslave=`prom_buildnumber_3 $jogldemosslave`
    jogldemosmaster=`prom_lslatest jogl-demos-master-b`
    bjogldemosmaster=`prom_buildnumber_4 $jogldemosmaster`
    echo
    echo JOGL DEMOS
    echo
    echo slave   build $bjogldemosslave - $jogldemosslave
    echo master  build $bjogldemosmaster - $jogldemosmaster
    echo
    echo "jogl-demos.build.number=$bjogldemosslave" >> $dest/log/aggregated.artifact.properties
    echo "jogl-demos.build.number=$bjogldemosmaster" >> $dest/log/aggregated.artifact.properties

    cp -a $jogldemosslave/artifact.properties $dest/log/jogl-demos.artifact.properties
    grep jogl-demos.build.branch $jogldemosmaster/artifact.properties >> $dest/log/jogl-demos.artifact.properties
    grep jogl-demos.build.commit $jogldemosmaster/artifact.properties >> $dest/log/jogl-demos.artifact.properties

    prom_promote_demos jogl-demos master $jogldemosmaster $dest

    joclslave=`prom_lslatest jocl-b`
    bjoclslave=`prom_buildnumber_2 $joclslave`
    joclmaster=`prom_lslatest jocl-master-b`
    bjoclmaster=`prom_buildnumber_3 $joclmaster`
    echo
    echo JOCL
    echo
    echo slave  build $bjoclslave - $joclslave
    echo master build $bjoclmaster - $joclmaster
    echo
    echo "jocl.build.number=$bjoclslave" >> $dest/log/aggregated.artifact.properties

    prom_promote_module jocl $joclslave $dest
    
    cp -a $joclmaster/artifact.properties $dest/log/jocl-master.artifact.properties
    cp -a $joclmaster/javadoc.7z $dest/archive/jocl-javadoc.7z
    cd $dest/javadoc
    prom_extract ../archive/jocl-javadoc.7z jocl
    cd $rootdir

    jocldemosslave=`prom_lslatest jocl-demos-b`
    bjocldemosslave=`prom_buildnumber_3 $jocldemosslave`
    echo
    echo JOCL DEMOS
    echo
    echo slave  build $bjocldemosslave - $jocldemosslave
    echo
    echo "jocl-demos.build.number=$bjocldemosslave" >> $dest/log/aggregated.artifact.properties

    cp -a $jocldemosslave/artifact.properties $dest/log/jocl-demos.artifact.properties

    prom_promote_demos jocl-demos slave $jocldemosslave $dest

    #########################################################
    ## Integrity Check, Cleanup, aggregation.properties
    #########################################################

    prom_integrity_check $dest jar            tmp/dump
    prom_integrity_check $dest jar/atomic     tmp/dump
    prom_integrity_check $dest apk            tmp/dump
    prom_integrity_check $dest joal-demos/jar tmp/dump
    prom_integrity_check $dest jogl-demos/jar tmp/dump
    prom_integrity_check $dest jocl-demos/jar tmp/dump

    cd $dest

    echo
    echo aggregation.properties
    echo
    dos2unix log/gluegen.artifact.properties
    dos2unix log/joal.artifact.properties
    dos2unix log/joal-demos.artifact.properties
    dos2unix log/jogl.artifact.properties
    dos2unix log/jogl-demos.artifact.properties
    dos2unix log/jocl.artifact.properties
    dos2unix log/jocl-demos.artifact.properties
    cat log/gluegen.artifact.properties    \
        log/joal.artifact.properties       \
        log/joal-demos.artifact.properties \
        log/jogl.artifact.properties       \
        log/jogl-demos.artifact.properties \
        log/jocl.artifact.properties       \
        log/jocl-demos.artifact.properties \
        | sort -u > log/all.artifact.properties.sorted

    dos2unix log/aggregated.artifact.properties
    sort -u log/aggregated.artifact.properties > log/aggregated.artifact.properties.sorted

    diff -Nurbw log/aggregated.artifact.properties.sorted log/all.artifact.properties.sorted | tee log/all.artifact.properties.diff

    cd $rootdir

    prom_merge_modules $dest gluegen joal jogl jocl

    prom_cleanup $dest

    uri=gluegen_$bgluegenslave-joal_$bjoalslave-jogl_$bjoglslave-jocl_$bjoclslave
    url=http://jogamp.org/deployment/archive/$branch/gluegen_$bgluegenslave-joal_$bjoalslave-jogl_$bjoglslave-jocl_$bjoclslave
    wsdir=$archivedir/gluegen_$bgluegenslave-joal_$bjoalslave-jogl_$bjoglslave-jocl_$bjoclslave

    rm -rf $wsdir
    mv $dest $wsdir

    cd $wsdir

    copy_relocate_jnlps_base  $version $url $wsdir
    copy_relocate_jnlps_demos $version $url $wsdir joal-demos
    copy_relocate_jnlps_demos $version $url $wsdir jogl-demos
    copy_relocate_jnlps_demos $version $url $wsdir jocl-demos

    if [ $secure -ne 1 ] ; then
        remove_security_tag_jnlps $wsdir
    fi

    echo
    echo Aggregation folder $wsdir for URL $url
    echo

    cp -av ../util/unsigned/applet-launcher.jar jar/
    cp -av ../util/unsigned/junit.* jar/

    local OK=1
    grep ERROR $logfile && OK=0
    if [ $OK -eq 0 ] ; then
        echo ERRORS occured - please check $logfile for ERROR
    else
        echo NO ERRORS detected
    fi

    mv $logfile $wsdir/log/
}

rm -f $logfile
promote-latest-builds 2>&1 | tee $logfile