Skip to content

Commit 8264e8f

Browse files
azure-powershell-botazurepowershell
andauthored
Sync tools folder from main branch to generation branch (#23843)
Co-authored-by: azurepowershell <[email protected]>
1 parent 2269c82 commit 8264e8f

File tree

4 files changed

+44
-21
lines changed

4 files changed

+44
-21
lines changed

.azure-pipelines/code-sign.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ parameters:
33
displayName: Branch for OOB pipeline
44
type: string
55
default: 'none'
6+
- name: TargetModule
7+
displayName: Build Module List(Split by ':')
8+
type: string
9+
default: 'none'
10+
- name: BuildInstaller
11+
displayName: Build Installer
12+
type: boolean
13+
default: true
614
jobs:
715
- job: Release
816
timeoutInMinutes: 180
@@ -31,10 +39,19 @@ jobs:
3139

3240
- task: DotNetCoreCLI@2
3341
displayName: Build
42+
condition: ne('${{ parameters.TargetModule }}', 'none')
43+
inputs:
44+
command: custom
45+
custom: msbuild
46+
arguments: 'build.proj /t:"Build;CopyAboutTopics;GenerateHelp" /p:"Configuration=Release;GenerateDocumentationFile=true;TargetModule=${{ parameters.TargetModule }}"'
47+
- task: DotNetCoreCLI@2
48+
displayName: Build
49+
condition: eq('${{ parameters.TargetModule }}', 'none')
3450
inputs:
3551
command: custom
3652
custom: msbuild
37-
arguments: 'build.proj /t:"Build;CopyAboutTopics;GenerateHelp" /p:"Configuration=Release;GenerateDocumentationFile=true"'
53+
arguments: 'build.proj /t:"Build;CopyAboutTopics;GenerateHelp" /p:"Configuration=Release;GenerateDocumentationFile=true;ModifiedModuleBuild=true"'
54+
3855

3956
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
4057
displayName: 'Manifest Generator '
@@ -359,9 +376,11 @@ jobs:
359376
./setup/generate.ps1 -repository MSIcreationrepository
360377
Unregister-PSRepository -Name MSIcreationrepository
361378
displayName: 'Build Installer'
379+
condition: eq(${{ parameters.buildInstaller }}, true)
362380
363381
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@4
364382
displayName: 'Installer Signing [Authenticode]'
383+
condition: eq(${{ parameters.buildInstaller }}, true)
365384
inputs:
366385
ConnectedServiceName: 'ESRP Signing Service'
367386
FolderPath: setup
@@ -404,9 +423,11 @@ jobs:
404423
Get-ChildItem $Env:RepoArtifacts/$folderName
405424
Copy-Item $Env:RepoArtifacts/$Env:Configuration/InstallModule.ps1 -Destination $Env:RepoArtifacts/$folderName
406425
displayName: 'Gather nuget packages and install script'
426+
condition: eq(${{ parameters.buildInstaller }}, true)
407427
408428
- task: ArchiveFiles@2
409429
displayName: 'Pack nuget packages as Az-Cmdlets-latest.tar.gz'
430+
condition: eq(${{ parameters.buildInstaller }}, true)
410431
inputs:
411432
rootFolderOrFile: 'artifacts/$(LocalRepoName)'
412433
includeRootFolder: false
@@ -432,9 +453,11 @@ jobs:
432453
" - "+$sha256.Hash+"`n"
433454
New-Item -Path "setup" -Name "ReleaseNotes.txt" -ItemType File -Force -Value $value
434455
displayName: 'Rename Az-Cmdlets-latest.tar.gz and Calculate SHA256'
456+
condition: eq(${{ parameters.buildInstaller }}, true)
435457
436458
- task: PublishBuildArtifacts@1
437459
displayName: 'Publish Artifact: installer'
460+
condition: eq(${{ parameters.buildInstaller }}, true)
438461
inputs:
439462
PathtoPublish: setup
440463
ArtifactName: setup
@@ -468,4 +491,4 @@ jobs:
468491
Get-ChildItem -Path $Env:RepoArtifacts -Filter Az.*.0.*.*.nupkg | Compress-Archive -DestinationPath "$buildName-preview.zip" -PassThru | Set-AzStorageBlobContent -Container $(ContainerName) -Context $context -Force
469492
azurePowerShellVersion: LatestVersion
470493
pwsh: true
471-
condition: and(succeeded(), eq(variables['PushPackageToStorageAccount'], 'true'))
494+
condition: and(succeeded(), eq(variables['PushPackageToStorageAccount'], 'true'), eq(${{ parameters.buildInstaller }}, true))

tools/RunVersionController.ps1

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ Param(
2121
[string]$GalleryName = "PSGallery",
2222

2323
[Parameter()]
24-
[string]$ArtifactsOutputPath = "$PSScriptRoot/../artifacts/Release/",
25-
26-
[Parameter()]
27-
[switch]$GenerateSyntaxChangelog
24+
[string]$ArtifactsOutputPath = "$PSScriptRoot/../artifacts/Release/"
2825
)
2926

3027
enum PSVersion
@@ -403,8 +400,16 @@ function Update-AzSyntaxChangelog
403400
Write-Host "starting revise SyntaxChangeLog"
404401
$rootPath = "$PSScriptRoot\.."
405402
$NewVersion = (Import-PowerShellDataFile "$PSScriptRoot\Az\Az.psd1").ModuleVersion
406-
Update-ChangeLog -Content "## $NewVersion - $Release" -FilePath "$rootPath\documentation\SyntaxChangeLog.md"
407-
$changeLog = Get-Content "$rootPath\documentation\SyntaxChangeLog.md" -Raw
403+
$majorVersion = $NewVersion.Split('.')[0]
404+
$syntaxChangeLog = "$rootPath\documentation\SyntaxChangeLog\SyntaxChangeLog.md"
405+
Update-ChangeLog -Content "## $NewVersion - $Release" -FilePath $syntaxChangeLog
406+
$changeLog = Get-Content $syntaxChangeLog -Raw
407+
$targetFile = "$rootPath\documentation\SyntaxChangeLog\SyntaxChangeLog-Az$majorVersion.md"
408+
if (-not (Test-Path $targetFile)) {
409+
New-Item -Path $targetFile -ItemType File
410+
}
411+
$currentContent = Get-Content -Path $targetFile -Raw
412+
$newContent = $changeLog + "`r`n" + $currentContent
408413
$regex = '####\s+(Az\.\w+)\s+(?![\d\.])'
409414
$matches = Select-String -Pattern $regex -InputObject $changelog -AllMatches
410415
foreach ($match in $matches.Matches) {
@@ -414,7 +419,8 @@ function Update-AzSyntaxChangelog
414419
$replacement = "#### $moduleName $newVersion `r`n"
415420
$changelog = $changelog -replace [regex]::Escape($match.Value), $replacement
416421
}
417-
Set-Content -Path "$rootPath\documentation\SyntaxChangeLog.md" -Value $changelog
422+
Set-Content -Path $targetFile -Value $newContent
423+
Remove-Item -Path $syntaxChangeLog
418424
}
419425

