Horde - schedule a build on code submit?

I’m trying to schedule a build of pre-compiled binaries upon a perforce code submission in a specific directory in the project. However I’m new to Horde and I can’t get the schedule to trigger on submission. Can anyone tell me what I’m doing wrong?

Inside the “templates” section, I have:

    "templates": [
        {
            "id": "incremental-build",
            "name": "Incremental Build",
            "description": "Performs an incremental editor compile, and uploads the produced binaries to Horde for syncing with UnrealGameSync.",
            "initialAgentType": "Win64",
            "showUgsBadges": true,
            "arguments": [
                "-Script=Engine/Build/Graph/Examples/BuildEditorAndTools.xml",
                "-Target=Submit To Perforce For UGS",
                "-Target=Submit To Horde Storage For UGS",
                "-set:UProjectPath=$(ProjectPath)",
                "-set:EditorTarget=$(EditorTarget)",
                "-set:PreferredAgent=IncrementalWin64;CompileWin64;Win64",
                "-set:ArchiveStream=//unreal/precompiled-binaries"
            ],
            "Schedules": {
                "enabled": true,
                "maxActive": 1,
                "maxChanges": 0,
                "requireSubmittedChange": true,
                "patterns": [
                    {
                        "files": [
                            "//project/path/Source/**"
                        ]
                    }
                ],
                "templates": [
                    "incremental-build"
                ],
                "maxConcurrency": 1
            }
        }
    ]

(Sorry for the delay in posting the JSON!) I’d appreciate any guidance anyone can offer with this; I’ve been trying small syntax changes for a couple of days now, and not getting anywhere.

Hey there, I might be able to help you here. I just set this up for our studio over the past few days!

So you want to schedule a build on a code submit, let’s go through the steps (skip to the end if you’re already well-versed in the setup!):

  • Perforce Server setup with Depots and Streams - I’m guessing you got this done!

    • Your stream “MyProjectDevStream” should contain the engine source and your native project, here’s an example folder setup (it’s pretty much what we use):

    /MyProject/

    • /MyGame/
    • Config/
    • Content/
    • Source/
      • MyGame.Target.cs
      • MyGameEditor.Target.cs
    • MyGame.uproject
    • /Engine/
      • Build/
      • Plugins/
      • Source/
        • UnrealClient.target.cs
        • UnrealEditor.target.cs
        • UnrealGame.target.cs
        • UnrealServer.target.cs
    • /Samples/
    • /Templates/
    • Default.uprojectdirs
    • GenerateProjectFiles.bat
    • Setup.bat
    • p4ignore.txt
  • Horde Server setup with the .project.json and attached .stream.json for the “MyProjectDevStream“ perforce stream! I suppose you’re already all the way here.
    Skipping to the ‘schedules‘ definition:

  • "templates":
    [
      {
        "id": "incremental-build",
        "name": "Incremental Build",
        "initialAgentType": "Win64",
        "showUgsBadges": true,
        "arguments": 
        [
           // Your args here...
        ],
        "schedule":
        {
           "enabled": true,
           "maxActive": 1,
           "maxChanges": 0,
           "requireSubmittedChange": true,
           "filter": [ "ContainsCode" ],
           "patterns":
           [
             {
               "dayOfWeek": null,
               "interval": 5 // checks for changes every 5 minutes
             }
           ]
        }
      }
    ]
    

Make sure you dont have a capital letter: ‘Schedule‘ vs ‘schedule‘, and also really orient yourself on the most recent docs for horde schema:

I’ll be happy to help if you have anymore questions!

Thank you! This is perfect, it solved my problem! I appreciate the help!

1 Like

Is there a way to set it up such that an incremental build automatically “triggers” upon a code submission, instead of having it check every 5 minutes?

@spvnn
Using Horde by itself I’m not sure… the Horde server logs have the “Scanning for changes with #Horde tag” but I haven’t looked into that implementation. It may be possible using Perforce submit triggers, but I’m trying to avoid them at the moment, and have no knowledge about them.

But setting the interval to 1 minute should suffice and the overhead of checking for a change every minute is completely negligible. You’ll only ever see it in the schedule logs.

Hope that helps.

1 Like

Yeah I arrived at the same conclusion as you… thanks!

1 Like