Skip to content

Commit

Permalink
Release v1.0.0-beta.6
Browse files Browse the repository at this point in the history
  • Loading branch information
operate-services-sdk-bot committed Jul 11, 2023
1 parent 0a74a39 commit 1c38d6c
Show file tree
Hide file tree
Showing 286 changed files with 16,226 additions and 193 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ All notable changes to UGS CLI will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

# [1.0.0-beta.5] - 2023-06-28
## [1.0.0-beta.6] - 2023-07-10

### Added
- Game Server Hosting Module Service commands. Run `ugs gsh -h` to show usage.
- Supports builds, build configurations, fleets, fleet regions and servers.

### Fixed
- A bug with the login command when stdin is redirected.
- A bug preventing Remote Config fetch dry run to update the fetched file name.

## [1.0.0-beta.5] - 2023-06-28

### Added
- Added Batching to import and deploy to help prevent "Too Many Requests" error.
Expand Down
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/dotnet/runtime-deps:7.0.4-alpine3.16-amd64

ARG UGS_VERSION=latest

RUN apk add --no-cache curl ncurses

# Set the URL based on the version
RUN if [ "$UGS_VERSION" = "latest" ]; then \
UGS_URL="https://github.com/Unity-Technologies/unity-gaming-services-cli/releases/latest/download/ugs-linux-musl-x64"; \
else \
UGS_URL="https://github.com/Unity-Technologies/unity-gaming-services-cli/releases/download/$UGS_VERSION/ugs-linux-musl-x64"; \
fi \
&& echo "Installing UGS cli version \"$UGS_VERSION\" from \"$UGS_URL\"" \
&& curl -f -L "$UGS_URL" -o /bin/ugs

RUN chmod +x /bin/ugs

# Add some color to it
ENV TERM=xterm-256color
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task DeletePlayerPolicyStatementsAsync_CallsLoadingIndicator()
await DeletePlayerPolicyStatementsHandler.DeletePlayerPolicyStatementsAsync(null!, null!, null!, null!,
mockLoadingIndicator.Object, CancellationToken.None);
mockLoadingIndicator.Verify(ex => ex
.StartLoadingAsync(It.IsAny<string>(), It.IsAny<Func<StatusContext?,Task>>()), Times.Once);
.StartLoadingAsync(It.IsAny<string>(), It.IsAny<Func<StatusContext?, Task>>()), Times.Once);
}

[Test]
Expand All @@ -48,14 +48,14 @@ public async Task DeletePlayerPolicyStatementsHandler_valid()
FilePath = new FileInfo(TestValues.FilePath)
};

m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync()).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync(CancellationToken.None)).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockAccessService?.Setup(x =>
x.DeletePlayerPolicyStatementsAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, TestValues.ValidPlayerId, It.IsAny<FileInfo>(), CancellationToken.None));
x.DeletePlayerPolicyStatementsAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, TestValues.ValidPlayerId, It.IsAny<FileInfo>(), CancellationToken.None));

await DeletePlayerPolicyStatementsHandler.DeletePlayerPolicyStatementsAsync(input, m_MockUnityEnvironment.Object,
m_MockAccessService!.Object, m_MockLogger!.Object, CancellationToken.None);

m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(), Times.Once);
m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(CancellationToken.None), Times.Once);
m_MockAccessService.Verify(x => x.DeletePlayerPolicyStatementsAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, TestValues.ValidPlayerId, It.IsAny<FileInfo>(), CancellationToken.None), Times.Once);
TestsHelper.VerifyLoggerWasCalled(m_MockLogger, LogLevel.Information, expectedTimes: Times.Once);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task DeleteProjectPolicyStatementsAsync_CallsLoadingIndicator()
await DeleteProjectPolicyStatementsHandler.DeleteProjectPolicyStatementsAsync(null!, null!, null!, null!,
mockLoadingIndicator.Object, CancellationToken.None);
mockLoadingIndicator.Verify(ex => ex
.StartLoadingAsync(It.IsAny<string>(), It.IsAny<Func<StatusContext?,Task>>()), Times.Once);
.StartLoadingAsync(It.IsAny<string>(), It.IsAny<Func<StatusContext?, Task>>()), Times.Once);
}

[Test]
Expand All @@ -47,14 +47,14 @@ public async Task DeleteProjectPolicyStatementsHandler_valid()
FilePath = new FileInfo(TestValues.FilePath)
};

