Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions eng/pipelines/templates/stages/archetype-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,33 @@ extends:
template: /eng/pipelines/templates/stages/1es-redirect.yml
parameters:
stages:
# On scheduled runs, detect whether the run started on a weekend (in the schedule's timezone).
# Weekend scheduled runs additionally execute the analyze-weekly stage(s) further below.
- ${{ if eq(variables['Build.Reason'], 'Schedule') }}:
- stage: CheckSchedule
displayName: 'Check Schedule'
variables:
- template: /eng/pipelines/templates/variables/image.yml
jobs:
- job: check
pool:
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux
steps:
- pwsh: |
# Use the same timezone the pipeline schedule is configured in so the
# weekend boundary matches when the run was actually scheduled.
$tz = [System.TimeZoneInfo]::FindSystemTimeZoneById('America/Los_Angeles')
$now = [System.TimeZoneInfo]::ConvertTimeFromUtc([datetime]::UtcNow, $tz)
Comment thread
raych1 marked this conversation as resolved.
Outdated
$weekend = $now.DayOfWeek -in 'Saturday','Sunday'
Write-Host "Local time ($($tz.Id)): $now -> IsWeekend=$weekend"
Write-Host "##vso[task.setvariable variable=IsWeekend;isOutput=true]$weekend"
name: setflag
displayName: 'Determine weekend from run start time'
Comment thread
raych1 marked this conversation as resolved.
Outdated
- ${{ each package in coalesce(parameters.Packages, split(parameters.BuildTargetingString, '|')) }}:
- ${{ each cloud in parameters.CloudConfig }}:
- ${{ if or(contains(parameters.Clouds, cloud.key), and(contains(variables['Build.DefinitionName'], 'tests-weekly'), contains(parameters.SupportedClouds, cloud.key))) }}:
- ${{ if contains(parameters.Clouds, cloud.key) }}:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

12 services set it, but 9 set it to Public (same as the default) — those are unaffected. Only 3 set a non-Public value:

-- | -- | -- | --
Service | Clouds | CloudConfig | Affected?
personalizer | Canary | default (includes Public) | Yes (Can be ignored coz the last run was 2022)
formrecognizer | Prod | custom — only Prod | No
agrifood | Public_FarmBeats | custom — only Public_Farmbeats | No

- ${{ if not(contains(parameters.UnsupportedClouds, cloud.key)) }}:
- stage:
displayName: ${{ format('{0} {1} {2}', cloud.key, parameters.JobName, package) }}
Expand Down Expand Up @@ -168,9 +192,13 @@ extends:
ServiceConnection: ${{ coalesce(cloud.value.ServiceConnection, lower(format('azure-sdk-tests-{0}', cloud.key))) }}
SubscriptionConfigurationFilePaths: ${{ cloud.value.SubscriptionConfigurationFilePaths }}

- ${{ if contains(variables['Build.DefinitionName'], 'tests-weekly') }}:
# Analyze-weekly runs only on scheduled runs that started on a weekend (gated by CheckSchedule).
- ${{ if eq(variables['Build.Reason'], 'Schedule') }}:
- template: /eng/pipelines/templates/stages/python-analyze-weekly.yml
parameters:
BuildTargetingString: ${{ package }}
ServiceDirectory: ${{ parameters.ServiceDirectory }}
JobName: ${{ parameters.JobName }}
DependsOn:
- CheckSchedule
Condition: eq(dependencies.CheckSchedule.outputs['check.setflag.IsWeekend'], 'True')
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,34 @@ extends:
template: /eng/pipelines/templates/stages/1es-redirect.yml
parameters:
stages:
- ${{ if contains(variables['Build.DefinitionName'], 'tests-weekly') }}:
- template: /eng/pipelines/templates/stages/python-analyze-weekly.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
BuildTargetingString: ${{ parameters.BuildTargetingString }}
JobName: ${{ parameters.JobName }}
# Always present so the pipeline has at least one stage; also determines whether the
# run started on a weekend (in the schedule's timezone) for the analyze gate below.
- stage: CheckSchedule
displayName: 'Check Schedule'
variables:
- template: /eng/pipelines/templates/variables/image.yml
jobs:
- job: check
pool:
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux
steps:
- pwsh: |
# Use the same timezone the pipeline schedule is configured in so the
# weekend boundary matches when the run was actually scheduled.
$tz = [System.TimeZoneInfo]::FindSystemTimeZoneById('America/Los_Angeles')
$now = [System.TimeZoneInfo]::ConvertTimeFromUtc([datetime]::UtcNow, $tz)
Comment thread
raych1 marked this conversation as resolved.
Outdated
$weekend = $now.DayOfWeek -in 'Saturday','Sunday'
Write-Host "Local time ($($tz.Id)): $now -> IsWeekend=$weekend"
Write-Host "##vso[task.setvariable variable=IsWeekend;isOutput=true]$weekend"
name: setflag
displayName: 'Determine weekend from run start time'
- template: /eng/pipelines/templates/stages/python-analyze-weekly.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
BuildTargetingString: ${{ parameters.BuildTargetingString }}
JobName: ${{ parameters.JobName }}
DependsOn:
- CheckSchedule
Condition: and(eq(variables['Build.Reason'], 'Schedule'), eq(dependencies.CheckSchedule.outputs['check.setflag.IsWeekend'], 'True'))
12 changes: 11 additions & 1 deletion eng/pipelines/templates/stages/python-analyze-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@ parameters:
- name: JobName
type: string
default: 'Test'
- name: DependsOn
type: object
default: []
- name: Condition
type: string
default: succeeded()

stages:
- stage:
displayName: 'Analyze_${{ parameters.JobName }}'
variables:
- template: /eng/pipelines/templates/variables/image.yml
dependsOn: []
# Signals the analyze-weekly context to the Python tooling (see ci_tools.variables.in_analyze_weekly).
- name: AZURE_SDK_ANALYZE_WEEKLY
value: '1'
dependsOn: ${{ parameters.DependsOn }}
condition: ${{ parameters.Condition }}
jobs:
- job: 'Analyze'
timeoutInMinutes: 90
Expand Down
8 changes: 3 additions & 5 deletions eng/tools/azure-sdk-tools/ci_tools/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ def in_public() -> int:


def in_analyze_weekly() -> int:
# Returns 4 if the build originates from the tests-weekly analyze job
# Returns 4 if the build originates from the analyze-weekly job
# 0 otherwise
if (
"tests-weekly" in os.getenv("SYSTEM_DEFINITIONNAME", "")
and os.getenv("SYSTEM_STAGEDISPLAYNAME", "") == "Analyze_Test"
):
# The analyze-weekly stage sets AZURE_SDK_ANALYZE_WEEKLY=1 (see python-analyze-weekly.yml).
if os.getenv("AZURE_SDK_ANALYZE_WEEKLY", "") == "1":
return 4
return 0

Expand Down
Loading