%@LANGUAGE="VBSCRIPT"%> <% '===================================================== ' ' _iframe_build_logs.asp ' This page is designed to be called from within an IFRAME ' ' Locate log files for a specific build ' '===================================================== %> <% Option explicit ' Good idea to set when using redirect Response.Expires = 0 ' always load the page, dont store %> <% '------------ ACCESS CONTROL ------------------ %> <% '------------ Variable Definition ------------- Dim rsTemp Dim Query Dim parRtagId Dim parBuildRef Dim MachineNames Dim BuildInfo Dim BuildLogs Dim sMessage '------------ Constants Declaration ----------- '------------ Variable Init ------------------- parRtagId = Request("rtag_id") parBuildRef = Request("build_ref") Set MachineNames = CreateObject("Scripting.Dictionary") Set BuildLogs = CreateObject("Scripting.Dictionary") Set BuildInfo = CreateObject("Scripting.Dictionary") sMessage = NULL '---------------------------------------------- ' ' Build up a dictionary of build machine names ' Get all amchine names as the config may have changed since the log was created ' Query = "select display_name, UPPER(MACHINE_HOSTNAME) as MACHINE_HOSTNAME FROM release_manager.build_machine_config" Set rsTemp = OraDatabase.DbCreateDynaset(Query, cint(0)) While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Dim mName, dName MachineNames.Add CStr(rsTemp("MACHINE_HOSTNAME")), CStr(rsTemp("display_name")) rsTemp.MoveNext WEnd rsTemp.Close Set rsTemp = nothing ' ' Build up a dictionary of build machine config in this release - as it is now ' Query = "select display_name, daemon_mode, gbe_value, gbe_buildfilter " &_ " from release_manager.release_config rc," &_ " release_manager.build_machine_config bm," &_ " release_manager.gbe_machtype gbe" &_ " where rc.rtag_id=" & parRtagId &_ " and rc.bmcon_id=bm.bmcon_id(+)" &_ " and rc.gbe_id=gbe.gbe_id" &_ " and display_name is not NULL" Set rsTemp = OraDatabase.DbCreateDynaset( Query, ORADYN_DEFAULT ) Dim mData(3) While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) mData(0) = IIf (CStr(rsTemp("daemon_mode")) = "M", "Master", "Slave") mData(1) = NiceCStr(rsTemp("gbe_value"), "") mData(2) = NiceCStr(rsTemp("gbe_buildfilter"), "-Default-") BuildInfo.Add CStr(rsTemp("display_name")), mData rsTemp.MoveNext WEnd rsTemp.Close Set rsTemp = nothing '---------------------------------------------- ' Test that specified package/version exists in dpkg_archive ' Can also test presence of the archive ' Use http interface as it does not require authetication Sub testLogExistence(sBuildRef) Dim objXML Dim testUrl Dim jJSON testUrl = HTTP_PKG_ARCHIVE testUrl = testUrl & "/cgi-bin/getBuildLogs.pl" testUrl = testUrl & "?buildRef=" & sBuildRef testUrl = testUrl & "&rtagId=" & parRtagId Err.Clear On Error Resume Next Set objXML = CreateObject("MSXML2.ServerXMLHTTP.3.0") objXML.Open "GET", testUrl, False objXML.Send if Err.Number <> 0 then sMessage = Err.Description On Error Goto 0 else On Error Goto 0 If objXML.status = 403 then sMessage = "Package Server Access Denied" ElseIf objXML.status <> 200 then sMessage = "Internal Error: Code " & objXML.status 'sMessage = objXML.responseText Else Set jJSON = New aspJSON jJSON.loadJSON( objXML.responseText ) Dim txt txt = jJSON.data.item("error") If txt <> "" Then sMessage = txt Else Dim this, el Set this = jJSON.data.item("data") For Each el in this.keys Dim parts : parts = split( this(el), "/") Dim mName : mName = parts(0) Dim dName : dName = MachineNames.item(mName) If dName = "" Then dName = mName & "*" End If BuildLogs.Add dName , CStr(this(el)) 'Response.Write "
Key: " & el & " Value: " & ABTLOG_URL & this(el)
Next
Set jJSON = nothing
Set this = nothing
End If
End If
End If
Set objXML = nothing
End Sub
'--- Bfore Render ---------------
testLogExistence(parBuildRef )
'----------------------------------------------
%>
Release Manager
<%Call Messenger ( sMessage , 1, "100%" )%>
A package is built on one or more build machines. Each build machine will produce a log of the build for the package.
The logs are retained for about 10 days and then discarded.
Build Machine
Mode
MACH_TYPE
GBE_BUILDFILTER
Log
<%
Dim sName, sPath, hRef, aBuildInfo, sMaster, sMachType, sFilter
If BuildLogs.Count <= 0 Then%>
No Logs Found. They may have expired
<%Else
For Each sName In BuildLogs.Keys
sPath = BuildLogs.item(sName)
hRef = ABTLOG_URL & "/" & sPath
aBuildInfo = BuildInfo.item(sName)
If TypeName(aBuildInfo) = "Variant()" Then
sMaster = aBuildInfo(0)
sMachType = aBuildInfo(1)
sFilter = aBuildInfo(2)
End If
%>
<%=sName%>
<%=sMaster%>
<%=sMachType%>
<%=sFilter%>
target="_blank">
<%
Next
End If%>
<%
Call Destroy_All_Objects
%>