Skip to content

Commit 4952a9b

Browse files
committed
Set non-root file mode
1 parent d1a9f50 commit 4952a9b

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,13 @@ public static IResourceBuilder<AzureEventHubsResource> RunAsEmulator(this IResou
323323
var configJsonPath = aspireStore.GetFileNameWithContent($"{builder.Resource.Name}-Config.json", tempConfigFile);
324324

325325
// The docker container runs as a non-root user, so we need to grant other user's read/write permission
326-
//if (!OperatingSystem.IsWindows())
327-
//{
328-
// var mode = UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute |
329-
// UnixFileMode.OtherRead | UnixFileMode.OtherWrite | UnixFileMode.OtherExecute;
326+
if (!OperatingSystem.IsWindows())
327+
{
328+
var mode = UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute |
329+
UnixFileMode.OtherRead | UnixFileMode.OtherWrite | UnixFileMode.OtherExecute;
330330

331-
// File.SetUnixFileMode(configJsonPath, mode);
332-
//}
331+
File.SetUnixFileMode(configJsonPath, mode);
332+
}
333333

334334
builder.WithAnnotation(new ContainerMountAnnotation(
335335
configJsonPath,

src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,15 @@ public static IResourceBuilder<AzureServiceBusResource> RunAsEmulator(this IReso
423423
// Deterministic file path for the configuration file based on its content
424424
var configJsonPath = aspireStore.GetFileNameWithContent($"{builder.Resource.Name}-Config.json", tempConfigFile);
425425

426+
// The docker container runs as a non-root user, so we need to grant other user's read/write permission
427+
if (!OperatingSystem.IsWindows())
428+
{
429+
var mode = UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute |
430+
UnixFileMode.OtherRead | UnixFileMode.OtherWrite | UnixFileMode.OtherExecute;
431+
432+
File.SetUnixFileMode(configJsonPath, mode);
433+
}
434+
426435
builder.WithAnnotation(new ContainerMountAnnotation(
427436
configJsonPath,
428437
AzureServiceBusEmulatorResource.EmulatorConfigJsonPath,

tests/Aspire.Hosting.Azure.Tests/AzureServiceBusExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public async Task VerifyWaitForOnServiceBusEmulatorBlocksDependentResources()
215215
await app.StopAsync();
216216
}
217217

218-
[Fact(Skip = "Azure ServiceBus emulator is not reliable in CI - https://github.com/dotnet/aspire/issues/7066")]
218+
[Fact]
219219
[RequiresDocker]
220220
public async Task VerifyAzureServiceBusEmulatorResource()
221221
{

0 commit comments

Comments
 (0)