Skip to content

Commit 1997a2e

Browse files
committed
Resolve conflicts
2 parents b759b6b + 56b07c3 commit 1997a2e

File tree

2,831 files changed

+165891
-57823
lines changed

Some content is hidden

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

2,831 files changed

+165891
-57823
lines changed

.gdn/.gdnbaselines

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,42 @@
1313
}
1414
},
1515
"results": {
16+
"463e7f06abef857daf3e4e724a9a24758bb12b3e3d4d883f27416e88ca27a0fc": {
17+
"signature": "463e7f06abef857daf3e4e724a9a24758bb12b3e3d4d883f27416e88ca27a0fc",
18+
"alternativeSignatures": [],
19+
"memberOf": [
20+
"default"
21+
],
22+
"createdDate": "2024-09-24 08:56:24Z",
23+
"justification": "Skip the test file with example token"
24+
},
25+
"e977f8568efadb9b0d17073d76f54d53f67edc18bf716cf760385cf1fba1c58c": {
26+
"signature": "e977f8568efadb9b0d17073d76f54d53f67edc18bf716cf760385cf1fba1c58c",
27+
"alternativeSignatures": [],
28+
"memberOf": [
29+
"default"
30+
],
31+
"createdDate": "2024-09-24 08:56:24Z",
32+
"justification": "Skip the test file with example token"
33+
},
34+
"e535b5cd08b41e3889b71fe8f5b88a2fcc7cf7b5d170e92c3190eb467ab7bf3b": {
35+
"signature": "e535b5cd08b41e3889b71fe8f5b88a2fcc7cf7b5d170e92c3190eb467ab7bf3b",
36+
"alternativeSignatures": [],
37+
"memberOf": [
38+
"default"
39+
],
40+
"createdDate": "2024-09-24 08:56:24Z",
41+
"justification": "Skip the test file with example token"
42+
},
43+
"d7423c13e23664907fac8e08985d5223a5187cb50aaff29b7eecde1d1cc40510": {
44+
"signature": "d7423c13e23664907fac8e08985d5223a5187cb50aaff29b7eecde1d1cc40510",
45+
"alternativeSignatures": [],
46+
"memberOf": [
47+
"default"
48+
],
49+
"createdDate": "2024-09-24 08:56:24Z",
50+
"justification": "Skip the test file with example token"
51+
},
1652
"10281d0eb6e3cbd458b75591e8332638f1b0ac979db305d3ea11bc2cf12c7f83": {
1753
"signature": "10281d0eb6e3cbd458b75591e8332638f1b0ac979db305d3ea11bc2cf12c7f83",
1854
"alternativeSignatures": [

.github/CODEOWNERS

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ Tasks/AzureWebAppV1/ @microsoft/release-management-task-team @manolerazvan
108108

109109
Tasks/AzureWebAppContainerV1/ @jvano @dannysongg @manolerazvan @microsoft/azure-app-service-pipelines-tasks @microsoft/release-management-task-team
110110

111-
Tasks/AzureVmssDeploymentV0/ @bishal-pdmsft
111+
Tasks/AzureVmssDeploymentV0/ @microsoft/release-management-task-team @manolerazvan
112+
113+
Tasks/AzureVmssDeploymentV1/ @microsoft/release-management-task-team @manolerazvan
112114

113115
Tasks/BashV3/ @microsoft/akvelon-build-task-team
114116

@@ -288,8 +290,12 @@ Tasks/InvokeRestApiV1/ @microsoft/release-management-task-team @manolerazvan
288290

289291
Tasks/JavaToolInstallerV0/ @microsoft/akvelon-build-task-team
290292

293+
Tasks/JavaToolInstallerV1/ @microsoft/akvelon-build-task-team
294+
291295
Tasks/JenkinsDownloadArtifactsV1/ @microsoft/release-management-task-team @manolerazvan
292296

297+
Tasks/JenkinsDownloadArtifactsV2/ @microsoft/release-management-task-team @manolerazvan
298+
293299
Tasks/JenkinsQueueJobV2/ @microsoft/akvelon-build-task-team
294300

295301
Tasks/KubectlInstallerV0/ @microsoft/release-management-task-team @manolerazvan

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,4 @@ _dotnetsdk/
222222
# BuildConfigGen files
223223
FilesOverriddenForConfigGoHereREADME.txt
224224

225+
_generated_local/

BuildConfigGen/EnsureUpdateModeVerifier.cs

Lines changed: 166 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.ComponentModel.Design;
22
using System.Diagnostics;
3+
using System.IO;
34
using System.Security.AccessControl;
45

56
namespace BuildConfigGen
@@ -10,15 +11,17 @@ internal class EnsureUpdateModeVerifier
1011
// if any changes would be made to output, verification should fail
1112
// check the contents of VerifyErrors for verification errors
1213

13-
private readonly bool verifyOnly;
14+
private bool verifyState;
15+
private readonly bool verifyFromConstructor;
1416
private List<string> VerifyErrors = new List<string>();
1517
internal Dictionary<string, string> CopiedFilesToCheck = new Dictionary<string, string>();
1618
internal Dictionary<string, string> RedirectedToTempl = new Dictionary<string, string>();
1719
private HashSet<string> tempsToKeep = new HashSet<string>();
1820

1921
public EnsureUpdateModeVerifier(bool verifyOnly)
2022
{
21-
this.verifyOnly = verifyOnly;
23+
this.verifyState = verifyOnly;
24+
this.verifyFromConstructor = verifyOnly;
2225
}
2326

2427
public IEnumerable<string> GetVerifyErrors(bool skipContentCheck)
@@ -30,7 +33,6 @@ public IEnumerable<string> GetVerifyErrors(bool skipContentCheck)
3033

3134
if (!skipContentCheck)
3235
{
33-
3436
foreach (var r in CopiedFilesToCheck)
3537
{
3638
string? sourceFile;
@@ -75,27 +77,38 @@ public IEnumerable<string> GetVerifyErrors(bool skipContentCheck)
7577

7678
public void CleanupTempFiles()
7779
{
78-
int count = 0;
79-
foreach (var f in RedirectedToTempl.Values)
80+
try
8081
{
81-
count++;
82-
if (!tempsToKeep.Contains(f))
82+
int count = 0;
83+
foreach (var f in RedirectedToTempl.Values)
8384
{
84-
if (File.Exists(f))
85+
count++;
86+
if (!tempsToKeep.Contains(f))
8587
{
86-
File.Delete(f);
88+
if (File.Exists(f))
89+
{
90+
File.Delete(f);
91+
}
8792
}
8893
}
89-
}
9094

91-
if (count > 0 && !verifyOnly)
95+
if (count > 0 && !verifyFromConstructor)
96+
{
97+
throw new Exception("Expected RedirectedToTemp to be empty when !verifyFromConstructor");
98+
}
99+
}
100+
finally
92101
{
93-
throw new Exception("Expected RedirectedToTemp to be empty when !verifyOnly");
102+
this.VerifyErrors.Clear();
103+
this.RedirectedToTempl.Clear();
104+
this.CopiedFilesToCheck.Clear();
94105
}
95106
}
96107

97108
internal void Copy(string sourceFileName, string destFileName, bool overwrite)
98109
{
110+
bool verifyOnly = UseVerifyOnlyForFile(destFileName);
111+
99112
if (verifyOnly)
100113
{
101114
if (File.Exists(destFileName))
@@ -129,6 +142,16 @@ internal void Copy(string sourceFileName, string destFileName, bool overwrite)
129142

130143
internal void Move(string sourceFileName, string destFileName)
131144
{
145+
bool verifyOnlySource = UseVerifyOnlyForFile(sourceFileName);
146+
bool verifyOnlyDest = UseVerifyOnlyForFile(destFileName);
147+
148+
if (verifyOnlySource != verifyOnlyDest)
149+
{
150+
throw new Exception($"BUG: both source and dest must be unconditional path or not sourceFileName={sourceFileName} destFileName={destFileName}");
151+
}
152+
153+
var verifyOnly = verifyOnlySource || verifyOnlyDest;
154+
132155
if (verifyOnly)
133156
{
134157
// verification won't pass if we encounter a move
@@ -151,6 +174,8 @@ internal void Move(string sourceFileName, string destFileName)
151174

152175
internal void WriteAllText(string path, string contents, bool suppressValidationErrorIfTargetPathDoesntExist)
153176
{
177+
bool verifyOnly = UseVerifyOnlyForFile(path);
178+
154179
if (verifyOnly)
155180
{
156181
if (File.Exists(path))
@@ -196,6 +221,8 @@ private string NormalizeFile(string file)
196221

197222
internal void DirectoryCreateDirectory(string path, bool suppressValidationErrorIfTargetPathDoesntExist)
198223
{
224+
bool verifyOnly = UseVerifyOnlyForPath(path);
225+
199226
if (verifyOnly)
200227
{
201228
if (!Directory.Exists(path))
@@ -219,6 +246,8 @@ internal void DirectoryCreateDirectory(string path, bool suppressValidationError
219246

220247
internal string FileReadAllText(string filePath)
221248
{
249+
bool verifyOnly = UseVerifyOnlyForFile(filePath);
250+
222251
if (verifyOnly)
223252
{
224253
string targetFile = ResolveFile(filePath);
@@ -231,8 +260,10 @@ internal string FileReadAllText(string filePath)
231260
}
232261
}
233262

234-
internal string [] FileReadAllLines(string filePath)
263+
internal string[] FileReadAllLines(string filePath)
235264
{
265+
bool verifyOnly = UseVerifyOnlyForFile(filePath);
266+
236267
if (verifyOnly)
237268
{
238269
string targetFile = ResolveFile(filePath);
@@ -254,7 +285,7 @@ internal bool FilesEqual(string sourcePath, string targetPath)
254285

255286
private string ResolveFile(string filePath)
256287
{
257-
if(!verifyOnly)
288+
if (!UseVerifyOnlyForFile(filePath))
258289
{
259290
return filePath;
260291
}
@@ -286,20 +317,138 @@ private string ResolveFile(string filePath)
286317

287318
internal void DeleteDirectoryRecursive(string path)
288319
{
289-
if(verifyOnly)
320+
bool verify = UseVerifyOnlyForPath(path);
321+
322+
if (verify)
290323
{
291-
if(Directory.Exists(path))
324+
if (Directory.Exists(path))
292325
{
293326
VerifyErrors.Add($"Expected directory {path} to not exist");
294327
}
295328
}
296329
else
297330
{
298-
if(Directory.Exists(path))
331+
if (Directory.Exists(path))
299332
{
300333
Directory.Delete(path, true);
301334
}
302335
}
303336
}
337+
338+
private bool UseVerifyOnlyForFile(string file)
339+
{
340+
return UseVerifyOnlyInternal(file, true);
341+
}
342+
343+
private bool UseVerifyOnlyForPath(string path)
344+
{
345+
return UseVerifyOnlyInternal(path, false);
346+
}
347+
348+
private bool UseVerifyOnlyInternal(string path, bool trueForFile)
349+
{
350+
EnsureState();
351+
352+
/*
353+
// if verifyOnly state
354+
if (verifyState)
355+
{
356+
return true;
357+
}*/
358+
359+
// if !verifyOnly was passed to constructor, unconditional writes everywhere
360+
if (!verifyFromConstructor)
361+
{
362+
return false;
363+
}
364+
365+
// if uncondo
366+
if (allowedUnconditionalPath is null)
367+
{
368+
return verifyState;
369+
}
370+
371+
if (trueForFile ? IsSubFile(allowedUnconditionalPath, path) : IsSubPath(allowedUnconditionalPath, path))
372+
{
373+
return false;
374+
}
375+
else
376+
{
377+
return true;
378+
}
379+
}
380+
381+
string? allowedUnconditionalPath;
382+
383+
internal void StartUnconditionalWrites(string allowedUnconditionalPath)
384+
{
385+
EnsureState();
386+
387+
if(verifyState != verifyFromConstructor)
388+
{
389+
throw new Exception($"BUG: expected verifyState {verifyState} == verifyFromConstructor {verifyFromConstructor}");
390+
}
391+
392+
if (!verifyFromConstructor)
393+
{
394+
return;
395+
}
396+
397+
verifyState = false;
398+
this.allowedUnconditionalPath = allowedUnconditionalPath;
399+
}
400+
401+
internal void ResumeWriteBehavior()
402+
{
403+
EnsureState();
404+
405+
if (!verifyFromConstructor)
406+
{
407+
return;
408+
}
409+
410+
verifyState = verifyFromConstructor;
411+
this.allowedUnconditionalPath = null;
412+
}
413+
414+
private void EnsureState()
415+
{
416+
if(!verifyFromConstructor && verifyState)
417+
{
418+
throw new Exception("BUG: verifyState cannot be true if verifyFromConstructor is false");
419+
}
420+
421+
if (verifyFromConstructor)
422+
{
423+
if (this.allowedUnconditionalPath is null && !verifyState)
424+
{
425+
throw new Exception($"BUG: expected allowedUnconditionalPath={allowedUnconditionalPath} to be not null when !verifyState=={!verifyState}");
426+
}
427+
}
428+
else
429+
{
430+
if (this.allowedUnconditionalPath is not null)
431+
{
432+
throw new Exception($"BUG: expected allowedUnconditionalPath={allowedUnconditionalPath} to be null");
433+
}
434+
}
435+
}
436+
437+
// generaetd by copilot 20240926
438+
static bool IsSubPath(string mainPath, string subPath)
439+
{
440+
var mainDirectory = new DirectoryInfo(mainPath).FullName;
441+
var subDirectory = new DirectoryInfo(subPath).FullName;
442+
443+
return subDirectory.StartsWith(mainDirectory, StringComparison.OrdinalIgnoreCase);
444+
}
445+
446+
static bool IsSubFile(string mainPath, string subFile)
447+
{
448+
var mainDirectory = new DirectoryInfo(mainPath).FullName;
449+
var subDirectory = new FileInfo(subFile).FullName;
450+
451+
return subDirectory.StartsWith(mainDirectory, StringComparison.OrdinalIgnoreCase);
452+
}
304453
}
305454
}

0 commit comments

Comments
 (0)