m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync()).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync(CancellationToken.None)).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockAccessService?.Setup(x =>
x.DeletePolicyStatementsAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, It.IsAny<FileInfo>(), CancellationToken.None));
x.DeletePolicyStatementsAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, It.IsAny<FileInfo>(), CancellationToken.None));

await DeleteProjectPolicyStatementsHandler.DeleteProjectPolicyStatementsAsync(input, m_MockUnityEnvironment.Object,
m_MockAccessService!.Object, m_MockLogger!.Object, CancellationToken.None);

m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(), Times.Once);
m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(CancellationToken.None), Times.Once);
m_MockAccessService.Verify(x => x.DeletePolicyStatementsAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, It.IsAny<FileInfo>(), CancellationToken.None), Times.Once);
TestsHelper.VerifyLoggerWasCalled(m_MockLogger, LogLevel.Information, expectedTimes: Times.Once);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ public async Task GetAllPlayerPoliciesHandler_valid()
CloudProjectId = TestValues.ValidProjectId,
};

m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync()).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync(CancellationToken.None)).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockAccessService?.Setup(x => x.GetAllPlayerPoliciesAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, CancellationToken.None))
.ReturnsAsync(It.IsAny<List<PlayerPolicy>>());

await GetAllPlayerPoliciesHandler.GetAllPlayerPoliciesAsync(input, m_MockUnityEnvironment.Object,
m_MockAccessService!.Object, m_MockLogger!.Object, CancellationToken.None);

m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(), Times.Once);
m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(CancellationToken.None), Times.Once);
m_MockAccessService.Verify(x => x.GetAllPlayerPoliciesAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, CancellationToken.None), Times.Once);
TestsHelper.VerifyLoggerWasCalled(
m_MockLogger, LogLevel.Critical, LoggerExtension.ResultEventId, Times.Once);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public async Task GetPlayerPolicyHandler_valid()
PlayerId = TestValues.ValidPlayerId,
};

m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync()).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync(CancellationToken.None)).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockAccessService?.Setup(x => x.GetPlayerPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, TestValues.ValidPlayerId, CancellationToken.None))
.ReturnsAsync(It.IsAny<PlayerPolicy>());

await GetPlayerPolicyHandler.GetPlayerPolicyAsync(input, m_MockUnityEnvironment.Object,
m_MockAccessService!.Object, m_MockLogger!.Object, CancellationToken.None);

m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(), Times.Once);
m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(CancellationToken.None), Times.Once);
m_MockAccessService.Verify(x => x.GetPlayerPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, TestValues.ValidPlayerId, CancellationToken.None), Times.Once);
TestsHelper.VerifyLoggerWasCalled(
m_MockLogger, LogLevel.Critical, LoggerExtension.ResultEventId, Times.Once);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public async Task GetProjectPolicyHandler_valid()
CloudProjectId = TestValues.ValidProjectId,
};

m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync()).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync(CancellationToken.None)).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockAccessService?.Setup(x => x.GetPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, CancellationToken.None))
.ReturnsAsync(It.IsAny<Policy>());

await GetProjectPolicyHandler.GetProjectPolicyAsync(input, m_MockUnityEnvironment.Object,
m_MockAccessService!.Object, m_MockLogger!.Object, CancellationToken.None);

m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(), Times.Once);
m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(CancellationToken.None), Times.Once);
m_MockAccessService.Verify(x => x.GetPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, CancellationToken.None), Times.Once);
TestsHelper.VerifyLoggerWasCalled(
m_MockLogger, LogLevel.Critical, LoggerExtension.ResultEventId, Times.Once);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task UpsertPlayerPolicyAsync_CallsLoadingIndicator()
await UpsertPlayerPolicyHandler.UpsertPlayerPolicyAsync(null!, null!, null!, null!,
mockLoadingIndicator.Object, CancellationToken.None);
mockLoadingIndicator.Verify(ex => ex
.StartLoadingAsync(It.IsAny<string>(), It.IsAny<Func<StatusContext?,Task>>()), Times.Once);
.StartLoadingAsync(It.IsAny<string>(), It.IsAny<Func<StatusContext?, Task>>()), Times.Once);
}

[Test]
Expand All @@ -48,14 +48,14 @@ public async Task UpsertPlayerPolicyHandler_valid()
PlayerId = TestValues.ValidPlayerId
};

