Skip to content

Commit 24bd84a

Browse files
authored
[Tools] Fix the issue of CI Pipeline (#14222)
* Fix the issue that cannot fine valid module for Generated module in CI pipeline * Fix the issue that Target module fails Co-authored-by: wyunchi-ms <[email protected]>
1 parent 319b8e6 commit 24bd84a

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

.ci-config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@
225225
"tools/CheckIgnoredFile.ps1",
226226
"tools/CleanupBuild.ps1",
227227
"tools/CommonIncrementVersion.ps1",
228-
"tools/CreateAliasMapping.ps1",
229228
"tools/CreateMappings_rules.json",
230229
"tools/CreateMappings.ps1",
231230
"tools/CreateRegistryEntry.ps1"

tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/CIFilterTask.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,11 @@ public override bool Execute()
414414
var csprojMap = ReadMapFile(CsprojMapFilePath, "CsprojMapFilePath");
415415

416416
Console.WriteLine(string.Format("FilesChanged: {0}", FilesChanged.Length));
417-
if (FilesChanged != null)
417+
if (!string.IsNullOrWhiteSpace(TargetModule))
418+
{
419+
return ProcessTargetModule(csprojMap);
420+
}
421+
else if (FilesChanged != null)
418422
{
419423
if (FilesChanged.Length > 0)
420424
{
@@ -435,10 +439,6 @@ public override bool Execute()
435439
return true;
436440
}
437441
}
438-
else if (!string.IsNullOrWhiteSpace(TargetModule))
439-
{
440-
return ProcessTargetModule(csprojMap);
441-
}
442442
return true;
443443
}
444444
}

tools/CreateFilterMappings.ps1

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,17 @@ function Create-CsprojMappings
251251
<#
252252
Maps a normalized path to the projects to be built based on the service folder provided.
253253
#>
254+
255+
function Get-ModuleFromPath
256+
{
257+
param
258+
(
259+
[Parameter(Mandatory = $true)]
260+
[string]$FilePath
261+
)
262+
263+
return $FilePath.Replace('/', '\').Split('\src\')[1].Split('\')[0]
264+
}
254265
function Add-CsprojMappings
255266
{
256267
param
@@ -267,14 +278,12 @@ function Add-CsprojMappings
267278
$Values = New-Object System.Collections.Generic.HashSet[string]
268279
foreach ($CsprojFile in $CsprojFiles)
269280
{
270-
$Fields = $CsprojFile.FullName.Replace('/', '\').Split('\')
271-
$Project = $Fields[$Fields.Length - 3]
281+
$Project = Get-ModuleFromPath $CsprojFile.FullName
272282
foreach ($ProjectName in $Script:ProjectToSolutionMappings.Keys)
273283
{
274284
foreach ($Solution in $Script:ProjectToSolutionMappings[$ProjectName])
275285
{
276-
$Fields = $Solution.Replace('/', '\').Split('\')
277-
$ProjectNameFromSolution = $Fields[$Fields.Length - 2]
286+
$ProjectNameFromSolution = Get-ModuleFromPath $Solution
278287
if ($ProjectNameFromSolution -eq $Project)
279288
{
280289
foreach ($ReferencedProject in $Script:SolutionToProjectMappings[$Solution])

0 commit comments

Comments
 (0)