Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
119 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
6176 dpurdie 4
'   _make_rejected.asp
5
'   Reject a package from pending back to a WIP
6
'       Used to Reject a failed build
7
'       Used to Reject before being built    
119 ghuddy 8
'=====================================================
9
%>
10
<%
11
Option explicit
12
' Good idea to set when using redirect
129 ghuddy 13
Response.Expires = 0   ' always load the page, dont store
119 ghuddy 14
%>
15
 
16
<!--#include file="common/conf.asp"-->
17
<!--#include file="common/globals.asp"-->
18
<!--#include file="common/formating.asp"-->
19
<!--#include file="common/qstr.asp"-->
20
<!--#include file="common/common_subs.asp"-->
21
<!--#include file="common/common_dbedit.asp"-->
22
<%
23
'------------ ACCESS CONTROL ------------------
24
%>
25
<!--#include file="_access_control_login.asp"-->
26
<!--#include file="_access_control_general.asp"-->
27
<!--#include file="_access_control_project.asp"-->
28
<%
29
'------------ Variable Definition -------------
143 ghuddy 30
Dim isDLocked
119 ghuddy 31
'------------ Constants Declaration -----------
32
'------------ Variable Init -------------------
33
'----------------------------------------------
34
%>
35
<%
36
Sub MakeReject ()
129 ghuddy 37
 
38
   objEH.TryORA ( OraSession )
39
   On Error Resume Next
40
 
143 ghuddy 41
   OraDatabase.Parameters.Add "PV_ID",   Request("pv_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
42
   OraDatabase.Parameters.Add "RTAG_ID", Request("rtag_id"),      ORAPARM_INPUT, ORATYPE_NUMBER
43
   OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
129 ghuddy 44
 
45
   OraDatabase.ExecuteSQL _
46
   "BEGIN "&_
47
   " PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); "&_
48
   "END; "
49
 
50
   objEH.CatchORA ( OraSession )
51
 
52
   OraDatabase.Parameters.Remove "PV_ID"
53
   OraDatabase.Parameters.Remove "RTAG_ID"
54
   OraDatabase.Parameters.Remove "USER_ID"
55
 
119 ghuddy 56
End Sub
143 ghuddy 57
 
58
Sub RejectAutobuild()
59
 
60
   OraDatabase.Parameters.Add "PV_ID",            Request("pv_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
61
   OraDatabase.Parameters.Add "RTAG_ID",          Request("rtag_id"),      ORAPARM_INPUT, ORATYPE_NUMBER
62
   OraDatabase.Parameters.Add "USER_ID",          objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
63
   OraDatabase.Parameters.Add "ACTION_TYPE_NAME", "reject_package",        ORAPARM_INPUT, ORATYPE_VARCHAR2
64
   OraDatabase.Parameters.Add "DESCRIPTION",      "Rejected manually following autobuild failure", ORAPARM_INPUT, ORATYPE_VARCHAR2
65
 
66
   On Error Resume Next
67
   objEH.TryORA( OraSession )
68
 
69
   ' Move package back to work-in-progress table (changes dlocked to "R" in doing so)
70
   OraDatabase.ExecuteSQL _
71
   "BEGIN "&_
72
   " PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); "&_
73
   "END; "
74
 
75
   If Err.Number = 0 Then
76
 
77
      ' Remove the entry from the do not ripple table but only if it is a direct exlusion entry caused by some build problem.
78
      ' This way, if user has deliberately excluded the package from the build (root_pv_id is null, root_cause is null
79
      ' and root_file is null) then it will remain exlcuded, as it will if there is some underlying package that has caused
80
      ' the exclusion.
81
      OraDatabase.ExecuteSQL ("DELETE FROM do_not_ripple "&_
82
                              "      WHERE pv_id   = :PV_ID "&_
83
                              "        AND rtag_id = :RTAG_ID "&_
84
                              "        AND root_pv_id IS NULL"&_
85
                              "        AND ((root_cause IS NOT NULL) OR (root_file IS NOT NULL))" )
86
 
87
      If Err.Number = 0 Then
88
 
89
         OraDatabase.ExecuteSQL ("BEGIN Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION ); END;")
90
 
91
      End If
92
 
93
   End If
94
 
95
   objEH.CatchORA( OraSession )
96
 
97
   OraDatabase.Parameters.Remove "PV_ID"
98
   OraDatabase.Parameters.Remove "RTAG_ID"
99
   OraDatabase.Parameters.Remove "USER_ID"
100
   OraDatabase.Parameters.Remove "ACTION_TYPE_NAME"
101
   OraDatabase.Parameters.Remove "DESCRIPTION"
102
 
103
End Sub
104
 
119 ghuddy 105
%>
106
<%
107
'-----------------------  MAIN LINE  ---------------------------
108
 
143 ghuddy 109
'--- Process submit ---
119 ghuddy 110
If (Request("rtag_id") <> "") AND (Request("pv_id") <> "")  Then
129 ghuddy 111
 
112
 
143 ghuddy 113
   Call Get_Pkg_Short_Info( Request("pv_id"), NULL, NULL, NULL, NULL, NULL, isDLocked )
129 ghuddy 114
 
143 ghuddy 115
   If isDLocked = "A" Then
116
      'Do the reject operation - this execution path rejects an Approved package version back to Pending
117
 
118
      'We can only do this operation if the build daemon is not going to be doing anything with the entry in
6176 dpurdie 119
      'the "package versions" table. We can only guarantee this 
120
      '     if the Daemon has failed to build the package version and placed an entry for it in the "do not ripple" table
121
      '     OR the release has no active build daemons
122
      If activeDaemonCount(parRtag_id) = 0 OR isInDoNotRippleTable( Request("rtag_id"), Request("pv_id") ) = TRUE Then
143 ghuddy 123
         Call RejectAutobuild()
124
      Else
125
         Call RaiseMsg(enum_MSG_ERROR, "Cannot reject unless item is certain not to be examined concurrently by a build daemon during the reject operation. Wait for the build to fail.")
126
      End If
127
   Else
128
      'Do the reject operation - this execution path rejects a Pending package version back to Work In Progress
129
      Call MakeReject()
130
   End If
131
 
132
 
133
 
5957 dpurdie 134
   Call Destroy_All_Objects
129 ghuddy 135
   If Request("rfile") <> "" Then
136
      Response.Redirect ( Request("rfile") &"?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
137
   Else
138
      Response.Redirect ( "dependencies?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
139
   End If
140
 
119 ghuddy 141
Else
1376 dpurdie 142
   Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
4955 dpurdie 143
   Response.write QSTR_FullQuery
119 ghuddy 144
End If
145
%>
146
<!-- DESTRUCTOR ------->
129 ghuddy 147
<!--#include file="common/destructor.asp"-->