mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-12 18:18:08 +00:00
Fix ServiceConfiguration.OneFuzzVersion (#2316)
This commit is contained in:
@ -31,13 +31,13 @@ public class Info {
|
|||||||
var asm = Assembly.GetExecutingAssembly();
|
var asm = Assembly.GetExecutingAssembly();
|
||||||
var gitVersion = ReadResource(asm, "ApiService.onefuzzlib.git.version");
|
var gitVersion = ReadResource(asm, "ApiService.onefuzzlib.git.version");
|
||||||
var buildId = ReadResource(asm, "ApiService.onefuzzlib.build.id");
|
var buildId = ReadResource(asm, "ApiService.onefuzzlib.build.id");
|
||||||
var versionString = asm.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
var versionString = context.ServiceConfiguration.OneFuzzVersion;
|
||||||
|
|
||||||
return new InfoResponse(
|
return new InfoResponse(
|
||||||
ResourceGroup: resourceGroup,
|
ResourceGroup: resourceGroup,
|
||||||
Subscription: subscription,
|
Subscription: subscription,
|
||||||
Region: region,
|
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(),
|
InstanceId: await _context.Containers.GetInstanceId(),
|
||||||
InsightsAppid: config.ApplicationInsightsAppId,
|
InsightsAppid: config.ApplicationInsightsAppId,
|
||||||
InsightsInstrumentationKey: config.ApplicationInsightsInstrumentationKey);
|
InsightsInstrumentationKey: config.ApplicationInsightsInstrumentationKey);
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace Microsoft.OneFuzz.Service;
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Microsoft.OneFuzz.Service;
|
||||||
|
|
||||||
public enum LogDestination {
|
public enum LogDestination {
|
||||||
Console,
|
Console,
|
||||||
@ -49,6 +51,11 @@ public interface IServiceConfig {
|
|||||||
|
|
||||||
public class ServiceConfiguration : 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() {
|
public ServiceConfiguration() {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
LogDestinations = new LogDestination[] { LogDestination.AppInsights, LogDestination.Console };
|
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? OneFuzzOwner { get => Environment.GetEnvironmentVariable("ONEFUZZ_OWNER"); }
|
||||||
public string? OneFuzzResourceGroup { get => Environment.GetEnvironmentVariable("ONEFUZZ_RESOURCE_GROUP"); }
|
public string? OneFuzzResourceGroup { get => Environment.GetEnvironmentVariable("ONEFUZZ_RESOURCE_GROUP"); }
|
||||||
public string? OneFuzzTelemetry { get => Environment.GetEnvironmentVariable("ONEFUZZ_TELEMETRY"); }
|
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? OneFuzzAllowOutdatedAgent => Environment.GetEnvironmentVariable("ONEFUZZ_ALLOW_OUTDATED_AGENT");
|
||||||
|
|
||||||
public string OneFuzzNodeDisposalStrategy { get => Environment.GetEnvironmentVariable("ONEFUZZ_NODE_DISPOSAL_STRATEGY") ?? "scale_in"; }
|
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 {
|
public class ReproOperations : StatefulOrm<Repro, VmState, ReproOperations>, IReproOperations {
|
||||||
private static readonly Dictionary<Os, string> DEFAULT_OS = new()
|
private static readonly Dictionary<Os, string> DEFAULT_OS = new()
|
||||||
{
|
{
|
||||||
{Os.Linux, "Canonical:UbuntuServer:18.04-LTS:latest"},
|
{ Os.Linux, "Canonical:UbuntuServer:18.04-LTS:latest" },
|
||||||
{Os.Windows, "MicrosoftWindowsDesktop:Windows-10:20h2-pro:latest"}
|
{ Os.Windows, "MicrosoftWindowsDesktop:Windows-10:20h2-pro:latest" }
|
||||||
};
|
};
|
||||||
|
|
||||||
const string DEFAULT_SKU = "Standard_DS1_v2";
|
const string DEFAULT_SKU = "Standard_DS1_v2";
|
||||||
|
Reference in New Issue
Block a user