m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync()).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync(CancellationToken.None)).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockAccessService?.Setup(x =>
x.UpsertPlayerPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, TestValues.ValidPlayerId, It.IsAny<FileInfo>(), CancellationToken.None));
x.UpsertPlayerPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, TestValues.ValidPlayerId, It.IsAny<FileInfo>(), CancellationToken.None));

await UpsertPlayerPolicyHandler.UpsertPlayerPolicyAsync(input, m_MockUnityEnvironment.Object,
m_MockAccessService!.Object, m_MockLogger!.Object, CancellationToken.None);

m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(), Times.Once);
m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(CancellationToken.None), Times.Once);
m_MockAccessService.Verify(x => x.UpsertPlayerPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, TestValues.ValidPlayerId, It.IsAny<FileInfo>(), CancellationToken.None), Times.Once);
TestsHelper.VerifyLoggerWasCalled(m_MockLogger, LogLevel.Information, expectedTimes: Times.Once);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task UpsertProjectPolicyAsync_CallsLoadingIndicator()
await UpsertProjectPolicyHandler.UpsertProjectPolicyAsync(null!, null!, null!, null!,
mockLoadingIndicator.Object, CancellationToken.None);
mockLoadingIndicator.Verify(ex => ex
.StartLoadingAsync(It.IsAny<string>(), It.IsAny<Func<StatusContext?,Task>>()), Times.Once);
.StartLoadingAsync(It.IsAny<string>(), It.IsAny<Func<StatusContext?, Task>>()), Times.Once);
}

[Test]
Expand All @@ -47,14 +47,14 @@ public async Task UpsertProjectPolicyHandler_valid()
FilePath = new FileInfo(TestValues.FilePath)
};

m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync()).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockUnityEnvironment.Setup(x => x.FetchIdentifierAsync(CancellationToken.None)).ReturnsAsync(TestValues.ValidEnvironmentId);
m_MockAccessService?.Setup(x =>
x.UpsertPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, It.IsAny<FileInfo>(), CancellationToken.None));
x.UpsertPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, It.IsAny<FileInfo>(), CancellationToken.None));

await UpsertProjectPolicyHandler.UpsertProjectPolicyAsync(input, m_MockUnityEnvironment.Object,
m_MockAccessService!.Object, m_MockLogger!.Object, CancellationToken.None);

