Skip to content

Commit

Permalink
Expose version information (dotnet#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienros authored Jan 19, 2024
1 parent b7e07cb commit cd49058
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Microsoft.Crank.Agent/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;

namespace Microsoft.Crank.Agent.Controllers
Expand All @@ -25,8 +26,9 @@ public IActionResult Info()
env = Startup.HardwareVersion.ToString(),
os = Startup.OperatingSystem.ToString(),
arch = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString(),
proc = Environment.ProcessorCount
});
proc = Environment.ProcessorCount,
version = typeof(HomeController).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
});
}
}
}
3 changes: 3 additions & 0 deletions src/Microsoft.Crank.Agent/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,9 @@ private static async Task<int> Run(string url, string hostname, string dockerHos
hostTask = host.WaitForShutdownAsync();
}

var version = typeof(Startup).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;

Log.Info($"Crank Agent version {version}");
Log.Info($"Starting agent on {url}...");

_processJobsCts = new CancellationTokenSource();
Expand Down

0 comments on commit cd49058

Please sign in to comment.