Subversion Repositories DevTools

Rev

Rev 7277 | Rev 7286 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7260 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'
5
'   _iframe_build_logs.asp
6
'   This page is designed to be called from within an IFRAME
7
'
8
'   Locate log files for a specific build
9
'
10
'=====================================================
11
%>
12
<%
13
Option explicit
14
' Good idea to set when using redirect
15
Response.Expires = 0    ' always load the page, dont store
16
%>
17
<!--#include file="common/conf.asp"-->
18
<!--#include file="common/globals.asp"-->
19
<!--#include file="common/formating.asp"-->
20
<!--#include file="common/qstr.asp"-->
21
<!--#include file="common/common_subs.asp"-->
22
<!--#include file="common/_form_window_common.asp"-->
23
<%
24
'------------ ACCESS CONTROL ------------------
25
%>
26
<!--#include file="_access_control_general.asp"-->
27
<SCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="class/classaspJSON.vbs"></SCRIPT> 
28
<%
29
'------------ Variable Definition -------------
30
Dim rsTemp
31
Dim Query
32
Dim parRtagId
33
Dim parBuildRef
34
Dim MachineNames
35
Dim BuildInfo
36
Dim BuildLogs
37
Dim sMessage
38
 
39
'------------ Constants Declaration -----------
40
'------------ Variable Init -------------------
41
parRtagId = Request("rtag_id")
42
parBuildRef = Request("build_ref")
43
Set MachineNames = CreateObject("Scripting.Dictionary")
44
Set BuildLogs = CreateObject("Scripting.Dictionary")
45
Set BuildInfo = CreateObject("Scripting.Dictionary")
46
sMessage = NULL
47
'----------------------------------------------
48
'
49
'   Build up a dictionary of build machine names
50
'   Get all amchine names as the config may have changed since the log was created
51
'
52
Query = "select display_name, UPPER(MACHINE_HOSTNAME) as MACHINE_HOSTNAME FROM release_manager.build_machine_config"
53
Set rsTemp = OraDatabase.DbCreateDynaset(Query, cint(0))
54
While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
55
    Dim mName, dName
56
    MachineNames.Add CStr(rsTemp("MACHINE_HOSTNAME")), CStr(rsTemp("display_name"))   
57
    rsTemp.MoveNext
58
WEnd
59
rsTemp.Close
60
Set rsTemp = nothing
61
 
62
'
63
'   Build up a dictionary of build machine config in this release - as it is now
64
'
65
Query = "select display_name, daemon_mode, gbe_value, gbe_buildfilter " &_
66
			 " from release_manager.release_config rc," &_
67
			 "      release_manager.build_machine_config bm," &_
68
			 "      release_manager.gbe_machtype gbe" &_
69
			 " where rc.rtag_id=" & parRtagId &_
70
			 "      and rc.bmcon_id=bm.bmcon_id(+)" &_
7261 dpurdie 71
			 "      and rc.gbe_id=gbe.gbe_id" &_
72
			 "      and display_name is not NULL"
7260 dpurdie 73
Set rsTemp = OraDatabase.DbCreateDynaset( Query, ORADYN_DEFAULT )
74
 
75
Dim mData(3)
76
While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
77
	mData(0) = IIf (CStr(rsTemp("daemon_mode")) = "M", "Master", "Slave")
7277 dpurdie 78
	mData(1) = NiceCStr(rsTemp("gbe_value"), "") 
79
	mData(2) = NiceCStr(rsTemp("gbe_buildfilter"), "-Default-")
7260 dpurdie 80
    BuildInfo.Add CStr(rsTemp("display_name")), mData
81
    rsTemp.MoveNext
82
WEnd
83
rsTemp.Close
84
Set rsTemp = nothing
85
 
86
'----------------------------------------------
87
' Test that specified package/version exists in dpkg_archive
88
' Can also test presence of the archive
89
'   Use http interface as it does not require authetication
90
Sub testLogExistence(sBuildRef)
91
    Dim objXML
92
    Dim testUrl
93
    Dim jJSON
94
 
95
    testUrl = HTTP_PKG_ARCHIVE
96
    testUrl = testUrl & "/cgi-bin/getBuildLogs.pl"
97
    testUrl = testUrl & "?buildRef=" &  sBuildRef
98
    testUrl = testUrl & "&rtagId=" &  parRtagId
99
 
100
    Err.Clear
101
    On Error Resume Next
102
 
103
    Set objXML = CreateObject("MSXML2.ServerXMLHTTP.3.0")
104
    objXML.Open "GET", testUrl, False
105
    objXML.Send
106
 
107
    if Err.Number <> 0 then
