Fix ODL restconf port if Compass
[releng.git] / utils / artifacts.opnfv.org.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Linux Foundation and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 #export PATH=${PATH}:/root/gsutil
12
13 #Step Generate index.html
14 if [ -f index.html ] ; then
15       rm -f index.html
16 fi
17
18 OUTPUT="index.html"
19
20 for index in $(gsutil ls -l gs://artifacts.opnfv.org | grep -v logs | grep -v review | awk 'NF==1'| sed s,gs://artifacts.opnfv.org/,,)
21 do
22 echo $index
23   echo "<LI><a href=\"${index%/*}.html\">"$index"</a></LI>" >> $OUTPUT
24 done
25
26 #functest logs##########################
27
28 for project in functest vswitchperf
29 do
30
31     for index in $(gsutil ls -l gs://artifacts.opnfv.org/logs/"$project"/ |awk 'NF==1'| sed s,gs://artifacts.opnfv.org/,, )
32     do
33     index="$(echo ${index%/*} | sed s,/,_,g)"
34       echo "<LI><a href=\"https://artifacts.opnfv.org/${index%/*}.html\">"$index"</a></LI>" >> $OUTPUT
35     done
36
37 done
38 #End step 1
39 #####################################
40
41
42 #genrate html files for all project except vswitchperf
43 for index in $(gsutil ls -l gs://artifacts.opnfv.org | grep -v logs |awk 'NF==1'| sed s,gs://artifacts.opnfv.org/,,)
44 do
45 OUTPUT=${index%/*}.html
46 rm -f $OUTPUT
47
48
49     for filepath in $(gsutil ls -R gs://artifacts.opnfv.org/"$index" | sed s,gs://artifacts.opnfv.org/,, | grep -v "favicon.ico" | grep -v "gsutil" ); do
50     echo $filepath
51
52     if [[ $filepath =~ "/:" ]]; then
53       path=$(echo $filepath| sed s,/:,,g)
54       echo "<UL>" >> $OUTPUT
55       echo "<LI>$path</LI>" >> $OUTPUT
56       echo "</UL>" >> $OUTPUT
57     else
58       echo "<LI><a href=\"https://artifacts.opnfv.org/$filepath\">"$filepath"</a></LI>" >> $OUTPUT
59     fi
60 done
61
62 gsutil cp $OUTPUT gs://artifacts.opnfv.org/
63
64 gsutil -m setmeta \
65      -h "Content-Type:text/html" \
66      -h "Cache-Control:private, max-age=0, no-transform" \
67       gs://artifacts.opnfv.org/$OUTPUT \
68
69 done
70
71
72
73 #generate file for vswitch perf (I dont know what happend here but there is a wierd character in this bucket)
74
75 index=vswitchperf
76 OUTPUT=${index%/*}.html
77 rm -f $OUTPUT
78
79         for filepath in $(gsutil ls -R gs://artifacts.opnfv.org/"$index" | sed s,gs://artifacts.opnfv.org/,, | grep -v "favicon.ico" | grep -v "gsutil" ); do
80         echo $filepath
81
82         if [[ $filepath =~ "/:" ]]; then
83           path=$(echo $filepath| sed s,/:,,g)
84           echo "<UL>" >> $OUTPUT
85           echo "<LI>$path</LI>" >> $OUTPUT
86           echo "</UL>" >> $OUTPUT
87         else
88           echo "<LI><a href=\"https://artifacts.opnfv.org/$filepath\">"$filepath"</a></LI>" >> $OUTPUT
89         fi
90
91 done
92
93
94 gsutil cp $OUTPUT gs://artifacts.opnfv.org/
95
96 gsutil -m setmeta \
97      -h "Content-Type:text/html" \
98      -h "Cache-Control:private, max-age=0, no-transform" \
99       gs://artifacts.opnfv.org/$OUTPUT \
100
101 # Gerate html for logs
102
103 for project in functest vswitchperf
104 do
105     for index in $(gsutil ls -l gs://artifacts.opnfv.org/logs/"$project"/ |awk 'NF==1'| sed s,gs://artifacts.opnfv.org/,, )
106     do
107
108         OUTPUT="$(echo ${index%/*}.html | sed s,/,_,g)"
109         echo $OUTPUT
110         rm -f $OUTPUT
111
112
113             for filepath in $(gsutil ls -R gs://artifacts.opnfv.org/"$index" | sed s,gs://artifacts.opnfv.org/,, | grep -v "favicon.ico" | grep -v "gsutil" ); do
114             echo $filepath
115
116             if [[ $filepath =~ "/:" ]]; then
117               path=$(echo $filepath| sed s,/:,,g)
118               echo "<UL>" >> $OUTPUT
119               echo "<LI>$path</LI>" >> $OUTPUT
120               echo "</UL>" >> $OUTPUT
121             else
122               echo "<LI><a href=\"https://artifacts.opnfv.org/$filepath\">"$filepath"</a></LI>" >> $OUTPUT
123             fi
124
125
126             done
127
128
129         gsutil cp $OUTPUT gs://artifacts.opnfv.org/
130
131         gsutil -m setmeta \
132              -h "Content-Type:text/html" \
133              -h "Cache-Control:private, max-age=0, no-transform" \
134               gs://artifacts.opnfv.org/$OUTPUT \
135
136
137     done
138 done
139
140
141
142 OUTPUT="index.html"
143 echo "<p> Generated on $(date) </p>" >> $OUTPUT
144
145 cat <<EOF >> $OUTPUT
146 <script>
147 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
148 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
149 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
150 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
151 ga('create', 'UA-831873-26', 'auto');
152 ga('send', 'pageview');
153 </script>
154 EOF
155
156 #copy and uplad index file genrated in first step, last
157 gsutil cp $OUTPUT gs://artifacts.opnfv.org/
158
159 gsutil -m setmeta \
160      -h "Content-Type:text/html" \
161      -h "Cache-Control:private, max-age=0, no-transform" \
162       gs://artifacts.opnfv.org/$OUTPUT \