TeamCity Version: 2025.11 Build 207946 (Docker)
Unreal Engine Plugin Version: 1.3.4
Unreal Engine Version: 5.7.1 (GitHub sources)
YouTrack issue: https://youtrack.jetbrains.com/issue/TW-98269/Enabling-delete-all-files-in-the-checkout-directory-before-the-build-doesnt-apply-to-distributed-Build-Graph-runs
Steps to reproduce the problem:
- Prepare at least two build agents capable of running an Unreal Engine job
- Create a minimal reproduction build using the provided minimal Build Graph file
- Create a new build in a project
- Connect the build to source control, where the provided Build Graph file is committed (I used Perforce)
- Add a new Unreal Engine build step in Build Graph mode, pointed to the Build Graph file
- Set the Target to
RunTest
- Enable Distributed mode
- Run the build once. It should succeed.
- Run the build again. It should fail, with the file that gets created during the first one still existing.
- Run the build once more, enabling
delete all files in the checkout directory before the build.
The actual result:
The build will fail due to the file created in previous runs still existing.
The expected result:
The build should succeed, as I expect enabling delete all files in the checkout directory before the build to clean the workspace of every executing agent.
It seems like enabling delete all files in the checkout directory before the build cleans the workspace of the agent which does the initial Build Graph JSON generation step.
Possible Workarounds
I could try to introduce an <Option> in the Build Graph that gets set by a TeamCity parameter, and run a manual cleaning step during the Build Graph run. This has a number of downsides:
- When starting a new build, my users will always see the
delete all files in the checkout directory before the build option first, and they may think it's enough for a clean build.
- I thought about trying to listen to whether the user has enabled
delete all files in the checkout directory before the build and set an <Option> based on that, but it doesn't seem like it's exposed as a parameter.
- By the time the manual cleaning step runs, Unreal Automation Tool has already pulled in files from shared storage, making it possible for me to wipe things Build Graph wants to keep.
I also tried out Swabra, but couldn't make it work.
Build Graph script
<BuildGraph xmlns="http://www.epicgames.com/BuildGraph" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.epicgames.com/BuildGraph ../Schema.xsd" >
<!--
Notes:
* Agent types can be whatever you like; this is just what I have set up locally
* If you don't have PowerShell installed, feel free to substitute the <Spawn> steps with equivalent functionality
-->
<Agent Name="An Agent" Type="Linux">
<Node Name="A Node">
<!-- If the workspace is clean, this file shouldn't exist -->
<Spawn Exe="pwsh" Arguments="-NonInteractive -NoProfile -Command "If (Test-Path runtimefile.txt) { Write-Warning 'exists'; Exit 1 } Else { Write-Host 'notexist'; Exit 0 }"" ErrorLevel="1" />
<!-- Represents a file made during the build -->
<WriteTextFile File="runtimefile.txt" Text="Yeet" />
</Node>
</Agent>
<Agent Name="Another Agent" Type="Linux">
<Node Name="Another Node">
<!-- If the workspace is clean, this file shouldn't exist -->
<Spawn Exe="pwsh" Arguments="-NonInteractive -NoProfile -Command "If (Test-Path runtimefile.txt) { Write-Warning 'exists'; Exit 1 } Else { Write-Host 'notexist'; Exit 0 }"" ErrorLevel="1" />
<!-- Represents a file made during the build -->
<WriteTextFile File="runtimefile.txt" Text="Yeet" />
</Node>
</Agent>
<Agent Name="Yet Another Agent" Type="Win64">
<Node Name="Yet Another Node">
<!-- If the workspace is clean, this file shouldn't exist -->
<Spawn Exe="pwsh" Arguments="-NonInteractive -NoProfile -Command "If (Test-Path anotherruntimefile.txt) { Write-Warning 'exists'; Exit 1 } Else { Write-Host 'notexist'; Exit 0 }"" ErrorLevel="1" />
<!-- Represents a file made during the build -->
<WriteTextFile File="anotherruntimefile.txt" Text="Yeet" />
</Node>
</Agent>
<Aggregate Name="RunTest" Requires="A Node;Another Node;Yet Another Node" />
</BuildGraph>
TeamCity Version: 2025.11 Build 207946 (Docker)
Unreal Engine Plugin Version: 1.3.4
Unreal Engine Version: 5.7.1 (GitHub sources)
YouTrack issue: https://youtrack.jetbrains.com/issue/TW-98269/Enabling-delete-all-files-in-the-checkout-directory-before-the-build-doesnt-apply-to-distributed-Build-Graph-runs
Steps to reproduce the problem:
RunTestdelete all files in the checkout directory before the build.The actual result:
The build will fail due to the file created in previous runs still existing.
The expected result:
The build should succeed, as I expect enabling
delete all files in the checkout directory before the buildto clean the workspace of every executing agent.It seems like enabling
delete all files in the checkout directory before the buildcleans the workspace of the agent which does the initial Build Graph JSON generation step.Possible Workarounds
I could try to introduce an
<Option>in the Build Graph that gets set by a TeamCity parameter, and run a manual cleaning step during the Build Graph run. This has a number of downsides:delete all files in the checkout directory before the buildoption first, and they may think it's enough for a clean build.delete all files in the checkout directory before the buildand set an<Option>based on that, but it doesn't seem like it's exposed as a parameter.I also tried out Swabra, but couldn't make it work.
Build Graph script