Horde HLOD build -

* Added option to shelve the build result to the workspace of a specific user (skipping the submit)
* Created a generic WorldPartitionBuilder BuildGraph command that will allow this kind of operation on any WP builder
* Added a P4.UpdateChange() overload that takes a client (workspace) argument
* Renamed the HLOD_Submit step to HLOD_Finalize, as it can either: gather files from multiple builders locally without submitting / submit the result / shelve the result
#rb richard.malo
#preflight 61376e1fd9c85a000127042c

#ROBOMERGE-AUTHOR: sebastien.lussier
#ROBOMERGE-SOURCE: CL 17444676 via CL 17446080
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17446098 by sebastien lussier in ue5-release-engine-test branch]
This commit is contained in:
sebastien lussier
2021-09-07 12:25:39 -04:00
parent 773f79b6fd
commit 423743fd4a
6 changed files with 105 additions and 22 deletions
@@ -2481,32 +2481,49 @@ namespace AutomationTool
/// Updates a changelist with the given fields
/// </summary>
/// <param name="CL"></param>
/// <param name="NewOwner"></param>
/// <param name="NewClient"></param>
/// <param name="NewDescription"></param>
/// <param name="SpewIsVerbose"></param>
public void UpdateChange(int CL, string NewOwner, string NewDescription, bool SpewIsVerbose = false)
public void UpdateChange(int CL, string NewClient, string NewDescription, bool SpewIsVerbose = false)
{
UpdateChange(CL, null, NewClient, NewDescription, SpewIsVerbose);
}
/// <summary>
/// Updates a changelist with the given fields
/// </summary>
/// <param name="CL"></param>
/// <param name="NewUser"></param>
/// <param name="NewClient"></param>
/// <param name="NewDescription"></param>
/// <param name="SpewIsVerbose"></param>
public void UpdateChange(int CL, string NewUser, string NewClient, string NewDescription, bool SpewIsVerbose = false)
{
string CmdOutput;
if(!LogP4Output(out CmdOutput, "", String.Format("change -o {0}", CL), SpewIsVerbose: SpewIsVerbose))
if (!LogP4Output(out CmdOutput, "", String.Format("change -o {0}", CL), SpewIsVerbose: SpewIsVerbose))
{
throw new P4Exception("Couldn't describe changelist {0}", CL);
}
P4Spec Spec = P4Spec.FromString(CmdOutput);
if(NewOwner != null)
if (NewUser != null)
{
Spec.SetField("Client", NewOwner);
Spec.SetField("User", NewUser);
}
if(NewDescription != null)
if (NewClient != null)
{
Spec.SetField("Client", NewClient);
}
if (NewDescription != null)
{
Spec.SetField("Description", NewDescription);
}
if(!LogP4Output(out CmdOutput, "", "change -i", Input: Spec.ToString(), SpewIsVerbose: SpewIsVerbose))
if (!LogP4Output(out CmdOutput, "", "change -i", Input: Spec.ToString(), SpewIsVerbose: SpewIsVerbose))
{
throw new P4Exception("Failed to update spec for changelist {0}", CL);
}
if(!CmdOutput.TrimEnd().EndsWith(String.Format("Change {0} updated.", CL)))
if (!CmdOutput.TrimEnd().EndsWith(String.Format("Change {0} updated.", CL)))
{
throw new P4Exception("Unexpected output from p4 change -i: {0}", CmdOutput);
}
@@ -0,0 +1,65 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using AutomationTool;
using EpicGames.Core;
using System;
using System.Diagnostics;
using System.Threading;
namespace AutomationScripts.Automation
{
public class WorldPartitionBuilder : BuildCommand
{
public override void ExecuteBuild()
{
string Builder = ParseRequiredStringParam("Builder");
string CommandletArgs = ParseOptionalStringParam("CommandletArgs");
bool bSubmit = ParseParam("Submit");
string ShelveUser = ParseOptionalStringParam("ShelveUser");
string ShelveWorkspace = ParseOptionalStringParam("ShelveWorkspace");
bool bShelveResult = !String.IsNullOrEmpty(ShelveUser) && !String.IsNullOrEmpty(ShelveWorkspace);
if (!P4Enabled && (bSubmit || bShelveResult))
{
LogError("P4 required to submit or shelve build results");
return;
}
CommandletArgs = "-Builder=" + Builder + " " + CommandletArgs;
if (bSubmit)
{
CommandletArgs += " -Submit";
}
string EditorExe = "UnrealEditor-Cmd.exe";
EditorExe = AutomationTool.HostPlatform.Current.GetUE4ExePath(EditorExe);
FileReference ProjectPath = ParseProjectParam();
RunCommandlet(ProjectPath, EditorExe, "WorldPartitionBuilderCommandlet", CommandletArgs);
if (bShelveResult)
{
LogInformation("### Shelving build results ###");
// Create a new changelist and move all checked out files to it
LogInformation("Creating pending changelist to shelve builder changes");
int PendingCL = P4.CreateChange(P4Env.Client);
P4.LogP4("", $"reopen -c {PendingCL} //...", AllowSpew: true);
// Shelve changelist & revert changes
LogInformation("Shelving changes...");
P4.Shelve(PendingCL);
LogInformation("Reverting local changes...");
P4.Revert($"-w -c {PendingCL} //...");
// Assign shelve to the provided user+workspace
LogInformation($"Changing ownership of CL {PendingCL} to user {ShelveUser}, workspace {ShelveWorkspace}");
P4.UpdateChange(PendingCL, ShelveUser, ShelveWorkspace, null, true);
LogInformation("### Shelving completed ###");
}
}
}
}