Skip to content

Commit 11db0ba

Browse files
committed
Merge remote-tracking branch 'origin/master' into Localization
2 parents 66ead09 + 4c7bc63 commit 11db0ba

File tree

6 files changed

+105
-26
lines changed

6 files changed

+105
-26
lines changed

.azure-pipelines/signing.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ steps:
1616
displayName: Remove signatures from the third party packages
1717
condition: ne(variables['DISABLE_SIGNATURE_REMOVAL'], 'true')
1818

19-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@2
19+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
2020
inputs:
21-
ConnectedServiceName: VSTSAgentESRP
21+
ConnectedServiceName: PipelinesAgentAndTasksESRP
22+
AppRegistrationClientId: $(AppRegistrationClientId)
23+
AppRegistrationTenantId: $(AppRegistrationTenantId)
24+
AuthAKVName: $(AuthAKVName)
25+
AuthCertName: $(AuthCertName)
26+
AuthSignCertName: $(AuthSignCertName)
2227
FolderPath: '${{ parameters.layoutRoot }}/bin'
2328
Pattern: AgentService.exe
2429
signConfigType: inlineSignParams
@@ -40,9 +45,14 @@ steps:
4045
]
4146
displayName: Sign Agent Assemblies (Strong Name Signing)
4247

43-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@2
48+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
4449
inputs:
45-
ConnectedServiceName: VSTSAgentESRP
50+
ConnectedServiceName: PipelinesAgentAndTasksESRP
51+
AppRegistrationClientId: $(AppRegistrationClientId)
52+
AppRegistrationTenantId: $(AppRegistrationTenantId)
53+
AuthAKVName: $(AuthAKVName)
54+
AuthCertName: $(AuthCertName)
55+
AuthSignCertName: $(AuthSignCertName)
4656
FolderPath: '${{ parameters.layoutRoot }}/bin'
4757
Pattern: |
4858
Agent.*.dll
@@ -90,9 +100,14 @@ steps:
90100
]
91101
displayName: Sign Agent Assemblies (Authenticode Signing)
92102

93-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@2
103+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
94104
inputs:
95-
ConnectedServiceName: VSTSAgentESRP
105+
ConnectedServiceName: PipelinesAgentAndTasksESRP
106+
AppRegistrationClientId: $(AppRegistrationClientId)
107+
AppRegistrationTenantId: $(AppRegistrationTenantId)
108+
AuthAKVName: $(AuthAKVName)
109+
AuthCertName: $(AuthCertName)
110+
AuthSignCertName: $(AuthSignCertName)
96111
FolderPath: '${{ parameters.layoutRoot }}'
97112
Pattern: |
98113
bin\powershell\**\*.ps1
@@ -140,9 +155,14 @@ steps:
140155
]
141156
displayName: Sign PowerShell Scripts (Authenticode Signing)
142157

143-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@2
158+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
144159
inputs:
145-
ConnectedServiceName: VSTSAgentESRP
160+
ConnectedServiceName: PipelinesAgentAndTasksESRP
161+
AppRegistrationClientId: $(AppRegistrationClientId)
162+
AppRegistrationTenantId: $(AppRegistrationTenantId)
163+
AuthAKVName: $(AuthAKVName)
164+
AuthCertName: $(AuthCertName)
165+
AuthSignCertName: $(AuthSignCertName)
146166
FolderPath: '${{ parameters.layoutRoot }}'
147167
Pattern: |
148168
bin\**\*.dll

src/Agent.Worker/JobExtension.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,25 @@ public async Task<List<IStep>> InitializeJob(IExecutionContext jobContext, Pipel
238238
}
239239
context.Output("Finished checking job knob settings.");
240240

