internal Uri GetIconUri(AppName appName)
        {
            var assemblyName      = Assembly.GetExecutingAssembly().GetName();
            var imageSubDirectory = appName.ToString();
            var packUri           = $"pack://application:,,,/{assemblyName.Name};component/Resources/{imageSubDirectory}/VsixExtensionIcon_16x16.png";

            return(new Uri(packUri));
        }
        public void DistributeImagesWait(int MaxRetries)
        {
            string AwsArgs     = Deployment2AwsArgs(Region: "NONE");
            string GceArgs     = Deployment2GceArgs(Zone: "us-central-1c", Region: "NONE");
            string GceLiveArgs = Deployment2GceArgs(Zone: "us-central1-c", Region: "NONE", AppNameStringOverride: "UnrealTournamentDev");

            CommandUtils.Log("Waiting for VM image creation in {0} to complete", AppName.ToString());
            if (AppName != UnrealTournamentBuild.UnrealTournamentAppName.UnrealTournamentDev)
            {
                Deployment2Command("image_create", GceLiveArgs, "get_pending", MaxRetries);
            }
            Deployment2Command("image_create", GceArgs, "get_pending", MaxRetries);
            Deployment2Command("image_create", AwsArgs, "get_pending", MaxRetries);
        }
        public void DistributeImagesAsync()
        {
            string AwsArgs     = Deployment2AwsArgs(Region: "NONE");
            string GceArgs     = Deployment2GceArgs(Zone: "us-central1-c", Region: "NONE");
            string GceLiveArgs = Deployment2GceArgs(Zone: "us-central1-c", Region: "NONE", AppNameStringOverride: "UnrealTournamentDev");

            CommandUtils.Log("Uploading build {0} to s3", BuildString);
            if (Debug == false)
            {
                DeployLinuxServerS3(BuildString);
            }

            CommandUtils.Log("Creating VM image in {0} for build {1}", AppName.ToString(), BuildString);
            if (AppName != UnrealTournamentBuild.UnrealTournamentAppName.UnrealTournamentDev)
            {
                Deployment2Command("image_create", GceLiveArgs, "true", 1);
            }
            Deployment2Command("image_create", GceArgs, "true", 1);
            Deployment2Command("image_create", AwsArgs, "true", 1);
        }
Пример #4
0
 public string GenerateAppScopedLoginId()
 {
     return($"{AppName.ToString()}:{LoginType.ToString()}:{UserId}");
 }
        private string Deployment2AwsArgs(string tag           = "",
                                          string InstanceType  = "c4.4xlarge",
                                          string AwsRegion     = "us-east-1",                           /* AU ap-southeast-2. KR ap-northeast-2 */
                                          string Region        = "NA",                                  /* KR South Korea. AU Australia */
                                          int InstanceSize     = 1,
                                          int InstanceSizeMin  = 1,
                                          int InstanceSizeMax  = 6,
                                          string AutoscalerId  = "default",
                                          string ExtraCliArgs  = "",
                                          string HubServerName = "")
        {
            string AwsCredentialsFile = "AwsDedicatedServerCredentialsDecoded.txt";

            int LocalCpuBudget = CpuBudget;

            if (InstanceSize == 0)
            {
                InstanceSizeMin = 0;
                InstanceSizeMax = 0;
            }
            else if (InstanceSizeMin > InstanceSize)
            {
                InstanceSize = InstanceSizeMin;
            }

            string CredentialsFilePath = GetUtilitiesFilePath(AwsCredentialsFile);
            string AwsCredentials      = ReadFileContents(CredentialsFilePath);

            string[] AwsCredentialsList = AwsCredentials.Split(':');

            if (AwsCredentialsList.Length != 2)
            {
                throw new AutomationException("Unable to parse credentials from file {0} {1}",
                                              AwsCredentialsFile, AwsCredentials);
            }

            string AwsAccessKey = AwsCredentialsList[0];

            Byte[] AwsAccessSecretKeyBytes = System.Text.Encoding.UTF8.GetBytes(AwsCredentialsList[1]);

            Byte[] CliArgBytes;
            if (HubServerName != "")
            {
                CliArgBytes    = System.Text.Encoding.UTF8.GetBytes("UnrealTournament ut-entry?game=lobby?ServerName=\"" + HubServerName + "\" -nocore -epicapp=" + AppName.ToString() + " " + ExtraCliArgs);
                LocalCpuBudget = 32000;
            }
            else
            {
                CliArgBytes = System.Text.Encoding.UTF8.GetBytes("UnrealTournament ut-entry?game=empty?region=" + Region + " -epicapp=" + AppName.ToString() + " " + ExtraCliArgs);
            }
            Byte[] BuildStringBytes = System.Text.Encoding.UTF8.GetBytes(BuildString);

            string CloudArgs = "epic_game_name=" + GameNameShort + "&" +
                               "epic_game_binary=" + this.GameBinary + "&" +
                               "epic_game_binary_path=" + this.GameBinaryPath + "&" +
                               "epic_game_log_path=" + this.GameLogPath + "&" +
                               "epic_game_saved_path=" + this.GameSavedPath + "&" +
                               "epic_game_max_match_length=" + this.MaxMatchLength.ToString() + "&" +
                               "epic_game_ttl_interval=" + this.TtlInterval.ToString() + "&" +
                               "epic_install_sumo=" + this.InstallSumo + "&" +
                               "epic_game_tag=" + GetTag(AppName, Region, tag) + "&" +
                               "epic_game_version=" + Changelist.ToString() + "&" +
                               "epic_game_buildstr_base64=" + System.Convert.ToBase64String(BuildStringBytes) + "&" +
                               "epic_game_cpu_budget=" + LocalCpuBudget + "&" +
                               "epic_game_ram_budget=" + RamBudget + "&" +
                               "epic_game_environment=" + AppName.ToString() + "&" +
                               "epic_instance_size=" + InstanceSize.ToString() + "&" +
                               "epic_instance_min=" + InstanceSizeMin.ToString() + "&" +
                               "epic_instance_max=" + InstanceSizeMax.ToString() + "&" +
                               "epic_autoscaler_id=" + AutoscalerId + "&" +
                               "epic_aws_access_key=" + AwsAccessKey + "&" +
                               "epic_aws_base64_secret_key=" + System.Convert.ToBase64String(AwsAccessSecretKeyBytes) + "&" +
                               "epic_aws_instance_type=" + InstanceType + "&" +
                               "epic_aws_region=" + AwsRegion + "&" +
                               "epic_game_base64_cli_args=" + System.Convert.ToBase64String(CliArgBytes);

            return(CloudArgs);
        }