From 4da77a404a0c829f52b9cdda1b156e0f3f9df18d Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 15 Jun 2026 17:55:28 +0000 Subject: [PATCH] Serialize Pulumi publish steps to avoid Inferno.Common build races The deploy created publish-api, publish-mqtt, and publish-cli with no dependency between them, so Pulumi ran the three `dotnet publish` commands in parallel. Every service references Inferno.Common, so the parallel publishes rebuilt Common concurrently and collided on its obj/bin outputs (MSBuild file locks), failing the deploy. Chain each publish command to the previous one via DependsOn so only one `dotnet publish` touches the shared Inferno.Common build outputs at a time. Ordering only; no functional change. --- Inferno.Deploy/Program.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Inferno.Deploy/Program.cs b/Inferno.Deploy/Program.cs index 54649db..383e9a5 100644 --- a/Inferno.Deploy/Program.cs +++ b/Inferno.Deploy/Program.cs @@ -128,18 +128,29 @@ // Resolve ~ to absolute path (CopyToRemote and systemd don't expand ~) var absoluteRemotePath = remotePath.Replace("~", $"/home/{piUser}"); - // Step 1: Publish each project independently, triggered by its own source hash + // Step 1: Publish each project, triggered by its own source hash. Chain them so + // they run one at a time: every service references Inferno.Common, so parallel + // `dotnet publish` runs would rebuild Common concurrently and collide on its + // obj/bin outputs (MSBuild file locks). DependsOn on the previous publish + // serializes them and removes the contention. var publishOps = new Dictionary(); var sourceHashes = new Dictionary(); + LocalCommand? previousPublish = null; foreach (var svc in services) { var hash = SourceHash.Compute("..", serviceDeps[svc]); sourceHashes[svc] = hash; + var publishOpts = new CustomResourceOptions(); + if (previousPublish != null) + { + publishOpts.DependsOn.Add(previousPublish); + } publishOps[svc] = new LocalCommand($"publish-{svc}", new Pulumi.Command.Local.CommandArgs { Create = $"dotnet publish ../{projectMap[svc]} -c Release -o ../publish/{svc}", Triggers = new[] { hash }, - }); + }, publishOpts); + previousPublish = publishOps[svc]; } // Step 2: Copy published artifacts to the Pi (Pulumi diffs the file archive)