From 3921e9d1431ecc4c02f8ae0a7f66e56c15a7f3cd Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Wed, 6 Jul 2022 08:55:53 -0700 Subject: [PATCH 1/2] Add option to skip force refresh. --- .../common-templates/download-openapi-docs.yml | 5 ++++- .azure-pipelines/weekly-generation.yml | 9 ++++++++- tools/UpdateOpenApi.ps1 | 5 +++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/common-templates/download-openapi-docs.yml b/.azure-pipelines/common-templates/download-openapi-docs.yml index b0cb0461f33..b789b6abe18 100644 --- a/.azure-pipelines/common-templates/download-openapi-docs.yml +++ b/.azure-pipelines/common-templates/download-openapi-docs.yml @@ -8,6 +8,8 @@ parameters: type: string - name: BuildAgent displayName: Build Agent + - name: SkipForceRefresh + type: boolean jobs: - job: GetLatestDocs @@ -45,6 +47,7 @@ jobs: continueOnError: false inputs: filePath: "$(System.DefaultWorkingDirectory)/tools/UpdateOpenApi.ps1" + arguments: -SkipForceRefresh:$$(SkipForceRefresh) pwsh: true - task: PowerShell@2 @@ -52,7 +55,7 @@ jobs: continueOnError: false inputs: filePath: "$(System.DefaultWorkingDirectory)/tools/UpdateOpenApi.ps1" - arguments: "-BetaGraphVersion" + arguments: -BetaGraphVersion -SkipForceRefresh:$$(SkipForceRefresh) pwsh: true - task: PowerShell@2 diff --git a/.azure-pipelines/weekly-generation.yml b/.azure-pipelines/weekly-generation.yml index bb73a0e6ab2..330998c1138 100644 --- a/.azure-pipelines/weekly-generation.yml +++ b/.azure-pipelines/weekly-generation.yml @@ -5,13 +5,19 @@ name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) parameters: - name: BuildAgent - default: 1es-windows-ps-compute displayName: Build Agent + default: 1es-windows-ps-compute + + - name: SkipForceRefresh + displayName: Skip Force Refresh + default: false + type: boolean variables: Branch: "WeeklyOpenApiDocsDownload" BaseBranch: "dev" BuildAgent: ${{ parameters.BuildAgent }} + SkipForceRefresh: ${{ parameters.SkipForceRefresh }} pool: $(BuildAgent) trigger: none @@ -33,6 +39,7 @@ stages: Branch: $(Branch) BaseBranch: $(BaseBranch) BuildAgent: $(BuildAgent) + SkipForceRefresh: $(SkipForceRefresh) - stage: GenerateServiceModules displayName: Generate service modules diff --git a/tools/UpdateOpenApi.ps1 b/tools/UpdateOpenApi.ps1 index 15603194a5a..40bf58f4428 100644 --- a/tools/UpdateOpenApi.ps1 +++ b/tools/UpdateOpenApi.ps1 @@ -4,7 +4,8 @@ Param( [string] $ModuleMappingConfigPath = (Join-Path $PSScriptRoot "..\config\ModulesMapping.jsonc"), [string] $OpenApiDocOutput = (Join-Path $PSScriptRoot "..\openApiDocs"), - [switch] $BetaGraphVersion + [switch] $BetaGraphVersion, + [switch] $SkipForceRefresh ) $ErrorActionPreference = 'Stop' @@ -38,7 +39,7 @@ $ModuleMapping.Keys | ForEach-Object -Begin { $RequestCount = 0 } -End { Write-D $ModuleName = $_ $ForceRefresh = $false # Check whether ForceRefresh is required, Only required for the First Request. - if ($RequestCount -eq 0) { + if ($RequestCount -eq 0 -and $SkipForceRefresh -eq $false) { $ForceRefresh = $true } From 5b47f4a47c71773fb7fcdf5e3601792166a98115 Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Wed, 6 Jul 2022 09:03:26 -0700 Subject: [PATCH 2/2] Add option to set base branch. --- .azure-pipelines/common-templates/download-openapi-docs.yml | 2 +- .azure-pipelines/weekly-generation.yml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/common-templates/download-openapi-docs.yml b/.azure-pipelines/common-templates/download-openapi-docs.yml index b789b6abe18..a973487c476 100644 --- a/.azure-pipelines/common-templates/download-openapi-docs.yml +++ b/.azure-pipelines/common-templates/download-openapi-docs.yml @@ -9,7 +9,7 @@ parameters: - name: BuildAgent displayName: Build Agent - name: SkipForceRefresh - type: boolean + type: string jobs: - job: GetLatestDocs diff --git a/.azure-pipelines/weekly-generation.yml b/.azure-pipelines/weekly-generation.yml index 330998c1138..992171c05cc 100644 --- a/.azure-pipelines/weekly-generation.yml +++ b/.azure-pipelines/weekly-generation.yml @@ -7,7 +7,9 @@ parameters: - name: BuildAgent displayName: Build Agent default: 1es-windows-ps-compute - + - name: BaseBranch + displayName: Base Branch + default: dev - name: SkipForceRefresh displayName: Skip Force Refresh default: false @@ -15,7 +17,7 @@ parameters: variables: Branch: "WeeklyOpenApiDocsDownload" - BaseBranch: "dev" + BaseBranch: ${{ parameters.BaseBranch }} BuildAgent: ${{ parameters.BuildAgent }} SkipForceRefresh: ${{ parameters.SkipForceRefresh }}