Skip to content

Commit

Permalink
Update to the latest dev build.
Browse files Browse the repository at this point in the history
This hits an issue with `${null}` that is being fixed with Azure/azure-sdk-for-net#46742.
  • Loading branch information
eerhardt authored and github-actions committed Oct 25, 2024
1 parent 652dd79 commit 7754592
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<TestcontainersPackageVersion>3.10.0</TestcontainersPackageVersion>
<AzureProvisiongVersion>1.0.0-alpha.20241018.6</AzureProvisiongVersion>
<AzureProvisiongVersion>1.0.0-alpha.20241021.2</AzureProvisiongVersion>
</PropertyGroup>
<ItemGroup>
<!-- AWS SDK for .NET dependencies -->
Expand Down Expand Up @@ -39,15 +39,15 @@
<PackageVersion Include="Microsoft.Azure.SignalR" Version="1.28.0" />
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.7.6" />
<!-- Azure Management SDK for .NET dependencies -->
<PackageVersion Include="Azure.Provisioning" Version="$(AzureProvisiongVersion)" />
<PackageVersion Include="Azure.Provisioning" Version="1.0.0-alpha.20241021.3" />
<PackageVersion Include="Azure.Provisioning.AppConfiguration" Version="$(AzureProvisiongVersion)" />
<PackageVersion Include="Azure.Provisioning.AppContainers" Version="1.0.0-alpha.20241018.5" />
<PackageVersion Include="Azure.Provisioning.ApplicationInsights" Version="1.0.0-alpha.20241018.5" />
<PackageVersion Include="Azure.Provisioning.AppContainers" Version="1.0.0-alpha.20241021.3" />
<PackageVersion Include="Azure.Provisioning.ApplicationInsights" Version="1.0.0-alpha.20241021.3" />
<PackageVersion Include="Azure.Provisioning.CognitiveServices" Version="$(AzureProvisiongVersion)" />
<PackageVersion Include="Azure.Provisioning.CosmosDB" Version="$(AzureProvisiongVersion)" />
<PackageVersion Include="Azure.Provisioning.EventHubs" Version="$(AzureProvisiongVersion)" />
<PackageVersion Include="Azure.Provisioning.KeyVault" Version="$(AzureProvisiongVersion)" />
<PackageVersion Include="Azure.Provisioning.OperationalInsights" Version="1.0.0-alpha.20241018.5" />
<PackageVersion Include="Azure.Provisioning.OperationalInsights" Version="1.0.0-alpha.20241021.3" />
<PackageVersion Include="Azure.Provisioning.PostgreSql" Version="$(AzureProvisiongVersion)" />
<PackageVersion Include="Azure.Provisioning.Redis" Version="$(AzureProvisiongVersion)" />
<PackageVersion Include="Azure.Provisioning.Search" Version="$(AzureProvisiongVersion)" />
Expand Down
9 changes: 2 additions & 7 deletions playground/cdk/CdkSample.AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Azure.Provisioning.ApplicationInsights;
using Azure.Provisioning.Expressions;
using Azure.Provisioning.KeyVault;
using Azure.Provisioning.OperationalInsights;
using Azure.Provisioning.ServiceBus;
Expand Down Expand Up @@ -57,9 +56,7 @@
{
var queue = infrastructure.GetProvisionableResources().OfType<ServiceBusQueue>().Single(q => q.BicepIdentifier == "queue1");
queue.MaxDeliveryCount = 5;
queue.LockDuration = new StringLiteralExpression("PT5M");
// TODO: this should be
// queue.LockDuration = TimeSpan.FromMinutes(5);
queue.LockDuration = TimeSpan.FromMinutes(5);
})
.AddTopic("topic1")
.ConfigureInfrastructure(infrastructure =>
Expand All @@ -72,9 +69,7 @@
.ConfigureInfrastructure(infrastructure =>
{
var subscription = infrastructure.GetProvisionableResources().OfType<ServiceBusSubscription>().Single(q => q.BicepIdentifier == "subscription1");
subscription.LockDuration = new StringLiteralExpression("PT5M");
// TODO: this should be
//subscription.LockDuration = TimeSpan.FromMinutes(5);
subscription.LockDuration = TimeSpan.FromMinutes(5);
subscription.RequiresSession = true;
})
.AddSubscription("topic1", "subscription2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Lifecycle;
Expand Down Expand Up @@ -899,8 +898,7 @@ private void AddContainerRegistryParameters(ContainerAppConfiguration app)
// This is a workaround to handle nested formattable strings until the bug is fixed.
private static BicepValue<string> Interpolate(BicepValueFormattableString text)
{
var formatStringBuilder = new StringBuilder();
var arguments = new List<BicepValue<string>>();
var bicepStringBuilder = new BicepStringBuilder();

void ProcessFormattableString(BicepValueFormattableString formattableString, int argumentIndex)
{
Expand All @@ -909,7 +907,7 @@ void ProcessFormattableString(BicepValueFormattableString formattableString, int

foreach (var match in Regex.EnumerateMatches(span, @"{\d+}"))
{
formatStringBuilder.Append(span[..(match.Index - skip)]);
bicepStringBuilder.Append(span[..(match.Index - skip)].ToString());

var argument = formattableString.GetArgument(argumentIndex);

Expand All @@ -920,18 +918,17 @@ void ProcessFormattableString(BicepValueFormattableString formattableString, int
}
else
{
formatStringBuilder.Append(CultureInfo.InvariantCulture, $"{{{arguments.Count}}}");
if (argument is BicepValue<string> bicepValue)
{
arguments.Add(bicepValue);
bicepStringBuilder.Append($"{bicepValue}");
}
else if (argument is string s)
{
arguments.Add(s);
bicepStringBuilder.Append(s);
}
else if (argument is ProvisioningParameter provisioningParameter)
{
arguments.Add(provisioningParameter);
bicepStringBuilder.Append($"{provisioningParameter}");
}
else
{
Expand All @@ -944,19 +941,12 @@ void ProcessFormattableString(BicepValueFormattableString formattableString, int
skip = match.Index + match.Length;
}

formatStringBuilder.Append(span);
bicepStringBuilder.Append(span.ToString());
}

ProcessFormattableString(text, 0);

var formatString = formatStringBuilder.ToString();

if (formatString == "{0}")
{
return arguments[0];
}

return BicepFunction.Interpolate(new BicepValueFormattableString(formatString, [.. arguments]));
return bicepStringBuilder.Build();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public static IResourceBuilder<AzureOpenAIResource> AddAzureOpenAI(this IDistrib
infrastructure.Add(new ProvisioningOutput("connectionString", typeof(string))
{
Value = new InterpolatedStringExpression(
"Endpoint={0}",
[
new StringLiteralExpression("Endpoint="),
new MemberExpression(
new MemberExpression(
new IdentifierExpression(cogServicesAccount.BicepIdentifier),
Expand Down

0 comments on commit 7754592

Please sign in to comment.