241+
// Ensure that we send git telemetry before potential path env changes during the pipeline execution
242+
var isSelfHosted = StringUtil.ConvertToBoolean(jobContext.Variables.Get(Constants.Variables.Agent.IsSelfHosted));
243+
if (PlatformUtil.RunningOnWindows && isSelfHosted)
244+
{
245+
try
246+
{
247+
var windowsPreinstalledGitCommand = jobContext.AsyncCommands.Find(c => c != null && c.Name == Constants.AsyncExecution.Commands.Names.WindowsPreinstalledGitTelemetry);
248+
if (windowsPreinstalledGitCommand != null)
249+
{
250+
await windowsPreinstalledGitCommand.WaitAsync();
251+
}
252+
}
253+
catch (Exception ex)
254+
{
255+
// Log the error
256+
Trace.Info($"Caught exception from async command WindowsPreinstalledGitTelemetry: {ex}");
257+
}
258+
}
259+
241260
if (PlatformUtil.RunningOnWindows)
242261
{
243262
// This is for internal testing and is not publicly supported. This will be removed from the agent at a later time.

src/Agent.Worker/JobRunner.cs

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ public async Task<TaskResult> RunAsync(Pipelines.AgentJobRequestMessage message,
179179
jobContext.SetVariable(Constants.Variables.System.WorkFolder, HostContext.GetDirectory(WellKnownDirectory.Work), isFilePath: true);
180180

181181
var azureVmCheckCommand = jobContext.GetHostContext().GetService<IAsyncCommandContext>();
182-
azureVmCheckCommand.InitializeCommandContext(jobContext, "GetAzureVMMetada");
182+
azureVmCheckCommand.InitializeCommandContext(jobContext, Constants.AsyncExecution.Commands.Names.GetAzureVMMetada);
183183
azureVmCheckCommand.Task = Task.Run(() => jobContext.SetVariable(Constants.Variables.System.IsAzureVM, PlatformUtil.DetectAzureVM() ? "1" : "0"));
184184
jobContext.AsyncCommands.Add(azureVmCheckCommand);
185185

186186
var dockerDetectCommand = jobContext.GetHostContext().GetService<IAsyncCommandContext>();
187-
dockerDetectCommand.InitializeCommandContext(jobContext, "DetectDockerContainer");
187+
dockerDetectCommand.InitializeCommandContext(jobContext, Constants.AsyncExecution.Commands.Names.DetectDockerContainer);
188188
dockerDetectCommand.Task = Task.Run(() => jobContext.SetVariable(Constants.Variables.System.IsDockerContainer, PlatformUtil.DetectDockerContainer() ? "1" : "0"));
189189
jobContext.AsyncCommands.Add(dockerDetectCommand);
190190

@@ -277,6 +277,31 @@ public async Task<TaskResult> RunAsync(Pipelines.AgentJobRequestMessage message,
277277
this.ExpandProperties(sidecar, jobContext.Variables);
278278
}
279279

280+
// Send telemetry in case if git is preinstalled on windows platform
281+
var isSelfHosted = StringUtil.ConvertToBoolean(jobContext.Variables.Get(Constants.Variables.Agent.IsSelfHosted));
282+
if (PlatformUtil.RunningOnWindows && isSelfHosted)
283+
{
284+
var windowsPreinstalledGitCommand = jobContext.GetHostContext().GetService<IAsyncCommandContext>();
285+
windowsPreinstalledGitCommand.InitializeCommandContext(jobContext, Constants.AsyncExecution.Commands.Names.WindowsPreinstalledGitTelemetry);
286+
windowsPreinstalledGitCommand.Task = Task.Run(() =>
287+
{
288+
var hasPreinstalledGit = false;
289+
290+
var filePath = WhichUtil.Which("git.exe", require: false, trace: null);
291+
if (!string.IsNullOrEmpty(filePath))
292+
{
293+
hasPreinstalledGit = true;
294+
}
295+
296+
PublishTelemetry(context: jobContext, area: "PipelinesTasks", feature: "WindowsGitTelemetry", properties: new Dictionary<string, string>
297+
{
298+
{ "hasPreinstalledGit", hasPreinstalledGit.ToString() }
299+
});
300+
});
301+
302+
jobContext.AsyncCommands.Add(windowsPreinstalledGitCommand);
303+
}
304+
280305
// Get the job extension.
281306
Trace.Info("Getting job extension.");
282307
var hostType = jobContext.Variables.System_HostType;
@@ -301,7 +326,13 @@ public async Task<TaskResult> RunAsync(Pipelines.AgentJobRequestMessage message,
301326
if (AgentKnobs.FailJobWhenAgentDies.GetValue(jobContext).AsBoolean() &&
302327
HostContext.AgentShutdownToken.IsCancellationRequested)
303328
{
304-
PublishTelemetry(jobContext, TaskResult.Failed.ToString(), "111");
329+
PublishTelemetry(context: jobContext, area: "PipelinesTasks", feature: "AgentShutdown", properties: new Dictionary<string, string>
330+
{
331+
{ "JobId", jobContext.Variables.System_JobId.ToString() },
332+
{ "JobResult", TaskResult.Failed.ToString() },
333+
{ "TracePoint", "111"},
334+
});
335+
305336
Trace.Error($"Job is canceled during initialize.");
306337
Trace.Error($"Caught exception: {ex}");
307338
return await CompleteJobAsync(jobServer, jobContext, message, TaskResult.Failed);
@@ -610,20 +641,14 @@ private void ReplaceConfigUriBaseInJobRequestMessage(Pipelines.AgentJobRequestMe
610641
}
611642
}
612643

613-
private void PublishTelemetry(IExecutionContext context, string Task_Result, string TracePoint)
644+
private void PublishTelemetry(IExecutionContext context, string area, String feature, Dictionary<string, string> properties)
614645
{
615646
try
616647
{
617-
var telemetryData = new Dictionary<string, string>
618-
{
619-
{ "JobId", context.Variables.System_JobId.ToString()},
620-
{ "JobResult", Task_Result },
621-
{ "TracePoint", TracePoint},
622-
};
623648
var cmd = new Command("telemetry", "publish");
624-
cmd.Data = JsonConvert.SerializeObject(telemetryData, Formatting.None);
625-
cmd.Properties.Add("area", "PipelinesTasks");
626-
cmd.Properties.Add("feature", "AgentShutdown");
649+
cmd.Data = JsonConvert.SerializeObject(properties, Formatting.None);
650+
cmd.Properties.Add("area", area);
651+
cmd.Properties.Add("feature", feature);
627652

628653
var publishTelemetryCmd = new TelemetryCommandExtension();
629654
publishTelemetryCmd.Initialize(HostContext);

src/Microsoft.VisualStudio.Services.Agent/Constants.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ public static class DefaultContainerMounts
123123
public static readonly string Tools = "tools";
124124
}
125125

126+
public static class AsyncExecution
127+
{
128+
public static class Commands
129+
{
130+
public static class Names
131+
{
132+
public static readonly string DetectDockerContainer = "DetectDockerContainer";
133+
public static readonly string GetAzureVMMetada = "GetAzureVMMetada";
134+
public static readonly string WindowsPreinstalledGitTelemetry = "WindowsPreinstalledGitTelemetry";
135+
}
136+
}
137+
}
138+
126139
public static class Agent
127140
{
128141
public static readonly TimeSpan ExitOnUnloadTimeout = TimeSpan.FromSeconds(30);

src/Misc/externals.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fi
1818
NODE_VERSION="6.17.1"
1919
NODE10_VERSION="10.24.1"
2020
NODE16_VERSION="16.20.2"
21-
NODE20_VERSION="20.11.1"
21+
NODE20_VERSION="20.13.1"
2222
MINGIT_VERSION="2.43.0"
2323
FF_MINGIT_VERSION="2.44.0"
2424
LFS_VERSION="3.3.0"

src/Misc/layoutbin/installdependencies.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ then
8484
exit 1
8585
fi
8686

87+
package=$(wget -qO- http://security.ubuntu.com/ubuntu/pool/main/o/openssl/ | grep -oP '(libssl1.1_1.1.1f.*?_amd64.deb)' | head -1)
8788
# debian 10 uses libssl1.1
8889
# debian 9 uses libssl1.0.2
8990
# other debian linux use libssl1.0.0
9091
apt install -y libssl3 || apt install -y libssl1.1 || apt install -y libssl1.0.2 || apt install -y libssl1.0.0 || \
91-
(wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb \
92-
&& dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb)
92+
(wget "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/${package}" \
93+
&& dpkg -i $package)
9394
if [ $? -ne 0 ]
9495
then
9596
echo "'apt' failed with exit code '$?'"
@@ -120,9 +121,10 @@ then
120121
# debian 10 uses libssl1.1
121122
# debian 9 uses libssl1.0.2
122123
# other debian linux use libssl1.0.0
124+
package=$(wget -qO- http://security.ubuntu.com/ubuntu/pool/main/o/openssl/ | grep -oP '(libssl1.1_1.1.1f.*?_amd64.deb)' | head -1)
123125
apt-get install -y libssl3 || apt-get install -y libssl1.1 || apt-get install -y libssl1.0.2 || apt-get install -y libssl1.0.0 || \
124-
(wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb \
125-
&& dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb)
126+
(wget "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/${package}" \
127+
&& dpkg -i $package)
126128
if [ $? -ne 0 ]
127129
then
128130
echo "'apt-get' failed with exit code '$?'"

0 commit comments

Comments
 (0)