Enabling Revision Control in a Build Pipeline

Hi UDN,

I’m trying to setup a automatic build using PCG and when I’m running the following cmd:

C:\p4\default\Engine\Binaries\Win64\UnrealEditor.exe C:\p4\default\projectname\projectname.uproject -run=WorldPartitionBuilderCommandlet /Game/Maps/PlayableInstance/Battlefield/map_name -AllowCommandletRendering -builder=PCGWorldPartitionBuilder -OneComponentAtATime -LogShaders=Warning -LogPCG=VeryVerbose -IterativeCellLoading=false -AutoSubmit

I get the following error:

LogWorldPartitionBuilderCommandlet: Error: -AutoSubmit requires that a valid revision control provider is enabled, exiting…; exit code 1 (Step: Generate Maps (Unreal Engine))

If I manually open the editor on my build machine and enable revision control with the UI, then I can run the cmd just fine and I’m able to submit the changes.

Is there a way to set the revision control via cmdline, environment variables, or similar so we can run it effectively in our build pipeline?

Kind Regards

Sebastian

Steps to Reproduce
Run this cmd without revision control enabled

C:\p4\default\Engine\Binaries\Win64\UnrealEditor.exe C:\p4\default\projectname\projectname.uproject -run=WorldPartitionBuilderCommandlet /Game/Maps/PlayableInstance/Battlefield/map_name -AllowCommandletRendering -builder=PCGWorldPartitionBuilder -OneComponentAtATime -LogShaders=Warning -LogPCG=VeryVerbose -IterativeCellLoading=false -AutoSubmit

Hi,

Yes, you can enable the source control from command line. For example:

-SCCProvider="Perforce" -P4Port="perforce:1666" -P4User="patrick.laflamme" -P4Client="plaflamme_ue_56"For the password, it is recommended (or mandatory?) to login in P4 first which will create a token that the engine will use. If you need to learn more or debug this, start by looking into:

D:\UE_5.6\Engine\Plugins\Developer\PerforceSourceControl\Source\PerforceSourceControl\Private\PerforceSourceControlProvider.cpp

ISourceControlProvider::FInitResult FPerforceSourceControlProvider::ParseCommandLineSettings(EInitFlags InitFlags)D:\UE_5.6\Engine\Source\Developer\SourceControl\Private\SourceControlSettings.cpp

void FSourceControlSettings::LoadSettings()Finally, you might want to use UnrealEditor-cmd.exe instead. It is the ‘shell command’ version that run in the current context (blocking the console input) instead of spawning in independent process.

Regards,

Patrick

Hi Patrick,

Thank you for your swift response, seems like it’s just what i needed.

Hi again,

The Perforce flag did exactly what I needed but I’ve come across a new problem now which is that the files might be checked out by our developers (see log below), in our pipeline for this we would prefer to just force the submits from CI/CD through.

Is there a flag to ignore that files are checked out and just continue anyway?

LogCommandletPackageHelper: Error: File C:/p4/default/Svalinn/Content/__ExternalActors__/Maps/PlayableInstance/Battlefield/MAP_YmirBattlefieldTest_01/E/47/BWEEFGDPQP7OLTIECZK1PK.uasset already checked out by JohnDoe [Content removed] will not checkout

Kind Regards

Sebastian

Hi,

Neither ‘p4 submit’ or ‘p4 checkout’ commands have a flag to ‘force’ the submit/checkout if the file is locked. Either the user holding the lock release it, or a P4 administrator can run ‘p4 unlock -f …’ on the file to release the lock, but the Editor doesn’t do that by itself. We had similar issues internally, and the team designed the ‘Uncontrolled Changelists’ where you can work on binary assets without locking them in P4. The Editor should track which file you have modified and then allow you to revert or convert to a real P4 changelist. That will prevent locking files, especially for quick tests when the developers or artists do not really intend to submit their changes.

Regards,

Patrick

Hi again,

Obviously if the files are locked they’ll need to be released, but in our case the files are not locked, they’re just checked out by another user. I manually quick fixed it by running a “p4 checkout” on the directory in question before running the PCG command and then the submit goes through.

This approach works for a single map, but it feels kind of hacky and scaling it to a lot of maps might create some problems.

Would it be possible to add a flag “-ignoreCheckedoutFiles” or similar that would allow the cmd to try and checkout the files even though they’re checked out by other users?

Kind Regards

Sebastian

Hi,

Today I learned something after all these years using Perforce. The server can be configured to allow non-exclusive checkout for binary files (.uassets). Your server is probably configured this way. I always worked with servers where binary files checkout were configured to be exclusive and locked (and so is Epic P4 server). This might also explains why we don’t have this options in the Editor. I can write up the feature request, but honestly, it will very likely be backlogged and never implemented simply because this is not going to be a priority ever because we have the Uncontrolled Changelists feature to workaround that. So your best course of actions is to implement it yourself and eventually submit a pull request (GitHub) if you want the dev teams to look at it and decide if they should integrate it or not. They might even decide to reject it for some reasons. It should not be too hard to implement in \Engine\Plugins\Developer\PerforceSourceControl\Source\PerforceSourceControl\Private\PerforceSourceControlOperations.cpp. If you search for the ‘checkout’ keyword, I think you can add the flag you need based on the command line parameter. I think that would be it.

Regards,

Patrick

OK good to know.

I do have another quick question though regarding the builders

is it possible to have several builders?

-builder=PCGWorldPartitionBuilder and -builder=WorldPartitionNavigationDataBuilder

Or how should we chain these properly so we first generate the world with PCG and then kick of Nav mesh generation.

Kind regards

//

Martin

Hi,

Ideally, when you ask a question touching different systems (World Partition vs Source Control), it is better to create a new tickets that can be assigned to a field expert of the system. Being said, I asked the world partition team about your question and you will need to run a new commandlet instance for each builder, you cannot have multiple builders in a single invocation. So, something like that, assuming this is the same commandlet/command as you mentioned originally (I’m not familiar with that).

C:\p4\default\Engine\Binaries\Win64\UnrealEditor-cmd.exe C:\p4\default\projectname\projectname.uproject -run=WorldPartitionBuilderCommandlet /Game/Maps/PlayableInstance/Battlefield/map_name -AllowCommandletRendering -builder=PCGWorldPartitionBuilder -OneComponentAtATime -LogShaders=Warning -LogPCG=VeryVerbose -IterativeCellLoading=false -AutoSubmit
 
C:\p4\default\Engine\Binaries\Win64\UnrealEditor-cmd.exe C:\p4\default\projectname\projectname.uproject -run=WorldPartitionBuilderCommandlet /Game/Maps/PlayableInstance/Battlefield/map_name -AllowCommandletRendering -builder=WorldPartitionNavigationDataBuilder -OneComponentAtATime -LogShaders=Warning -LogPCG=VeryVerbose -IterativeCellLoading=false -AutoSubmit

Regards,

Patrick

Regards,

Patrick

Thanks Patrick for the response.

Kind regards

//

Martin