Exemplo n.º 1
0
        private void Init()
        {
            run = new Run
            {
                CorrelationId = environment.GetEnvironmentVariable("HELIX_CORRELATION_ID"),
                PerfRepoHash  = environment.GetEnvironmentVariable("PERFLAB_PERFHASH"),
                Name          = environment.GetEnvironmentVariable("PERFLAB_RUNNAME"),
                Queue         = environment.GetEnvironmentVariable("PERFLAB_QUEUE"),
                WorkItemName  = environment.GetEnvironmentVariable("HELIX_WORKITEM_FRIENDLYNAME"),
            };
            Boolean.TryParse(environment.GetEnvironmentVariable("PERFLAB_HIDDEN"), out bool hidden);
            run.Hidden = hidden;
            var configs = environment.GetEnvironmentVariable("PERFLAB_CONFIGS");

            if (!String.IsNullOrEmpty(configs)) // configs should be optional.
            {
                foreach (var kvp in configs.Split(';'))
                {
                    var split = kvp.Split('=');
                    run.Configurations.Add(split[0], split[1]);
                }
            }

            os = new Os()
            {
                Name         = $"{RuntimeEnvironment.OperatingSystem} {RuntimeEnvironment.OperatingSystemVersion}",
                MachineName  = Environment.MachineName,
                Architecture = RuntimeInformation.OSArchitecture.ToString(),
                Locale       = CultureInfo.CurrentUICulture.ToString()
            };

            build = new Build
            {
                Repo         = environment.GetEnvironmentVariable("PERFLAB_REPO"),
                Branch       = environment.GetEnvironmentVariable("PERFLAB_BRANCH"),
                Architecture = environment.GetEnvironmentVariable("PERFLAB_BUILDARCH"),
                Locale       = environment.GetEnvironmentVariable("PERFLAB_LOCALE"),
                GitHash      = environment.GetEnvironmentVariable("PERFLAB_HASH"),
                BuildName    = environment.GetEnvironmentVariable("PERFLAB_BUILDNUM"),
                TimeStamp    = DateTime.Parse(environment.GetEnvironmentVariable("PERFLAB_BUILDTIMESTAMP")),
            };
            build.AdditionalData["productVersion"] = environment.GetEnvironmentVariable("DOTNET_VERSION");

            // Additional Data we only want populated if it is available
            if (environment.GetEnvironmentVariable("MAUI_VERSION") != null)
            {
                build.AdditionalData["mauiVersion"] = environment.GetEnvironmentVariable("MAUI_VERSION");
            }
        }
Exemplo n.º 2
0
        private void Init(DirectoryInfo repositoryRoot)
        {
            run = new Run
            {
                CorrelationId = environment.GetEnvironmentVariable("HELIX_CORRELATION_ID"),
                PerfRepoHash  = "place holder",                                    // sdk does not use perf repo
                Name          = environment.GetEnvironmentVariable("TestRunName"), // no use for now.
                Queue         = environment.GetEnvironmentVariable("HelixTargetQueues")
            };
            run.Hidden = false;
            run.Configurations.Add("Configuration", environment.GetEnvironmentVariable("configuration"));
            run.Configurations.Add("TestFullMSBuild",
                                   environment.GetEnvironmentVariableAsBool("TestFullMSBuild", false).ToString());

            os = new Os
            {
                Name = $"{RuntimeEnvironment.OperatingSystem} {RuntimeEnvironment.OperatingSystemVersion}",
                // ToLower to match the existing record casing
                Architecture = RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant(),
                Locale       = CultureInfo.CurrentUICulture.ToString()
            };

            string gitHash = environment.GetEnvironmentVariable("GIT_COMMIT");

            build = new Build
            {
                Repo         = "dotnet/sdk",
                Branch       = environment.GetEnvironmentVariable("GIT_BRANCH"),
                Architecture = environment.GetEnvironmentVariable("architecture"),
                Locale       = "en-us",
                GitHash      = gitHash,
                BuildName    = environment.GetEnvironmentVariable("BuildNumber"),
                TimeStamp    = GetCommitTimestamp(gitHash, repositoryRoot.FullName)
            };

            tests = XunitPerformanceResultConverter.BatchGenerateTests(
                new DirectoryInfo(environment.GetEnvironmentVariable("perfWorkingDirectory")));
        }