Skip to content

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

Open
raych1 wants to merge 8 commits into
mainfrom
users/raych1/update-weekly-tests-template
Open

Update test templates to check weekly runs based on run start time#48391
raych1 wants to merge 8 commits into
mainfrom
users/raych1/update-weekly-tests-template

Conversation

@raych1

@raych1 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
raych1 marked this pull request as ready for review July 31, 2026 17:51
@raych1
raych1 requested a review from danieljurek as a code owner July 31, 2026 17:51
Copilot AI review requested due to automatic review settings July 31, 2026 17:51
@raych1
raych1 requested review from benbp and mikeharder as code owners July 31, 2026 17:51
@raych1

raych1 commented Jul 31, 2026

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

raych1 commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

/azp run python - template - tests

@raych1 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 review requested due to automatic review settings July 31, 2026 18:01

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
@raych1 raych1 changed the title Update weekly test templates to use scheduled start time Update test templates to check weekly runs based on run start time Jul 31, 2026

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

  • This standalone path also bases the gate on agent execution time rather than pipeline start time. A queued run that starts this step after the weekend boundary will be classified incorrectly. Pass pipeline.startTime into the step via a runtime expression and convert that timestamp instead of calling UtcNow.
                  $now = [System.TimeZoneInfo]::ConvertTimeFromUtc([datetime]::UtcNow, $tz)

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

  • This still classifies the run using the time when the agent executes this step, rather than the pipeline start time described by the PR. If CheckSchedule waits in the agent queue across a weekend boundary, the weekly stage will be incorrectly enabled or skipped. Capture pipeline.startTime with a runtime expression and convert that immutable timestamp to the schedule timezone instead.
                  $now = [System.TimeZoneInfo]::ConvertTimeFromUtc([datetime]::UtcNow, $tz)

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

@danieljurek danieljurek left a comment

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

raych1 commented Jul 31, 2026

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

raych1 commented Jul 31, 2026

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

benbp commented Jul 31, 2026

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

raych1 commented Jul 31, 2026

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

raych1 commented Aug 1, 2026

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'))

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