m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(), Times.Once);
m_MockUnityEnvironment.Verify(x => x.FetchIdentifierAsync(CancellationToken.None), Times.Once);
m_MockAccessService.Verify(x => x.UpsertPolicyAsync(TestValues.ValidProjectId, TestValues.ValidEnvironmentId, It.IsAny<FileInfo>(), CancellationToken.None), Times.Once);
TestsHelper.VerifyLoggerWasCalled(m_MockLogger, LogLevel.Information, expectedTimes: Times.Once);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static async Task DeletePlayerPolicyStatementsAsync(AccessInput input,
IAccessService accessService, ILogger logger,
CancellationToken cancellationToken)
{
var environmentId = await unityEnvironment.FetchIdentifierAsync();
var environmentId = await unityEnvironment.FetchIdentifierAsync(cancellationToken);
var projectId = input.CloudProjectId!;
var playerId = input.PlayerId!;
var filePath = input.FilePath!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static async Task DeleteProjectPolicyStatementsAsync(AccessInput input,
IAccessService accessService, ILogger logger,
CancellationToken cancellationToken)
{
var environmentId = await unityEnvironment.FetchIdentifierAsync();
var environmentId = await unityEnvironment.FetchIdentifierAsync(cancellationToken);
var projectId = input.CloudProjectId!;
var filePath = input.FilePath!;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static async Task GetAllPlayerPoliciesAsync(CommonInput input, IUnityEn
IAccessService accessService, ILogger logger,
CancellationToken cancellationToken)
{
var environmentId = await unityEnvironment.FetchIdentifierAsync();
var environmentId = await unityEnvironment.FetchIdentifierAsync(cancellationToken);
var projectId = input.CloudProjectId!;

var playerPolicies = await accessService.GetAllPlayerPoliciesAsync(projectId, environmentId, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static async Task GetPlayerPolicyAsync(AccessInput input, IUnityEnviron
IAccessService accessService, ILogger logger,
CancellationToken cancellationToken)
{
var environmentId = await unityEnvironment.FetchIdentifierAsync();
var environmentId = await unityEnvironment.FetchIdentifierAsync(cancellationToken);
var projectId = input.CloudProjectId!;
var playerId = input.PlayerId!;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static async Task GetProjectPolicyAsync(CommonInput input, IUnityEnviro
IAccessService accessService, ILogger logger,
CancellationToken cancellationToken)
{
var environmentId = await unityEnvironment.FetchIdentifierAsync();
var environmentId = await unityEnvironment.FetchIdentifierAsync(cancellationToken);
var projectId = input.CloudProjectId!;

var policy = await accessService.GetPolicyAsync(projectId, environmentId, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static async Task UpsertPlayerPolicyAsync(AccessInput input, IUnityEnvi
IAccessService accessService, ILogger logger,
CancellationToken cancellationToken)
{
var environmentId = await unityEnvironment.FetchIdentifierAsync();
var environmentId = await unityEnvironment.FetchIdentifierAsync(cancellationToken);
var projectId = input.CloudProjectId!;
var filePath = input.FilePath!;
var playerId = input.PlayerId!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static async Task UpsertProjectPolicyAsync(AccessInput input, IUnityEnv
IAccessService accessService, ILogger logger,
CancellationToken cancellationToken)
{
var environmentId = await unityEnvironment.FetchIdentifierAsync();
var environmentId = await unityEnvironment.FetchIdentifierAsync(cancellationToken);
var projectId = input.CloudProjectId!;
var filePath = input.FilePath!;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void SetUp()
m_Host.Setup(x => x.Services)
.Returns(provider);

m_UnityEnvironment.Setup(x => x.FetchIdentifierAsync()).Returns(Task.FromResult(ValidEnvironmentId));
m_UnityEnvironment.Setup(x => x.FetchIdentifierAsync(CancellationToken.None)).Returns(Task.FromResult(ValidEnvironmentId));
m_DeployFileService.Setup(x => x.ListFilesToDeploy(new[]
{
""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected BaseExporter(
public async Task ExportAsync(ExportInput input, CancellationToken cancellationToken)
{
var projectId = input.CloudProjectId!;
var environmentId = await m_UnityEnvironment.FetchIdentifierAsync();
var environmentId = await m_UnityEnvironment.FetchIdentifierAsync(cancellationToken);
var fileName = ImportExportUtils.ResolveFileName(input.FileName, FileName);

var configs = await ListConfigsAsync(projectId, environmentId, cancellationToken);
Expand All @@ -57,7 +57,7 @@ public async Task ExportAsync(ExportInput input, CancellationToken cancellationT
await ExportToZipAsync(input.OutputDirectory, fileName, state, cancellationToken);
}

m_Logger.LogResultValue(new ImportExportResult( state.ExportedItems().ToList())
m_Logger.LogResultValue(new ImportExportResult(state.ExportedItems().ToList())
{
Header = input.DryRun ? "The following items will be exported:" : "The following items were exported:",
DryRun = input.DryRun
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ CancellationToken cancellationToken
return;
}

var environmentId = await unityEnvironment.FetchIdentifierAsync();
var environmentId = await unityEnvironment.FetchIdentifierAsync(cancellationToken);
var projectId = input.CloudProjectId!;
var deploymentServices = services
.Where(s => CheckService(input, s))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected BaseImporter(
/// <exception cref="CliException"></exception>
public async Task ImportAsync(ImportInput input, CancellationToken cancellationToken, int maxParallelTaskLimit = 10)
{
var environmentId = await m_UnityEnvironment.FetchIdentifierAsync();
var environmentId = await m_UnityEnvironment.FetchIdentifierAsync(cancellationToken);
var projectId = input!.CloudProjectId!;
var fileName = ImportExportUtils.ResolveFileName(input.FileName, FileName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public async Task FetchAsyncInitializesClientAndGetsResultFromHandler(bool dryRu
input.CloudProjectId = TestValues.ValidProjectId;
input.DryRun = dryRun;
input.Reconcile = reconcile;
m_UnityEnvironment.Setup(x => x.FetchIdentifierAsync())
m_UnityEnvironment.Setup(x => x.FetchIdentifierAsync(CancellationToken.None))
.ReturnsAsync(TestValues.ValidEnvironmentId);
var expectedResult = new FetchResult(
Array.Empty<DeployContent>(),
Expand Down
Loading

0 comments on commit 1c38d6c

Please sign in to comment.