<%@LANGUAGE="VBSCRIPT"%> <% '===================================================== ' _make_rejected.asp ' Reject a package from pending back to a WIP ' Used to Reject a failed build ' Used to Reject before being built '===================================================== %> <% Option explicit ' Good idea to set when using redirect Response.Expires = 0 ' always load the page, dont store %> <% '------------ ACCESS CONTROL ------------------ %> <% '------------ Variable Definition ------------- Dim isDLocked '------------ Constants Declaration ----------- '------------ Variable Init ------------------- '---------------------------------------------- %> <% Sub MakeReject () objEH.TryORA ( OraSession ) On Error Resume Next OraDatabase.Parameters.Add "PV_ID", Request("pv_id"), ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "RTAG_ID", Request("rtag_id"), ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.ExecuteSQL _ "BEGIN "&_ " PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); "&_ "END; " objEH.CatchORA ( OraSession ) OraDatabase.Parameters.Remove "PV_ID" OraDatabase.Parameters.Remove "RTAG_ID" OraDatabase.Parameters.Remove "USER_ID" End Sub Sub RejectAutobuild() OraDatabase.Parameters.Add "PV_ID", Request("pv_id"), ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "RTAG_ID", Request("rtag_id"), ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "ACTION_TYPE_NAME", "reject_package", ORAPARM_INPUT, ORATYPE_VARCHAR2 OraDatabase.Parameters.Add "DESCRIPTION", "Rejected manually following autobuild failure", ORAPARM_INPUT, ORATYPE_VARCHAR2 On Error Resume Next objEH.TryORA( OraSession ) ' Move package back to work-in-progress table (changes dlocked to "R" in doing so) OraDatabase.ExecuteSQL ("BEGIN PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); END; ") If Err.Number = 0 Then ' Remove the entry from the do not ripple table but only if it is a direct exlusion entry caused by some build problem. ' This way, if user has deliberately excluded the package from the build (root_pv_id is null, root_cause is null ' and root_file is null) then it will remain exlcuded, as it will if there is some underlying package that has caused ' the exclusion. Dim count : count = 0 count = OraDatabase.ExecuteSQL ("DELETE FROM do_not_ripple " &_ "WHERE pv_id = :PV_ID " &_ " AND rtag_id = :RTAG_ID " &_ " AND nvl(root_pv_id,-1) < 0" &_ " AND ((root_cause IS NOT NULL) OR (root_file IS NOT NULL))" ) If Err.Number = 0 Then OraDatabase.ExecuteSQL ("BEGIN Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION ); END;") ' ' If we have removed a package from the do_not_ripple list, then we need to increment the release sequence ' number so that the build system will come and re-plan the build. ' If count > 0 Then OraDatabase.ExecuteSQL ("BEGIN PK_RELEASE.SET_RELEASE_MODIFIED(:RTAG_ID); END; ") End If End If End If objEH.CatchORA( OraSession ) OraDatabase.Parameters.Remove "PV_ID" OraDatabase.Parameters.Remove "RTAG_ID" OraDatabase.Parameters.Remove "USER_ID" OraDatabase.Parameters.Remove "ACTION_TYPE_NAME" OraDatabase.Parameters.Remove "DESCRIPTION" End Sub %> <% '----------------------- MAIN LINE --------------------------- '--- Process submit --- If (Request("rtag_id") <> "") AND (Request("pv_id") <> "") Then Call Get_Pkg_Short_Info( Request("pv_id"), NULL, NULL, NULL, NULL, NULL, isDLocked ) If isDLocked = "A" Then 'Do the reject operation - this execution path rejects an Approved package version back to Pending 'We can only do this operation if the build daemon is not going to be doing anything with the entry in 'the "package versions" table. We can only guarantee this ' if the Daemon has failed to build the package version and placed an entry for it in the "do not ripple" table ' OR the release has no active build daemons ' ' Note: Must match code in _pkg_action_buttons.asp ' If activeDaemonCount(parRtag_id) = 0 OR isInDoNotRippleTable( Request("rtag_id"), Request("pv_id") ) = TRUE OR hasFutureBuild( Request("rtag_id"), Request("pv_id")) Then Call RejectAutobuild() Else 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.") End If Else 'Do the reject operation - this execution path rejects a Pending package version back to Work In Progress Call MakeReject() End If Call Destroy_All_Objects Response.Redirect ( RequestDefault("rfile", "dependencies.asp") &"?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") ) Else Response.write "Some mandatory parameters are missing!" & "
" 'TODO Response.write QSTR_FullQuery End If %>