Skip to content

Commit ab1d57c

Browse files
Merge branch 'release/5.4.0'
2 parents afd7c73 + 24d307c commit ab1d57c

File tree

137 files changed

+13463
-323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+13463
-323
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"cake.tool": {
6-
"version": "5.0.0",
6+
"version": "6.0.0",
77
"commands": [
88
"dotnet-cake"
99
]

.github/workflows/build-and-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ jobs:
1616
runs-on: windows-latest # Required for some (WPF) projects
1717

1818
steps:
19-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2020
id: checkout
2121
with:
2222
fetch-depth: 0
2323

2424
- name: Setup .NET Core
2525
id: setup-dotnet
26-
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
26+
uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1
2727
with:
28-
dotnet-version: '9.0.x'
28+
dotnet-version: '10.0.x'
2929

3030
- name: Cake Action
3131
id: cake-action
32-
uses: cake-build/cake-action@5167c3f6a9e15c76f009de2acdfb9488552bc0b9 #v3.0.0
32+
uses: cake-build/cake-action@d218f1133bb74a1df0b08c89cfd8fc100c09e1a0 #v3.0.1
3333
with:
3434
target: BuildAndTest
3535
arguments: |

.github/workflows/dependabot-auto-merge.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,7 @@ data/dsl/*.java
158158
# Nodejs / NPM
159159
node_modules
160160
package-lock.json
161+
162+
# Azure / .NET Aspire
163+
.azure
164+
infra/

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Orc.Controls
33

44
Name|Badge
55
---|---
6-
Chat|[![Join the chat at https://gitter.im/WildGums/Orc.Controls](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/WildGums/Orc.Controls?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
76
Downloads|![NuGet downloads](https://img.shields.io/nuget/dt/orc.controls.svg)
87
Stable version|![Version](https://img.shields.io/nuget/v/orc.controls.svg)
98
Unstable version|![Pre-release version](https://img.shields.io/nuget/vpre/orc.controls.svg)

build.cake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Parameters["UseVisualStudioPrerelease"] = "false";
2424
// DEFINE COMPONENTS TO BUILD / PACKAGE
2525
//=======================================================
2626

27-
Components.Add(string.Format("{0}", GetBuildServerVariable("SolutionName")));
27+
Components.Add("Orc.Controls");
28+
Components.Add("Orc.Controls.Settings");
2829

2930
TestProjects.Add(string.Format("{0}.Tests", GetBuildServerVariable("SolutionName")));
3031

cake.config

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ SkipVerification=true
77
EnableScriptCache=true
88

99
[Paths]
10-
; Cache=%temp%/cake-build/cache/
11-
; Note: cache-path is set via environment variables
10+
Cache=%temp%/cake-build/cache/

deployment/cake/aspire-tasks.cake

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
#l "aspire-variables.cake"
2+
3+
using System.Xml.Linq;
4+
5+
//-------------------------------------------------------------
6+
7+
public class AspireProcessor : ProcessorBase
8+
{
9+
public AspireProcessor(BuildContext buildContext)
10+
: base(buildContext)
11+
{
12+
13+
}
14+
15+
public override bool HasItems()
16+
{
17+
return BuildContext.Aspire.Items.Count > 0;
18+
}
19+
20+
public override async Task PrepareAsync()
21+
{
22+
if (!HasItems())
23+
{
24+
return;
25+
}
26+
27+
// Nothing needed
28+
}
29+
30+
public override async Task UpdateInfoAsync()
31+
{
32+
if (!HasItems())
33+
{
34+
return;
35+
}
36+
37+
// Nothing needed
38+
}
39+
40+
public override async Task BuildAsync()
41+
{
42+
if (!HasItems())
43+
{
44+
return;
45+
}
46+
47+
// Nothing needed
48+
}
49+
50+
public override async Task PackageAsync()
51+
{
52+
if (!HasItems())
53+
{
54+
return;
55+
}
56+
57+
var aspireContext = BuildContext.Aspire;
58+
59+
if (aspireContext.Items.Count > 1)
60+
{
61+
throw new InvalidOperationException("Multiple Aspire projects found. Please ensure only one Aspire project is defined in the solution.");
62+
}
63+
64+
var environmentName = GetEnvironmentName(aspireContext);
65+
66+
foreach (var aspireProject in aspireContext.Items)
67+
{
68+
if (BuildContext.General.SkipComponentsThatAreNotDeployable &&
69+
!ShouldPackageProject(BuildContext, aspireProject))
70+
{
71+
CakeContext.Information("Aspire project '{0}' should not be packaged", aspireProject);
72+
continue;
73+
}
74+
75+
BuildContext.CakeContext.LogSeparator("Packaging Aspire project '{0}'", aspireProject);
76+
77+
BuildContext.CakeContext.Information("Setting environment variables");
78+
79+
var environmentVariables = new Dictionary<string, string>
80+
{
81+
{ "AZURE_PRINCIPAL_ID", aspireContext.AzurePrincipalId },
82+
{ "AZURE_PRINCIPAL_TYPE", aspireContext.AzurePrincipalType },
83+
{ "AZURE_LOCATION", aspireContext.AzureLocation },
84+
{ "AZURE_RESOURCE_GROUP", $"rg-{aspireContext.AzureResourceGroup}-{aspireContext.EnvironmentName}" },
85+
{ "AZURE_SUBSCRIPTION_ID", aspireContext.AzureSubscriptionId },
86+
{ "AZURE_ENV_NAME", aspireContext.EnvironmentName },
87+
};
88+
89+
foreach (var environmentVariable in environmentVariables)
90+
{
91+
RunAzd($"env set {environmentVariable.Key}=\"{environmentVariable.Value}\" -e {environmentName} --no-prompt");
92+
}
93+
94+
BuildContext.CakeContext.Information("Generating infrastructure context");
95+
96+
RunAzd($"infra gen -e {environmentName} --force");
97+
98+
BuildContext.CakeContext.LogSeparator();
99+
}
100+
}
101+
102+
public override async Task DeployAsync()
103+
{
104+
if (!HasItems())
105+
{
106+
return;
107+
}
108+
109+
var aspireContext = BuildContext.Aspire;
110+
111+
if (aspireContext.Items.Count > 1)
112+
{
113+
throw new InvalidOperationException("Multiple Aspire projects found. Please ensure only one Aspire project is defined in the solution.");
114+
}
115+
116+
var environmentName = GetEnvironmentName(aspireContext);
117+
118+
foreach (var aspireProject in aspireContext.Items)
119+
{
120+
if (!ShouldDeployProject(BuildContext, aspireProject))
121+
{
122+
CakeContext.Information("Aspire project '{0}' should not be deployed", aspireProject);
123+
continue;
124+
}
125+
126+
BuildContext.CakeContext.LogSeparator("Deploying Aspire project '{0}'", aspireProject);
127+
128+
try
129+
{
130+
BuildContext.CakeContext.Information("Logging in to Azure");
131+
132+
RunAzd($"auth login --tenant-id {aspireContext.AzureTenantId} --client-id {aspireContext.AzureClientId} --client-secret {aspireContext.AzureClientSecret} --no-prompt");
133+
134+
// Note: got weird errors when running provision and deploy manually, so using up instead
135+
136+
BuildContext.CakeContext.Information("Deploying to Azure");
137+
138+
RunAzd($"up -e {environmentName} --no-prompt");
139+
140+
//BuildContext.CakeContext.Information("Provisioning infrastructure for Aspire project '{0}'", aspireProject);
141+
142+
//RunAzd($"provision -e {environmentName}");
143+
144+
//BuildContext.CakeContext.Information("Deploying Aspire project '{0}'", aspireProject);
145+
146+
// Note: this could technically be improved in the future by using
147+
// azd deploy 'componentname'
148+
149+
//RunAzd($"deploy --all -e {environmentName}");
150+
151+
await BuildContext.Notifications.NotifyAsync(aspireProject, string.Format("Deployed to Azure"), TargetType.AspireProject);
152+
}
153+
finally
154+
{
155+
BuildContext.CakeContext.Information("Logging out of Azure");
156+
157+
RunAzd($"auth logout");
158+
}
159+
160+
BuildContext.CakeContext.LogSeparator();
161+
}
162+
}
163+
164+
public override async Task FinalizeAsync()
165+
{
166+
// Nothing needed
167+
}
168+
169+
private string GetEnvironmentName(AspireContext aspireContext)
170+
{
171+
// Because resource group names are set: "rg-{environmentName}" by Aspire, we automatically add
172+
// an extra name to the environment
173+
174+
var environmentName = $"{aspireContext.AzureResourceGroup}-{aspireContext.EnvironmentName}";
175+
176+
return environmentName;
177+
}
178+
179+
private void RunAzd(string arguments)
180+
{
181+
if (BuildContext.CakeContext.StartProcess("azd", new ProcessSettings
182+
{
183+
Arguments = arguments
184+
}) != 0)
185+
{
186+
throw new CakeException("Azd failed failed. Please check the logs for more details.");
187+
}
188+
}
189+
}

0 commit comments

Comments
 (0)