Skip to content

Update test templates to check weekly runs based on run start time - #48391

Merged
Ray Chen (raych1) merged 8 commits into
mainfrom
users/raych1/update-weekly-tests-template
Aug 12, 2026
Merged

Update test templates to check weekly runs based on run start time#48391
Ray Chen (raych1) merged 8 commits into
mainfrom
users/raych1/update-weekly-tests-template

Conversation

@raych1

@raych1 Ray Chen (raych1) commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

  • determine weekend scheduled runs from the pipeline start time in UTC timezone (gaps with PT zone is accepted)
  • mark the analyze-weekly stage explicitly for Python CI tooling

Testing

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@raych1
Ray Chen (raych1) marked this pull request as ready for review July 31, 2026 17:51
Copilot AI review requested due to automatic review settings July 31, 2026 17:51
@raych1

Copy link
Copy Markdown
Member Author

/azp run python - core - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@raych1

Copy link
Copy Markdown
Member Author

/azp run python - template - tests

@raych1 Ray Chen (raych1) self-assigned this Jul 31, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates weekly analysis scheduling and Python CI context detection.

Changes:

  • Adds weekend schedule checks and gates analysis stages.
  • Adds configurable analysis-stage dependencies and conditions.
  • Replaces pipeline-name detection with an explicit environment marker.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
eng/tools/azure-sdk-tools/ci_tools/variables.py Detects weekly analysis via an explicit variable.
eng/pipelines/templates/stages/python-analyze-weekly.yml Adds gating parameters and the analysis marker.
eng/pipelines/templates/stages/python-analyze-weekly-standalone.yml Adds scheduled weekend gating.
eng/pipelines/templates/stages/archetype-sdk-tests.yml Adds schedule gating for weekly analysis and modifies cloud selection.

Comment thread eng/pipelines/templates/stages/archetype-sdk-tests.yml Outdated
Comment thread eng/pipelines/templates/stages/python-analyze-weekly-standalone.yml 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

Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

eng/pipelines/templates/stages/archetype-sdk-tests.yml:134

  • This also removes the existing weekly expansion to SupportedClouds, although the PR describes changing only the analyze-stage gate. For example, sdk/personalizer/tests.yml:8 sets Clouds: Canary and relies on the default SupportedClouds: Public; its weekly pipeline previously ran both clouds but will now never create the Public stage. Preserve the supported-cloud stages with a weekend CheckSchedule gate, or document and update callers if dropping weekly multi-cloud coverage is intentional.
        - ${{ if contains(parameters.Clouds, cloud.key) }}:

eng/pipelines/templates/stages/archetype-sdk-tests.yml:126

  • This computes the weekend from when the CheckSchedule agent happens to execute, not from the pipeline start as the comment and PR require. A queued or delayed run that crosses midnight at the weekend boundary can therefore incorrectly enable or skip weekly analysis.
                  $now = [System.TimeZoneInfo]::ConvertTimeFromUtc([datetime]::UtcNow, $tz)

Comment thread eng/pipelines/templates/stages/python-analyze-weekly-standalone.yml Outdated
Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 31, 2026 18:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (2)

eng/pipelines/templates/stages/python-analyze-weekly-standalone.yml:33

  • Build.QueuedTime is not a predefined Azure Pipelines variable, so it remains the literal $(Build.QueuedTime) here and the datetimeoffset cast fails. That makes CheckSchedule fail and prevents every standalone weekly analysis stage from running. Define the same pipeline.startTime runtime variable used by archetype-sdk-tests.yml and parse that value instead.
                  $runStart = ([datetimeoffset]'$(Build.QueuedTime)').UtcDateTime

eng/pipelines/templates/stages/archetype-sdk-tests.yml:137

  • This removes the existing weekly expansion to SupportedClouds even though the PR only changes analysis-stage gating, and leaves that parameter unused. For example, sdk/personalizer/tests.yml:8 sets Clouds: Canary while retaining the default SupportedClouds: Public; its weekly pipeline previously tested both clouds but will now test only Canary. Preserve the existing cloud-selection condition independently of the new analyze gate.
        - ${{ if contains(parameters.Clouds, cloud.key) }}:

Copilot AI review requested due to automatic review settings July 31, 2026 18:22
Copilot AI review requested due to automatic review settings July 31, 2026 18:46
Comment thread eng/pipelines/templates/stages/archetype-sdk-tests.yml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, not blocking but I think this can be refactored into a single stage template.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

eng/pipelines/templates/stages/archetype-sdk-tests.yml:126

  • The current diff reintroduces the boundary bug: [datetime]::UtcNow is the agent step's execution time, not the pipeline start time promised by this gate. A scheduled run queued before a weekend boundary can therefore be classified using the wrong day. Derive the timezone conversion from an immutable pipeline start/queue timestamp instead.
                  $now = [System.TimeZoneInfo]::ConvertTimeFromUtc([datetime]::UtcNow, $tz)

@raych1

Copy link
Copy Markdown
Member Author

/azp run python - formrecognizer - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@raych1

Copy link
Copy Markdown
Member Author

/azp run python - agrifood - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI review requested due to automatic review settings July 31, 2026 20:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@benbp

Copy link
Copy Markdown
Member

As discussed offline I think it would be better to use the built-in pipeline.startTime variable for the condition check vs. adding a new pre-req stage. The UTC offset with the agent timezone vs. ado org timezone is not a big issue for a weekend schedule boundary.

For matrices that we include conditionally we can start by keeping those weekly pipelines active as legacy while we explore dynamic solutions.

$tz = [System.TimeZoneInfo]::FindSystemTimeZoneById('${{ parameters.TimeZoneId }}')
$local = [System.TimeZoneInfo]::ConvertTimeFromUtc($startUtc, $tz)
$weekend = $local.DayOfWeek -in 'Saturday','Sunday'
Write-Host "PipelineStartTime raw='$raw' -> UTC='$startUtc' -> $($tz.Id)='$local' -> IsWeekend=$weekend"

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.

@raych1

Copy link
Copy Markdown
Member Author

/azp run python - template - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI review requested due to automatic review settings August 1, 2026 00:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 1, 2026 00:33
@raych1

Copy link
Copy Markdown
Member Author

/azp run python - template - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

eng/pipelines/templates/stages/archetype-sdk-tests.yml:178

  • The PR description says weekly analysis is gated on the CheckSchedule output, but this condition recomputes the decision directly from Build.Reason and pipeline.startTime; no CheckSchedule output is referenced anywhere in these changes. Either restore the documented output-based gate or update the PR description so the stated behavior matches the implementation.
            Condition: and(succeeded(), in(format('{0:ddd}', pipeline.startTime), 'Sat', 'Sun'))

@raych1
Ray Chen (raych1) merged commit 3ac5ee7 into main Aug 12, 2026
32 checks passed
@raych1
Ray Chen (raych1) deleted the users/raych1/update-weekly-tests-template branch August 12, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants