Skip to content

Commit 80c647a

Browse files
Update Agent to support OS (#5482)
* Update supported os as per .net * Update agent to support os as per .net10 * restore Agent.Listener.csproj * Update resource file * Fix incorrect if-else constions * remove condition of TFM, it results in warning * rename knob for better understanding * revert renaming of old knob * Update warning message * Updated OS versions for alpine, azure-linux
1 parent ad6e251 commit 80c647a

File tree

6 files changed

+216
-19
lines changed

6 files changed

+216
-19
lines changed

src/Agent.Listener/Agent.Listener.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@
2828
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" Condition="$(TargetFramework.StartsWith('net8'))" />
2929
</ItemGroup>
3030

31-
<ItemGroup>
31+
<ItemGroup>
3232
<None Update="net8.json">
3333
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3434
</None>
35+
<None Update="net10.json">
36+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
37+
</None>
3538
</ItemGroup>
3639
</Project>

src/Agent.Listener/net10.json

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
[
2+
{
3+
"id": "alpine",
4+
"versions": [
5+
{
6+
"name": "3.22+"
7+
}
8+
]
9+
},
10+
{
11+
"id": "amzn",
12+
"versions": [
13+
{
14+
"name": "2"
15+
},
16+
{
17+
"name": "2023"
18+
}
19+
]
20+
},
21+
{
22+
"id": "azure-linux",
23+
"versions": [
24+
{
25+
"name": "3.0+"
26+
}
27+
]
28+
},
29+
{
30+
"id": "centos",
31+
"versions": [
32+
{
33+
"name": "9+"
34+
}
35+
]
36+
},
37+
{
38+
"id": "debian",
39+
"versions": [
40+
{
41+
"name": "12+"
42+
}
43+
]
44+
},
45+
{
46+
"id": "fedora",
47+
"versions": [
48+
{
49+
"name": "42+"
50+
}
51+
]
52+
},
53+
{
54+
"id": "macOS",
55+
"versions": [
56+
{
57+
"name": "14+"
58+
}
59+
]
60+
},
61+
{
62+
"id": "opensuse-leap",
63+
"versions": [
64+
{
65+
"name": "15.6+"
66+
}
67+
]
68+
},
69+
{
70+
"id": "almalinux",
71+
"versions": [
72+
{
73+
"name": "8+"
74+
}
75+
]
76+
},
77+
{
78+
"id": "rhel",
79+
"versions": [
80+
{
81+
"name": "8+"
82+
}
83+
]
84+
},
85+
{
86+
"id": "ol",
87+
"versions": [
88+
{
89+
"name": "8+"
90+
}
91+
]
92+
},
93+
{
94+
"id": "rocky",
95+
"versions": [
96+
{
97+
"name": "8+"
98+
}
99+
]
100+
},
101+
{
102+
"id": "sles",
103+
"versions": [
104+
{
105+
"name": "15.6+"
106+
}
107+
]
108+
},
109+
{
110+
"id": "ubuntu",
111+
"versions": [
112+
{
113+
"name": "22.04"
114+
},
115+
{
116+
"name": "24.04"
117+
},
118+
{
119+
"name": "25.10"
120+
}
121+
]
122+
},
123+
{
124+
"id": "Windows Client",
125+
"versions": [
126+
{
127+
"name": "10",
128+
"version": "1607+"
129+
},
130+
{
131+
"name": "11",
132+
"version": "22631+"
133+
}
134+
]
135+
},
136+
{
137+
"id": "Windows Nano Server",
138+
"versions": [
139+
{
140+
"name": "2019+"
141+
}
142+
]
143+
},
144+
{
145+
"id": "Windows Server",
146+
"versions": [
147+
{
148+
"name": "2016+"
149+
}
150+
]
151+
},
152+
{
153+
"id": "Windows Server Core",
154+
"versions": [
155+
{
156+
"name": "2016+"
157+
}
158+
]
159+
}
160+
]

src/Agent.Listener/net8.json

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"id": "alpine",
44
"versions": [
55
{
6-
"name": "3.17+"
6+
"name": "3.20+"
77
}
88
]
99
},
@@ -19,42 +19,50 @@
1919
]
2020
},
2121
{
22-
"id": "debian",
22+
"id": "azure-linux",
2323
"versions": [
2424
{
25-
"name": "11+"
25+
"name": "3.0"
2626
}
2727
]
2828
},
2929
{
30-
"id": "fedora",
30+
"id": "centos",
3131
"versions": [
3232
{
33-
"name": "39+"
33+
"name": "9+"
3434
}
3535
]
3636
},
3737
{
38-
"id": "macOS",
38+
"id": "debian",
3939
"versions": [
4040
{
4141
"name": "12+"
4242
}
4343
]
4444
},
4545
{
46-
"id": "mariner",
46+
"id": "fedora",
47+
"versions": [
48+
{
49+
"name": "41+"
50+
}
51+
]
52+
},
53+
{
54+
"id": "macOS",
4755
"versions": [
4856
{
49-
"name": "2.0+"
57+
"name": "14+"
5058
}
5159
]
5260
},
5361
{
5462
"id": "opensuse-leap",
5563
"versions": [
5664
{
57-
"name": "15.5+"
65+
"name": "15.6+"
5866
}
5967
]
6068
},
@@ -94,24 +102,21 @@
94102
"id": "sles",
95103
"versions": [
96104
{
97-
"name": "15+"
105+
"name": "15.6+"
98106
}
99107
]
100108
},
101109
{
102110
"id": "ubuntu",
103111
"versions": [
104-
{
105-
"name": "20.04"
106-
},
107112
{
108113
"name": "22.04"
109114
},
110115
{
111-
"name": "23.10"
116+
"name": "24.04"
112117
},
113118
{
114-
"name": "24.04"
119+
"name": "25.10"
115120
}
116121
]
117122
},
@@ -123,15 +128,16 @@
123128
"version": "1607+"
124129
},
125130
{
126-
"name": "11"
131+
"name": "11",
132+
"version": "22631+"
127133
}
128134
]
129135
},
130136
{
131137
"id": "Windows Nano Server",
132138
"versions": [
133139
{
134-
"version": "1809+"
140+
"name": "2019+"
135141
}
136142
]
137143
},

