mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-11 09:41:37 +00:00
Fix ServiceConfiguration.OneFuzzVersion (#2316)
This commit is contained in:
parent
5a8aa33af1
commit
ef434db201
@ -31,13 +31,13 @@ public class Info {
|
||||
var asm = Assembly.GetExecutingAssembly();
|
||||
var gitVersion = ReadResource(asm, "ApiService.onefuzzlib.git.version");
|
||||
var buildId = ReadResource(asm, "ApiService.onefuzzlib.build.id");
|
||||
var versionString = asm.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
||||
var versionString = context.ServiceConfiguration.OneFuzzVersion;
|
||||
|
||||
return new InfoResponse(
|
||||
ResourceGroup: resourceGroup,
|
||||
Subscription: subscription,
|
||||
Region: region,
|
||||
Versions: new Dictionary<string, InfoVersion> { { "onefuzz", new(gitVersion, buildId, versionString ?? "") } },
|
||||
Versions: new Dictionary<string, InfoVersion> { { "onefuzz", new(gitVersion, buildId, versionString) } },
|
||||
InstanceId: await _context.Containers.GetInstanceId(),
|
||||
InsightsAppid: config.ApplicationInsightsAppId,
|
||||
InsightsInstrumentationKey: config.ApplicationInsightsInstrumentationKey);
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace Microsoft.OneFuzz.Service;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Microsoft.OneFuzz.Service;
|
||||
|
||||
public enum LogDestination {
|
||||
Console,
|
||||
@ -49,6 +51,11 @@ public interface IServiceConfig {
|
||||
|
||||
public class ServiceConfiguration : IServiceConfig {
|
||||
|
||||
// Version is baked into the assembly by the build process:
|
||||
private static readonly string? _oneFuzzVersion =
|
||||
Assembly.GetExecutingAssembly()
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
||||
|
||||
public ServiceConfiguration() {
|
||||
#if DEBUG
|
||||
LogDestinations = new LogDestination[] { LogDestination.AppInsights, LogDestination.Console };
|
||||
@ -86,7 +93,16 @@ public class ServiceConfiguration : IServiceConfig {
|
||||
public string? OneFuzzOwner { get => Environment.GetEnvironmentVariable("ONEFUZZ_OWNER"); }
|
||||
public string? OneFuzzResourceGroup { get => Environment.GetEnvironmentVariable("ONEFUZZ_RESOURCE_GROUP"); }
|
||||
public string? OneFuzzTelemetry { get => Environment.GetEnvironmentVariable("ONEFUZZ_TELEMETRY"); }
|
||||
public string OneFuzzVersion { get => Environment.GetEnvironmentVariable("ONEFUZZ_VERSION") ?? "0.0.0"; }
|
||||
|
||||
public string OneFuzzVersion {
|
||||
get {
|
||||
// version can be overridden by config:
|
||||
return Environment.GetEnvironmentVariable("ONEFUZZ_VERSION")
|
||||
?? _oneFuzzVersion
|
||||
?? throw new InvalidOperationException("Unable to read OneFuzz version from assembly");
|
||||
}
|
||||
}
|
||||
|
||||
public string? OneFuzzAllowOutdatedAgent => Environment.GetEnvironmentVariable("ONEFUZZ_ALLOW_OUTDATED_AGENT");
|
||||
|
||||
public string OneFuzzNodeDisposalStrategy { get => Environment.GetEnvironmentVariable("ONEFUZZ_NODE_DISPOSAL_STRATEGY") ?? "scale_in"; }
|
||||
|
@ -31,8 +31,8 @@ public interface IReproOperations : IStatefulOrm<Repro, VmState> {
|
||||
public class ReproOperations : StatefulOrm<Repro, VmState, ReproOperations>, IReproOperations {
|
||||
private static readonly Dictionary<Os, string> DEFAULT_OS = new()
|
||||
{
|
||||
{Os.Linux, "Canonical:UbuntuServer:18.04-LTS:latest"},
|
||||
{Os.Windows, "MicrosoftWindowsDesktop:Windows-10:20h2-pro:latest"}
|
||||
{ Os.Linux, "Canonical:UbuntuServer:18.04-LTS:latest" },
|
||||
{ Os.Windows, "MicrosoftWindowsDesktop:Windows-10:20h2-pro:latest" }
|
||||
};
|
||||
|
||||
const string DEFAULT_SKU = "Standard_DS1_v2";
|
||||
|
Loading…
x
Reference in New Issue
Block a user