Skip to content

Commit 810efb8

Browse files
committed
Merge branch 'master' into Localization
2 parents 3140efa + 3d25a34 commit 810efb8

Some content is hidden

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

42 files changed

+536
-391
lines changed

.azure-pipelines/build-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ jobs:
186186
- task: UseDotNet@2
187187
displayName: Install .NET Core 6 SDK
188188
inputs:
189-
version: '6.0.421'
189+
version: '6.0.424'
190190
packageType: sdk
191191
performMultiLevelLookup: true
192192
- script: ${{ variables.devCommand }} testl1 Debug ${{ parameters.os }}-${{ parameters.arch }}

.vsts.release.yml

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
2-
32
trigger:
3+
branches:
4+
include:
5+
- '*'
6+
paths:
7+
include:
8+
- release
9+
- .azure-pipelines
10+
- .vsts.release.yml
11+
12+
pr:
13+
branches:
14+
include:
15+
- '*'
416
paths:
517
include:
618
- release
@@ -344,15 +356,43 @@ extends:
344356
displayName: Delete test agent release from Github
345357
condition: and(succeeded(), eq(variables.IsTestRun, 'True'))
346358
347-
# Clean up test release branch
359+
- stage: Cleanup_Release_Branch
360+
displayName: Cleanup Release Branch
361+
dependsOn:
362+
- Verify_release
363+
- Create_Release_Branch
364+
- Release
365+
condition: always()
366+
jobs:
367+
- job: Delete_Release_Branch
368+
displayName: Delete Release Branch
369+
variables:
370+
IsTestRun: $[ stageDependencies.Verify_release.Set_variables.outputs['SetReleaseVariables.isTestRun'] ]
371+
condition: eq(variables.IsTestRun, 'True')
372+
373+
pool:
374+
name: 1ES-ABTT-Shared-Pool
375+
image: abtt-ubuntu-2204
376+
os: linux
377+
steps:
378+
- checkout: self
379+
348380
- powershell: |
349381
git config --global user.email "[email protected]"
350382
git config --global user.name "azure-pipelines-bot"
351383
git status
352-
git -c credential.helper='!f() { echo "username=pat"; echo "password=$(GithubToken)"; };f' push origin --delete $(ReleaseBranch)
353-
git push --delete origin v$(AgentVersion)
384+
385+
$testBranch = "releases/3.000.999"
386+
$testTag = "v3.000.999"
387+
388+
if (git ls-remote --heads origin $testBranch) {
389+
git -c credential.helper='!f() { echo "username=pat"; echo "password=$(GithubToken)"; };f' push origin --delete $testBranch
390+
}
391+
392+
if (git ls-remote --tags origin $testTag) {
393+
git -c credential.helper='!f() { echo "username=pat"; echo "password=$(GithubToken)"; };f' push --delete origin $testTag
394+
}
354395
displayName: Clean up test release branch
355-
condition: and(succeeded(), eq(variables.IsTestRun, 'True'))
356396
357397
- stage: CreatePRs
358398
dependsOn:
@@ -395,7 +435,7 @@ extends:
395435
cd release
396436
npm install
397437
ls
398-
node createAdoPrs.js $(AgentVersion) --dryrun=$(IsTestRun)
438+
node createAdoPrs.js $(AgentVersion) --dryrun="$(IsTestRun)"
399439
name: s_CreateAdoPrs
400440
displayName: Create PRs in AzureDevOps and ConfigChange
401441
env:

release/createAdoPrs.js

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const INTEGRATION_DIR = path.join(__dirname, '..', '_layout', 'integrations');
99
const GIT = 'git';
1010