src/Agent.Sdk/Knob/AgentKnobs.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,12 @@ public class AgentKnobs
864864
new PipelineFeatureSource("Net8UnsupportedOsWarning"),
865865
new BuiltInDefaultKnobSource("true"));
866866

867+
public static readonly Knob DisableUnsupportedOsWarningNet10 = new Knob(
868+
nameof(DisableUnsupportedOsWarningNet10),
869+
"Show warning message on the OS which is not supported by .NET 10",
870+
new PipelineFeatureSource("DisableUnsupportedOsWarningNet10"),
871+
new BuiltInDefaultKnobSource("true"));
872+
867873
public static readonly Knob UsePSScriptWrapper = new Knob(
868874
nameof(UsePSScriptWrapper),
869875
"Use PowerShell script wrapper to handle PowerShell ConstrainedLanguage mode.",

src/Agent.Worker/JobExtension.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,27 @@ public async Task<List<IStep>> InitializeJob(IExecutionContext jobContext, Pipel
106106
context.Warning(ex.Message);
107107
}
108108
}
109+
if (!AgentKnobs.DisableUnsupportedOsWarningNet10.GetValue(context).AsBoolean())
110+
{
111+
// Check if a system supports .NET 10
112+
try
113+
{
114+
Trace.Verbose("Checking if your system supports .NET 10");
115+
116+
// Check version of the system
117+
if (!await PlatformUtil.IsNetVersionSupported("net10"))
118+
{
119+
string systemId = PlatformUtil.GetSystemId();
120+
SystemVersion systemVersion = PlatformUtil.GetSystemVersion();
121+
context.Warning(StringUtil.Loc("UnsupportedOsVersionByNet10", $"{systemId} {systemVersion}"));
122+
}
123+
}
124+
catch (Exception ex)
125+
{
126+
Trace.Error($"Error has occurred while checking if system supports .NET 10: {ex}");
127+
context.Warning(ex.Message);
128+
}
129+
}
109130

110131
// Set agent version variable.
111132
context.SetVariable(Constants.Variables.Agent.Version, BuildConstants.AgentPackage.Version);

src/Misc/layoutbin/en-US/strings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@
691691
"UnrecognizedCmdArgs": "Unrecognized command-line input arguments: '{0}'. For usage refer to: .\\config.cmd --help or ./config.sh --help",
692692
"UnregisteringAgent": "Removing agent from the server",
693693
"UnsupportedGitLfsVersion": "Your current Git LFS version is '{0}', which is unsupported by the agent. Please upgrade to at least version '{1}'. See https://github.com/git-lfs/git-lfs/issues/3571 for more details.",
694-
"UnsupportedOsVersionByNet8": "The operating system version this agent is running on ({0}) is not supported on an upcoming update to the Pipelines Agent. For supported operating system versions, see https://aka.ms/azdo-pipeline-agent-net8.",
694+
"UnsupportedOsVersionByNet10": "The operating system version this agent is running on ({0}) is not supported per Net10 requirements and will not be supported in an upcoming update to the Pipelines Agent. For supported operating system versions, see https://aka.ms/azdo-pipeline-agent-net10.",
695+
"UnsupportedOsVersionByNet8": "The operating system version this agent is running on ({0}) is not supported per Net8 requirements and will not be supported in an upcoming update to the Pipelines Agent. For supported operating system versions, see https://aka.ms/azdo-pipeline-agent-net8.",
695696
"UpdateBuildNumber": "Update Build Number",
696697
"UpdateBuildNumberForBuild": "Update build number to {0} for build {1}",
697698
"UpdateInProgress": "Agent update in progress, do not shutdown agent.",

0 commit comments

Comments
 (0)