420426
function New-CommandMappingFile
@@ -523,9 +529,7 @@ switch ($PSCmdlet.ParameterSetName)
523529
# Refresh AzPreview.psd1
524530
Update-AzPreview
525531
Update-AzPreviewChangelog
526-
if ($GenerateSyntaxChangelog){
527-
Update-AzSyntaxChangelog
528-
}
532+
Update-AzSyntaxChangelog
529533
# We need to generate the upcoming-breaking-changes.md after the process of bump version in minor release
530534
if ([PSVersion]::MINOR -Eq $versionBump)
531535
{

tools/VersionController/Models/SyntaxChangelogGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,13 @@ public void Analyze(String rootDirectory)
4343
var executingPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).AbsolutePath);
4444
Directory.SetCurrentDirectory(executingPath);
4545
var newModuleMetadata = MetadataLoader.GetModuleMetadata(moduleName);
46-
Console.WriteLine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", ".."));
4746
var filePath = Path.Combine(executingPath, "SerializedCmdlets", $"{moduleName}.json");
4847
if (!File.Exists(filePath)) continue;
4948
var oldModuleMetadata = ModuleMetadata.DeserializeCmdlets(filePath);
5049
CmdletLoader.ModuleMetadata = newModuleMetadata;
5150
CompareModuleMetedata(oldModuleMetadata, newModuleMetadata, moduleName);
5251
}
53-
var markDownPath = Path.Combine(rootDirectory, "documentation/SyntaxChangeLog.md");
52+
var markDownPath = Path.Combine(rootDirectory, "documentation/SyntaxChangeLog/SyntaxChangeLog.md");
5453
GenerateMarkdown(markDownPath);
5554
Console.WriteLine("Cmdlets Differences written to {0}", markDownPath);
5655
}
@@ -445,6 +444,7 @@ public void GenerateMarkdown(string filePath)
445444
}
446445
}
447446
}
447+
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
448448
File.AppendAllText(filePath, sb.ToString());
449449
}
450450
private string FormatListString(List<string> list, Func<string, string> formatter)

tools/VersionController/Program.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static void Main(string[] args)
5151
var executingAssemblyPath = Assembly.GetExecutingAssembly().Location;
5252
var versionControllerDirectory = Directory.GetParent(executingAssemblyPath).FullName;
5353
var artifactsDirectory = Directory.GetParent(versionControllerDirectory).FullName;
54-
var syntaxChangelog = "false";
54+
var syntaxChangelog = true;
5555
_rootDirectory = Directory.GetParent(artifactsDirectory).FullName;
5656
_projectDirectories = new List<string>{ Path.Combine(_rootDirectory, @"src\") }.Where((d) => Directory.Exists(d)).ToList();
5757
_outputDirectories = new List<string>{ Path.Combine(_rootDirectory, @"artifacts\Release\") }.Where((d) => Directory.Exists(d)).ToList();
@@ -61,6 +61,7 @@ public static void Main(string[] args)
6161
if (args != null && args.Length > 0)
6262
{
6363
exceptionsDirectory = args[0];
64+
syntaxChangelog = false;
6465
}
6566

6667
if (!Directory.Exists(exceptionsDirectory))
@@ -74,14 +75,9 @@ public static void Main(string[] args)
7475
_moduleNameFilter = args[1] + Psd1NameExtension;
7576
}
7677

77-
if (args != null && args.Length > 2)
78-
{
79-
syntaxChangelog = args[2];
80-
}
81-
8278
ConsolidateExceptionFiles(exceptionsDirectory);
8379
ValidateManifest();
84-
if (syntaxChangelog.Equals("true", System.StringComparison.OrdinalIgnoreCase)) {
80+
if (syntaxChangelog) {
8581
GenerateSyntaxChangelog(_rootDirectory);
8682
}
8783
BumpVersions();

0 commit comments

Comments
 (0)