public S3Configuration(GameServerManager manager)
 {
     CredentialsFilePath = CommandUtils.CombinePaths(BuildPatchToolStagingInfo.GetBuildRootPath(), "Utilities", "S3Credentials.txt");
     CredentialsKey      = string.Format("{0}_server", manager.GameName).ToLower();
     AWSRegion           = "us-east-1";
     CommandUtils.Log("Using credentials key {0} for region {1} from {2}", CredentialsKey, AWSRegion, CredentialsFilePath);
 }
        public void DeployLinuxServerS3(string BuildVersion)
        {
            string BuildBaseDir = CommandUtils.CombinePaths(
                BuildPatchToolStagingInfo.GetBuildRootPath(),
                GameName,
                BuildVersion
                );
            string LinuxServerBaseDir = CommandUtils.CombinePaths(BuildBaseDir, "LinuxServer");
            string ServerZipFilePath  = CommandUtils.CombinePaths(BuildBaseDir, "LinuxServer.zip");

            if (CommandUtils.FileExists_NoExceptions(ServerZipFilePath))
            {
                CommandUtils.Log("Skipping creating server zip file {0}, as it already exists.", ServerZipFilePath);
            }
            else
            {
                CommandUtils.Log("Compressing Linux server binaries to {0}", ServerZipFilePath);
                CommandUtils.ZipFiles(ServerZipFilePath, LinuxServerBaseDir, new FileFilter(FileFilterType.Include));
                CommandUtils.Log("Completed compressing Linux server binaries.");
            }

            S3Configuration  S3Config = new S3Configuration(this);
            CloudStorageBase S3       = S3Config.GetConnection();

            string S3Filename = string.Format("LinuxServer-{0}.zip", Changelist);
            bool   bSuccess   = false;
            int    Retries    = 0;
            int    MaxRetries = 5;

            do
            {
                CommandUtils.Log("Uploading server binaries zip file to Amazon S3 bucket {0}.", S3BucketName);
                bSuccess = S3.PostFile(S3BucketName, S3Filename, ServerZipFilePath, "application/zip").bSuccess;
                if (!bSuccess)
                {
                    bool bDoRetry = Retries + 1 < MaxRetries;
                    CommandUtils.LogWarning("Failed to post server binaries to S3 (attempt {0} of {1}). {2}.",
                                            Retries + 1,
                                            MaxRetries,
                                            bDoRetry ? "Sleeping for ten seconds before retrying" : "Not retrying"
                                            );
                    if (bDoRetry)
                    {
                        Thread.Sleep(10000);
                    }
                }
            } while (!bSuccess && Retries++ < MaxRetries);

            if (!bSuccess)
            {
                throw new AutomationException("Could not upload server binaries to S3.");
            }

            CommandUtils.Log("Server binaries uploaded successfully to S3.");
        }
 private string GetUtilitiesFilePath(string Filename)
 {
     return(CommandUtils.CombinePaths(BuildPatchToolStagingInfo.GetBuildRootPath(), "Utilities", Filename));
 }