108
        sMessage = Err.Description
109
        On Error Goto 0
110
    else
111
        On Error Goto 0
112
        If  objXML.status = 403 then
113
            sMessage = "Package Server Access Denied"
114
 
115
        ElseIf  objXML.status <> 200 then
116
            sMessage = "Internal Error: Code " & objXML.status
117
            'sMessage = objXML.responseText
118
        Else
119
            Set jJSON = New aspJSON
120
            jJSON.loadJSON( objXML.responseText )
121
 
122
            Dim txt
123
			txt = jJSON.data.item("error")
124
			If txt <> "" Then
125
                sMessage = txt
126
			Else
127
                Dim this, el
128
                Set this = jJSON.data.item("data") 
129
                For Each el in this.keys
130
                    Dim parts : parts = split( this(el), "/")
131
                    Dim mName : mName = parts(0)
132
                    Dim dName : dName = MachineNames.item(mName)
133
    				If dName = "" Then
134
    					dName = mName & "*"
135
                    End If
136
                    BuildLogs.Add dName , CStr(this(el))   
137
                    'Response.Write "<pre>Key: " & el & " Value: " & ABTLOG_URL & this(el)
138
                Next
139
                Set jJSON = nothing
140
                Set this = nothing
141
            End If
142
       End If
143
    End If
144
    Set objXML = nothing
145
End Sub
146
 
147
'--- Bfore Render ---------------
148
testLogExistence(parBuildRef )
149
'----------------------------------------------
150
%>
151
<html>
152
<head>
153
<title>Release Manager</title>
154
<link rel="shortcut icon" href="<%=FavIcon%>"/>
155
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
156
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
157
<link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
158
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
159
<!--#include file="_jquery_includes.asp"-->
160
<script language="javascript">
161
$(document).ready(function () {
162
    //  Cancel button must close this iFrame using a function provided by the parent
163
    $('#btn_cancel').on('click', function (e) {parent.closeIFrame()});
164
 
165
    // Kill the progress spinner
166
	$('#progressBar').hide();
167
});
168
</script>
169
</head>
170
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
171
<!----------------------------------------------------->
172
<!-- BODY ---->
173
<div class="panel tight">
174
	<div id='progressBar' class='vixSpinner' ></div>
175
	<div class='controlPanel'>
176
	<!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
177
	<%Call Messenger ( sMessage , 1, "100%" )%>
178
	<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
179
	</div>
180
	<div class=textPanel>
181
		A package is built on one or more build machines. Each build machine will produce a log of the build for the package.
182
		The logs are retained for about 10 days and then discarded.
183
	</div>
184
	<div class=listPanel>
185
	<table width="100%" border="0" cellspacing="1" cellpadding="1" class=stdGrey style="border-collapse: unset;">
186
	  <thead>
187
		<th nowrap>Build Machine</th>
188
		<th nowrap>Mode</th>
189
		<th nowrap>MACH_TYPE</th>
190
		<th nowrap>GBE_BUILDFILTER</th>
7281 dpurdie 191
		<th nowrap class=tight>Log</th>
7260 dpurdie 192
	  </thead>
193
		<%
194
        Dim sName, sPath, hRef, aBuildInfo, sMaster, sMachType, sFilter
195
		If BuildLogs.Count <= 0 Then%>
196
		<tr>
197
			<td>No Logs Found. They may have expired</td>
198
		</tr>
199
		<%Else
200
        For Each sName In BuildLogs.Keys
201
            sPath = BuildLogs.item(sName)
202
			hRef = ABTLOG_URL & "/" & sPath
203
            aBuildInfo = BuildInfo.item(sName)
204
			If TypeName(aBuildInfo) = "Variant()" Then
205
                sMaster = aBuildInfo(0) 
206
                sMachType = aBuildInfo(1) 
207
                sFilter = aBuildInfo(2)
208
            End If
209
			%>
210
			<tr>
7281 dpurdie 211
				<td><%=sName%></td>
7260 dpurdie 212
				<td><%=sMaster%></td>
213
				<td><%=sMachType%></td>
214
				<td><%=sFilter%></td>
7281 dpurdie 215
				<td class=tight><a title='Open log file in a new window' class='logIcon' href=<%=hRef%> target="_blank"></a></td>
7260 dpurdie 216
			</tr>
217
			<%
218
        Next
219
		End If%>
220
	</table>
221
	</div>
222
	<div class=buttonPanelWhite>
223
		<button id="btn_cancel" class="form_btn">Done</button>
224
	</div>
225
</body>
226
</html>
227
<%
228
Call Destroy_All_Objects
229
%>