Skip to content

Commit 6457dee

Browse files
change: New service stop reason messages for Generate Client Code and Release Plan.
1 parent 6e233c5 commit 6457dee

4 files changed

Lines changed: 20 additions & 8 deletions

File tree

cli/cli/Services/DeploymentService.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ public static async Task<BeamoV2Manifest> CreateReleaseManifestFromRealmV2(IBeam
15371537
if (!useSequentialBuild)
15381538
{
15391539
// when using a sequential build; we'll fall back to one at a time
1540-
beamoIdToReport = await BuildSolutionCommand.Build(slnArg, forDeployment: true, forceCpu: true);
1540+
beamoIdToReport = await BuildSolutionCommand.Build(slnArg, forDeployment: true, forceCpu: true, serviceStopReason: "Stopped service to generate Release Plan.");
15411541
}
15421542

15431543
for (var i = 0; i < localManifest.ServiceDefinitions.Count; i++)
@@ -1639,6 +1639,7 @@ static ServiceStorageReference CreateStorageReference(
16391639
{
16401640
string imageId = null;
16411641
BuildImageOutput report = default;
1642+
string stopServiceReason = "Stopped service to generate Release Plan.";
16421643
if (definition.ShouldBeEnabledOnRemote)
16431644
{
16441645
var progressName = BUILD_PROGRESS_PREFIX + definition.BeamoId;
@@ -1662,7 +1663,8 @@ static ServiceStorageReference CreateStorageReference(
16621663
}, progressMessage: progress =>
16631664
{
16641665
progressHandler?.Invoke(progressName, progress.Ratio, serviceName: definition.BeamoId);
1665-
});
1666+
},
1667+
serviceStopReason: stopServiceReason);
16661668
progressHandler?.Invoke(progressName, 1);
16671669
imageId = report.ShortImageId;
16681670
}
@@ -1700,7 +1702,8 @@ static ServiceStorageReference CreateStorageReference(
17001702
["DOTNET_WATCH_SUPPRESS_EMOJIS"] = "1",
17011703
["DOTNET_WATCH_RESTART_ON_RUDE_EDIT"] = "1",
17021704
["OPEN_API_OUTPUT_PATH"] = Path.Combine(definition.ProjectDirectory, "bin", "Release",
1703-
targetFramework, "unix-x64")
1705+
targetFramework, "unix-x64"),
1706+
["BEAM_STOP_SERVICE_REASON"] = stopServiceReason
17041707
}
17051708
)
17061709
.WithStandardOutputPipe(PipeTarget.ToDelegate(line =>

cli/cli/Services/ProjectService.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ public enum RunFlags
596596
Detach
597597
}
598598

599-
public static async Task WatchBuild(BuildProjectCommandArgs args, ServiceName serviceName, BuildFlags buildFlags, Action<ProjectErrorReport> onReport)
599+
public static async Task WatchBuild(BuildProjectCommandArgs args, ServiceName serviceName, BuildFlags buildFlags, Action<ProjectErrorReport> onReport, string serviceStopReason = "")
600600
{
601601
var localServices = args.BeamoLocalSystem.BeamoManifest.HttpMicroserviceLocalProtocols;
602602
if (!localServices.TryGetValue(serviceName, out var service))
@@ -620,16 +620,20 @@ public static async Task WatchBuild(BuildProjectCommandArgs args, ServiceName se
620620
var projectPath = Path.GetDirectoryName(dockerfilePath);
621621
var commandStr = $"build {projectPath.EnquotePath()} -v n -p:ErrorLog=\"{errorPath}%2Cversion=2\"";
622622
Log.Debug($"dotnet command=[{args.AppContext.DotnetPath} {commandStr}]");
623-
624623
if (buildFlags.HasFlag(BuildFlags.DisableClientCodeGen))
625624
{
626625
commandStr += " -p:GenerateClientCode=false";
627626
}
628627

629628
using var cts = new CancellationTokenSource();
630629

630+
var envVars = new Dictionary<string, string> { ["DOTNET_WATCH_SUPPRESS_EMOJIS"] = "1", ["DOTNET_WATCH_RESTART_ON_RUDE_EDIT"] = "1", };
631+
if (!string.IsNullOrWhiteSpace(serviceStopReason))
632+
{
633+
envVars.Add("BEAM_STOP_SERVICE_REASON", serviceStopReason.Replace("\"", ""));
634+
}
631635
var command = CliExtensions.GetDotnetCommand(args.AppContext.DotnetPath, commandStr)
632-
.WithEnvironmentVariables(new Dictionary<string, string> { ["DOTNET_WATCH_SUPPRESS_EMOJIS"] = "1", ["DOTNET_WATCH_RESTART_ON_RUDE_EDIT"] = "1", })
636+
.WithEnvironmentVariables(envVars)
633637
.WithStandardOutputPipe(PipeTarget.ToDelegate(line =>
634638
{
635639
Log.Information(line);

client/Packages/com.beamable/Editor/Server/Usam/UsamService_GenerateClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public async Promise GenerateClient(BeamManifestServiceEntry service)
4444
// ensures we have the latest client generated
4545
AddLog(service.beamoId, CliLogMessage.FromStringNow(" building latest code..."));
4646

47-
await Build(new ProjectBuildArgs {ids = idArr});
47+
await Build(new ProjectBuildArgs {ids = idArr, stopReason = "\"Stopped service to generate client code.\""});
4848

4949
AddLog(service.beamoId, CliLogMessage.FromStringNow(" generating client code..."));
5050
if (!ShouldServiceAutoGenerateClient(service.beamoId))

microservice/microservice/Targets/Beamable.Microservice.Runtime.targets

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
<BeamCollectorExists Condition="Exists($(BeamCollectorBinaryFilepath))">true</BeamCollectorExists>
2525
</PropertyGroup>
2626

27+
<PropertyGroup>
28+
<BeamStopServiceReason>$([System.Environment]::GetEnvironmentVariable('BEAM_STOP_SERVICE_REASON'))</BeamStopServiceReason>
29+
<BeamStopServiceReason Condition="'$(BeamStopServiceReason)'==''">Stopped service to generate new build.</BeamStopServiceReason>
30+
</PropertyGroup>
31+
2732
<!-- This imports customer specific csproj files in the .beamable/temp/localDev project -->
2833
<Import Label="Load Beamable Local Developer Settings"
2934
Condition="'$(BeamProjectType)'=='storage' OR '$(BeamProjectType)'=='service'"
@@ -117,7 +122,7 @@
117122
<Message Condition="'$(BeamHasLockedFiles)'=='true'" Importance="high" Text="Locked files detected. Stopping service and re-checking output folder."/>
118123

119124
<Exec Condition="'$(BeamHasLockedFiles)'=='true'" EchoOff="true" IgnoreExitCode="true" EnvironmentVariables="MSBUILDTERMINALLOGGER=off"
120-
Command="dotnet beam project stop --ids $(BeamId) --reason &quot;Stopped service to generate new build.&quot;" />
125+
Command="dotnet beam project stop --ids $(BeamId) --reason &quot;$(BeamStopServiceReason)&quot;" />
121126

122127
<Exec Condition="'$(BeamHasLockedFiles)'=='true'" EchoOff="true" IgnoreExitCode="true" EnvironmentVariables="MSBUILDTERMINALLOGGER=off" ConsoleToMSBuild="true" StandardOutputImportance="Low" StandardErrorImportance="Low"
123128
Command="dotnet beam checks locked-files --folder-path=&quot;$(BeamOutputDirNormalized)&quot; --pattern=&quot;*.dll&quot;">

0 commit comments

Comments
 (0)