diff --git a/.azure-pipelines/code-sign.yml b/.azure-pipelines/code-sign.yml index cec9b4b7857c..87115c59a9c4 100644 --- a/.azure-pipelines/code-sign.yml +++ b/.azure-pipelines/code-sign.yml @@ -3,6 +3,14 @@ parameters: displayName: Branch for OOB pipeline type: string default: 'none' +- name: TargetModule + displayName: Build Module List(Split by ':') + type: string + default: 'none' +- name: BuildInstaller + displayName: Build Installer + type: boolean + default: true jobs: - job: Release timeoutInMinutes: 180 @@ -31,10 +39,19 @@ jobs: - task: DotNetCoreCLI@2 displayName: Build + condition: ne('${{ parameters.TargetModule }}', 'none') + inputs: + command: custom + custom: msbuild + arguments: 'build.proj /t:"Build;CopyAboutTopics;GenerateHelp" /p:"Configuration=Release;GenerateDocumentationFile=true;TargetModule=${{ parameters.TargetModule }}"' + - task: DotNetCoreCLI@2 + displayName: Build + condition: eq('${{ parameters.TargetModule }}', 'none') inputs: command: custom custom: msbuild - arguments: 'build.proj /t:"Build;CopyAboutTopics;GenerateHelp" /p:"Configuration=Release;GenerateDocumentationFile=true"' + arguments: 'build.proj /t:"Build;CopyAboutTopics;GenerateHelp" /p:"Configuration=Release;GenerateDocumentationFile=true;ModifiedModuleBuild=true"' + - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 displayName: 'Manifest Generator ' @@ -359,9 +376,11 @@ jobs: ./setup/generate.ps1 -repository MSIcreationrepository Unregister-PSRepository -Name MSIcreationrepository displayName: 'Build Installer' + condition: eq(${{ parameters.buildInstaller }}, true) - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@4 displayName: 'Installer Signing [Authenticode]' + condition: eq(${{ parameters.buildInstaller }}, true) inputs: ConnectedServiceName: 'ESRP Signing Service' FolderPath: setup @@ -404,9 +423,11 @@ jobs: Get-ChildItem $Env:RepoArtifacts/$folderName Copy-Item $Env:RepoArtifacts/$Env:Configuration/InstallModule.ps1 -Destination $Env:RepoArtifacts/$folderName displayName: 'Gather nuget packages and install script' + condition: eq(${{ parameters.buildInstaller }}, true) - task: ArchiveFiles@2 displayName: 'Pack nuget packages as Az-Cmdlets-latest.tar.gz' + condition: eq(${{ parameters.buildInstaller }}, true) inputs: rootFolderOrFile: 'artifacts/$(LocalRepoName)' includeRootFolder: false @@ -432,9 +453,11 @@ jobs: " - "+$sha256.Hash+"`n" New-Item -Path "setup" -Name "ReleaseNotes.txt" -ItemType File -Force -Value $value displayName: 'Rename Az-Cmdlets-latest.tar.gz and Calculate SHA256' + condition: eq(${{ parameters.buildInstaller }}, true) - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: installer' + condition: eq(${{ parameters.buildInstaller }}, true) inputs: PathtoPublish: setup ArtifactName: setup @@ -468,4 +491,4 @@ jobs: Get-ChildItem -Path $Env:RepoArtifacts -Filter Az.*.0.*.*.nupkg | Compress-Archive -DestinationPath "$buildName-preview.zip" -PassThru | Set-AzStorageBlobContent -Container $(ContainerName) -Context $context -Force azurePowerShellVersion: LatestVersion pwsh: true - condition: and(succeeded(), eq(variables['PushPackageToStorageAccount'], 'true')) + condition: and(succeeded(), eq(variables['PushPackageToStorageAccount'], 'true'), eq(${{ parameters.buildInstaller }}, true)) diff --git a/tools/RunVersionController.ps1 b/tools/RunVersionController.ps1 index d7f980f5a7c8..0a39b8e0d97c 100644 --- a/tools/RunVersionController.ps1 +++ b/tools/RunVersionController.ps1 @@ -21,10 +21,7 @@ Param( [string]$GalleryName = "PSGallery", [Parameter()] - [string]$ArtifactsOutputPath = "$PSScriptRoot/../artifacts/Release/", - - [Parameter()] - [switch]$GenerateSyntaxChangelog + [string]$ArtifactsOutputPath = "$PSScriptRoot/../artifacts/Release/" ) enum PSVersion @@ -403,8 +400,16 @@ function Update-AzSyntaxChangelog Write-Host "starting revise SyntaxChangeLog" $rootPath = "$PSScriptRoot\.." $NewVersion = (Import-PowerShellDataFile "$PSScriptRoot\Az\Az.psd1").ModuleVersion - Update-ChangeLog -Content "## $NewVersion - $Release" -FilePath "$rootPath\documentation\SyntaxChangeLog.md" - $changeLog = Get-Content "$rootPath\documentation\SyntaxChangeLog.md" -Raw + $majorVersion = $NewVersion.Split('.')[0] + $syntaxChangeLog = "$rootPath\documentation\SyntaxChangeLog\SyntaxChangeLog.md" + Update-ChangeLog -Content "## $NewVersion - $Release" -FilePath $syntaxChangeLog + $changeLog = Get-Content $syntaxChangeLog -Raw + $targetFile = "$rootPath\documentation\SyntaxChangeLog\SyntaxChangeLog-Az$majorVersion.md" + if (-not (Test-Path $targetFile)) { + New-Item -Path $targetFile -ItemType File + } + $currentContent = Get-Content -Path $targetFile -Raw + $newContent = $changeLog + "`r`n" + $currentContent $regex = '####\s+(Az\.\w+)\s+(?![\d\.])' $matches = Select-String -Pattern $regex -InputObject $changelog -AllMatches foreach ($match in $matches.Matches) { @@ -414,7 +419,8 @@ function Update-AzSyntaxChangelog $replacement = "#### $moduleName $newVersion `r`n" $changelog = $changelog -replace [regex]::Escape($match.Value), $replacement } - Set-Content -Path "$rootPath\documentation\SyntaxChangeLog.md" -Value $changelog + Set-Content -Path $targetFile -Value $newContent + Remove-Item -Path $syntaxChangeLog } function New-CommandMappingFile @@ -523,9 +529,7 @@ switch ($PSCmdlet.ParameterSetName) # Refresh AzPreview.psd1 Update-AzPreview Update-AzPreviewChangelog - if ($GenerateSyntaxChangelog){ - Update-AzSyntaxChangelog - } + Update-AzSyntaxChangelog # We need to generate the upcoming-breaking-changes.md after the process of bump version in minor release if ([PSVersion]::MINOR -Eq $versionBump) { diff --git a/tools/VersionController/Models/SyntaxChangelogGenerator.cs b/tools/VersionController/Models/SyntaxChangelogGenerator.cs index ac1d079accdf..55888f5dd6b9 100644 --- a/tools/VersionController/Models/SyntaxChangelogGenerator.cs +++ b/tools/VersionController/Models/SyntaxChangelogGenerator.cs @@ -43,14 +43,13 @@ public void Analyze(String rootDirectory) var executingPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).AbsolutePath); Directory.SetCurrentDirectory(executingPath); var newModuleMetadata = MetadataLoader.GetModuleMetadata(moduleName); - Console.WriteLine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..")); var filePath = Path.Combine(executingPath, "SerializedCmdlets", $"{moduleName}.json"); if (!File.Exists(filePath)) continue; var oldModuleMetadata = ModuleMetadata.DeserializeCmdlets(filePath); CmdletLoader.ModuleMetadata = newModuleMetadata; CompareModuleMetedata(oldModuleMetadata, newModuleMetadata, moduleName); } - var markDownPath = Path.Combine(rootDirectory, "documentation/SyntaxChangeLog.md"); + var markDownPath = Path.Combine(rootDirectory, "documentation/SyntaxChangeLog/SyntaxChangeLog.md"); GenerateMarkdown(markDownPath); Console.WriteLine("Cmdlets Differences written to {0}", markDownPath); } @@ -445,6 +444,7 @@ public void GenerateMarkdown(string filePath) } } } + Directory.CreateDirectory(Path.GetDirectoryName(filePath)); File.AppendAllText(filePath, sb.ToString()); } private string FormatListString(List list, Func formatter) diff --git a/tools/VersionController/Program.cs b/tools/VersionController/Program.cs index 022143645933..1f9760ff4d1b 100644 --- a/tools/VersionController/Program.cs +++ b/tools/VersionController/Program.cs @@ -51,7 +51,7 @@ public static void Main(string[] args) var executingAssemblyPath = Assembly.GetExecutingAssembly().Location; var versionControllerDirectory = Directory.GetParent(executingAssemblyPath).FullName; var artifactsDirectory = Directory.GetParent(versionControllerDirectory).FullName; - var syntaxChangelog = "false"; + var syntaxChangelog = true; _rootDirectory = Directory.GetParent(artifactsDirectory).FullName; _projectDirectories = new List{ Path.Combine(_rootDirectory, @"src\") }.Where((d) => Directory.Exists(d)).ToList(); _outputDirectories = new List{ Path.Combine(_rootDirectory, @"artifacts\Release\") }.Where((d) => Directory.Exists(d)).ToList(); @@ -61,6 +61,7 @@ public static void Main(string[] args) if (args != null && args.Length > 0) { exceptionsDirectory = args[0]; + syntaxChangelog = false; } if (!Directory.Exists(exceptionsDirectory)) @@ -74,14 +75,9 @@ public static void Main(string[] args) _moduleNameFilter = args[1] + Psd1NameExtension; } - if (args != null && args.Length > 2) - { - syntaxChangelog = args[2]; - } - ConsolidateExceptionFiles(exceptionsDirectory); ValidateManifest(); - if (syntaxChangelog.Equals("true", System.StringComparison.OrdinalIgnoreCase)) { + if (syntaxChangelog) { GenerateSyntaxChangelog(_rootDirectory); } BumpVersions();