1111
const opt = require('node-getopt').create([
12-
['', 'dryrun', 'Dry run only, do not actually commit new release'],
12+
['', 'dryrun=ARG', 'Dry run only, do not actually commit new release'],
1313
['h', 'help', 'Display this help'],
1414
])
1515
.setHelp(
@@ -78,14 +78,14 @@ function clearEmptyHashValueLine(filePath) {
7878
* @param {string} description pull reqest description
7979
* @param {string[]} targetsToCommit files to add in pull request
8080
*/
81-
async function openPR(repo, project, sourceBranch, targetBranch, commitMessage, title, description, targetsToCommit) {
81+
async function openPR(repo, project, sourceBranch, targetBranch, commitMessage, title, description, targetsToCommit, dryrun = false) {
8282
console.log(`Creating PR from "${sourceBranch}" into "${targetBranch}" in the "${project}/${repo}" repo`);
8383

8484
const repoPath = path.join(INTEGRATION_DIR, repo);
8585

8686
if (!fs.existsSync(repoPath)) {
8787
const gitUrl = `https://${process.env.PAT}@${orgUrl}/${project}/_git/${repo}`;
88-
util.execInForeground(`${GIT} clone --depth 1 ${gitUrl} ${repoPath}`, null, opt.options.dryrun);
88+
util.execInForeground(`${GIT} clone --depth 1 ${gitUrl} ${repoPath}`, null, dryrun);
8989
}
9090

9191
for (const targetToCommit of targetsToCommit) {
@@ -95,7 +95,7 @@ async function openPR(repo, project, sourceBranch, targetBranch, commitMessage,
9595
const sourceFile = path.join(INTEGRATION_DIR, fileName);
9696
const targetFile = path.join(fullPath, fileName);
9797

98-
if (opt.options.dryrun) {
98+
if (dryrun) {
9999
console.log(`Fake copy file from ${sourceFile} to ${targetFile}`);
100100
} else {
101101
console.log(`Copy file from ${sourceFile} to ${targetFile}`);
@@ -105,12 +105,12 @@ async function openPR(repo, project, sourceBranch, targetBranch, commitMessage,
105105
}
106106

107107
for (const targetToCommit of targetsToCommit) {
108-
util.execInForeground(`${GIT} add ${targetToCommit}`, repoPath, opt.options.dryrun);
108+
util.execInForeground(`${GIT} add ${targetToCommit}`, repoPath, dryrun);
109109
}
110110

111-
util.execInForeground(`${GIT} checkout -b ${sourceBranch}`, repoPath, opt.options.dryrun);
112-
util.execInForeground(`${GIT} commit -m "${commitMessage}"`, repoPath, opt.options.dryrun);
113-
util.execInForeground(`${GIT} push --force origin ${sourceBranch}`, repoPath, opt.options.dryrun);
111+
util.execInForeground(`${GIT} checkout -b ${sourceBranch}`, repoPath, dryrun);
112+
util.execInForeground(`${GIT} commit -m "${commitMessage}"`, repoPath, dryrun);
113+
util.execInForeground(`${GIT} push --force origin ${sourceBranch}`, repoPath, dryrun);
114114

115115
const prefix = 'refs/heads/';
116116

@@ -129,7 +129,7 @@ async function openPR(repo, project, sourceBranch, targetBranch, commitMessage,
129129

130130
if (PR) {
131131
console.log('PR already exists');
132-
} else if (opt.options.dryrun) {
132+
} else if (dryrun) {
133133
return [-1, 'test']; // return without creating PR for test runs
134134
} else {
135135
console.log('PR does not exist; creating PR');
@@ -169,8 +169,16 @@ async function main() {
169169
util.verifyMinimumNodeVersion();
170170
util.verifyMinimumGitVersion();
171171
createIntegrationFiles(agentVersion);
172-
util.execInForeground(`${GIT} config --global user.email "${process.env.USEREMAIL}"`, null, opt.options.dryrun);
173-
util.execInForeground(`${GIT} config --global user.name "${process.env.USERNAME}"`, null, opt.options.dryrun);
172+
173+
let dryrun = false;
174+
if (opt.options.dryrun) {
175+
dryrun = opt.options.dryrun.toString().toLowerCase() === "true"
176+
}
177+
178+
console.log(`Dry run: ${dryrun}`);
179+
180+
util.execInForeground(`${GIT} config --global user.email "${process.env.USEREMAIL}"`, null, dryrun);
181+
util.execInForeground(`${GIT} config --global user.name "${process.env.USERNAME}"`, null, dryrun);
174182

175183
const sprint = await getCurrentSprint();
176184

@@ -191,7 +199,8 @@ async function main() {
191199
path.join(
192200
'DistributedTask', 'Service', 'Servicing', 'Host', 'Deployment', 'Groups', 'UpdateAgentPackage.xml'
193201
),
194-
]
202+
],
203+
dryrun
195204
);
196205

197206
const [ccPrId, ccPrLink] = await openPR(
@@ -202,7 +211,8 @@ async function main() {
202211
path.join(
203212
'tfs', `m${sprint}`, 'PipelinesAgentRelease', agentVersion, 'Publish.ps1'
204213
)
205-
]
214+
],
215+
dryrun
206216
);
207217

208218
console.log(`##vso[task.setvariable variable=AdoPrId;isOutput=true]${adoPrId}`);

src/Agent.Listener/Agent.Listener.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Azure.Identity" Version="1.11.0" />
16+
<PackageReference Include="Azure.Core" Version="1.42.0" />
17+
<PackageReference Include="Azure.Identity" Version="1.12.0" />
1718
<PackageReference Include="CommandLineParser" Version="2.7.82" />
1819
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="19.230.0-preview" />
1920
<PackageReference Include="Microsoft.VisualStudio.Services.InteractiveClient" Version="19.230.0-preview" />
@@ -29,7 +30,7 @@
2930
</ItemGroup>
3031

3132
<ItemGroup>
32-
<None Update="net6.json">
33+
<None Update="net8.json">
3334
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3435
</None>
3536
</ItemGroup>

src/Agent.Listener/Agent.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ public async Task<int> ExecuteCommand(CommandSettings command)
216216
Trace.Info($"Set agent startup type - {startType}");
217217
HostContext.StartupType = startType;
218218

219+
bool debugModeEnabled = command.GetDebugMode();
220+
221+
if (debugModeEnabled)
222+
{
223+
Trace.Warning("Agent is running in debug mode, don't use it in production");
224+
settings.DebugMode = true;
225+
store.SaveSettings(settings);
226+
}
227+
else if (settings.DebugMode && !debugModeEnabled)
228+
{
229+
settings.DebugMode = false;
230+
store.SaveSettings(settings);
231+
}
232+
219233
if (PlatformUtil.RunningOnWindows)
220234
{
221235
if (store.IsAutoLogonConfigured())

src/Agent.Listener/CommandLine/ConfigureAgent.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ public class ConfigureAgent : ConfigureOrRemoveBase
6060
[Option(Constants.Agent.CommandLine.Flags.DisableLogUploads)]
6161
public bool DisableLogUploads { get; set; }
6262

63+
[Option(Constants.Agent.CommandLine.Flags.ReStreamLogsToFiles)]
64+
public bool ReStreamLogsToFiles { get; set; }
65+
6366
[Option(Constants.Agent.CommandLine.Flags.MachineGroup)]
6467
public bool MachineGroup { get; set; }
6568

src/Agent.Listener/CommandLine/RunAgent.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ public class RunAgent : BaseCommand
1818

1919
[Option(Constants.Agent.CommandLine.Args.StartupType)]
2020
public string StartupType { get; set; }
21+
22+
[Option(Constants.Agent.CommandLine.Flags.DebugMode)]
23+
public bool DebugMode { get; set; }
2124
}
2225
}

src/Agent.Listener/CommandSettings.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,11 @@ public bool GetRunOnce()
550550
TestFlag(Run?.RunOnce, Constants.Agent.CommandLine.Flags.Once);
551551
}
552552

553+
public bool GetDebugMode()
554+
{
555+
return TestFlag(Run?.DebugMode, Constants.Agent.CommandLine.Flags.DebugMode);
556+
}
557+
553558
public bool GetDeploymentPool()
554559
{
555560
return TestFlag(Configure?.DeploymentPool, Constants.Agent.CommandLine.Flags.DeploymentPool);
@@ -571,6 +576,11 @@ public bool GetDisableLogUploads()
571576
return TestFlag(Configure?.DisableLogUploads, Constants.Agent.CommandLine.Flags.DisableLogUploads);
572577
}
573578

579+
public bool GetReStreamLogsToFiles()
580+
{
581+
return TestFlag(Configure?.ReStreamLogsToFiles, Constants.Agent.CommandLine.Flags.ReStreamLogsToFiles);
582+
}
583+
574584
public bool Unattended()
575585
{
576586
if (TestFlag(GetConfigureOrRemoveBase()?.Unattended, Constants.Agent.CommandLine.Flags.Unattended))

src/Agent.Listener/Configuration/ConfigurationManager.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,12 @@ public async Task ConfigureAsync(CommandSettings command)
398398
agentSettings.NotificationSocketAddress = command.GetNotificationSocketAddress();
399399

400400
agentSettings.DisableLogUploads = command.GetDisableLogUploads();
401+
agentSettings.ReStreamLogsToFiles = command.GetReStreamLogsToFiles();
402+
403+
if (agentSettings.DisableLogUploads && agentSettings.ReStreamLogsToFiles)
404+
{
405+
throw new NotSupportedException(StringUtil.Loc("ReStreamLogsToFilesError"));
406+
}
401407

402408
agentSettings.AlwaysExtractTask = command.GetAlwaysExtractTask();
403409

@@ -736,7 +742,7 @@ private void CheckAgentRootDirectorySecure()
736742
// Get info about root folder
737743
DirectoryInfo dirInfo = new DirectoryInfo(rootDirPath);
738744

739-
// Get directory access control list
745+
// Get directory access control list
740746
DirectorySecurity directorySecurityInfo = dirInfo.GetAccessControl();
741747
AuthorizationRuleCollection dirAccessRules = directorySecurityInfo.GetAccessRules(true, true, typeof(NTAccount));
742748

src/Agent.Listener/Configuration/FeatureFlagProvider.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public async Task<FeatureFlag> GetFeatureFlagWithCred(IHostContext context, stri
7171
Trace.Warning("Unable to retrieve feature flag with following exception: " + e.ToString());
7272
return new FeatureFlag(featureFlagName, "", "", "Off", "Off");
7373
}
74+
catch (TimeoutException e)
75+
{
76+
Trace.Warning("Unable to retrieve feature flag status due to timeout error: " + e.ToString());
77+
return new FeatureFlag(featureFlagName, "", "", "Off", "Off");
78+
}
7479
}
7580
}
7681
}

0 commit comments

Comments
 (0)