Skip to content

SG-43825 Improve pipeline stability#449

Open
jay-roe wants to merge 20 commits into
masterfrom
dev/roebucj1/master-test
Open

SG-43825 Improve pipeline stability#449
jay-roe wants to merge 20 commits into
masterfrom
dev/roebucj1/master-test

Conversation

@jay-roe

@jay-roe jay-roe commented Jun 4, 2026

Copy link
Copy Markdown

Azure pipelines were occasionally failing for various reasons. Some were transient connection errors (timeouts), but sometimes it was live state issues or test run pollution: only certain runners were failing.

This PR creates ephemeral projects scoped to Build + OS + Python version, so concurrent jobs are fully isolated. These projects are deleted unconditionally on job end.

We also added retries on the tests for the transient error cases.

Also modified test_modify_visibility, which was failing unpredictably (likely due to race conditions on using the same existing projects across runners). Now, it uses the ephemeral project for modifying the visibility, and uses the existing project only as a control group (so this one should never have it's visibility changed and not affect concurrent executions of test_modify_visibility)

Tested multiple times to ensure no more failures due to those identified issues
image

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.76%. Comparing base (921114c) to head (4d16f8d).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #449      +/-   ##
==========================================
+ Coverage   78.66%   78.76%   +0.10%     
==========================================
  Files           7        7              
  Lines        1842     1851       +9     
==========================================
+ Hits         1449     1458       +9     
  Misses        393      393              
Flag Coverage Δ
Linux 78.76% <ø> (+0.10%) ⬆️
Python-3.10 78.71% <ø> (+0.10%) ⬆️
Python-3.11 78.71% <ø> (+0.10%) ⬆️
Python-3.13 78.71% <ø> (+0.10%) ⬆️
Python-3.9 78.70% <ø> (+0.10%) ⬆️
Windows 78.85% <ø> (+0.10%) ⬆️
macOS 78.76% <ø> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jay-roe jay-roe force-pushed the dev/roebucj1/master-test branch from 5350717 to d3146da Compare June 10, 2026 21:45
@jay-roe jay-roe changed the title test SG-43825 Improve pipeline stability Jun 22, 2026
Comment thread tests/base.py

data = {"code": cls.config.asset_code, "project": cls.project}
keys = ["code"]
keys = ["code", "project"]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Since we are now creating many projects with entities of the same name, we must scope the search to the ephemeral project.

@jay-roe jay-roe marked this pull request as ready for review June 25, 2026 15:19
@jay-roe jay-roe requested review from aalvarez-autodesk, dsauve-adsk and julien-lang and removed request for aalvarez-autodesk June 25, 2026 15:25
@julien-lang julien-lang requested a review from Copilot June 25, 2026 17:00

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

This PR aims to improve Azure Pipelines stability for the test matrix by isolating concurrent jobs from shared live-state (projects/entities) and reducing failures from transient test flakiness/timeouts.

Changes:

  • Introduces per-job ephemeral project naming (scoped to Build + OS + Python version) and adds an unconditional cleanup step to remove the project at job end.
  • Adds pytest-rerunfailures and enables a single automatic rerun with a short delay to mitigate transient failures.
  • Updates test_modify_visibility and live test DB setup to reduce cross-run state collisions (including scoping Asset lookup/creation by project).

Reviewed changes

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

File Description
azure-pipelines-templates/run-tests.yml Adds pytest reruns, switches to per-build ephemeral project naming, and adds a cleanup step to delete the project after the job.
tests/test_api.py Updates test_modify_visibility to use the ephemeral CI project as the primary toggle target and a separate project as a control.
tests/base.py Adjusts Asset identity keys to include project, preventing cross-project collisions when codes are reused.
tests/requirements.txt Adds pytest-rerunfailures to support the new --reruns options in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread azure-pipelines-templates/run-tests.yml Outdated
Comment thread tests/test_api.py Outdated

@julien-lang julien-lang 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.

Lookg pretty good! Thanks for the improvements.

Just a few comments.

Comment thread azure-pipelines-templates/run-tests.yml
Comment thread azure-pipelines-templates/run-tests.yml Outdated
Comment thread azure-pipelines-templates/run-tests.yml Outdated
Comment thread tests/requirements.txt

@julien-lang julien-lang 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.

Looks good. Just a last few minor comments.

Comment thread azure-pipelines-templates/run-tests.yml Outdated
Comment thread azure-pipelines-templates/run-tests.yml Outdated

@julien-lang julien-lang 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.

Almost there, just 2 last comments

os.environ['SG_SERVER_URL'],
os.environ['SG_SCRIPT_NAME'],
os.environ['SG_API_KEY'],
base_url=os.environ['SG_SERVER_URL'],

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.

Sorry, no, not this one. base_url is a positional parameter, not a named parameter.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Based on this line it looks like a named (but not optional) parameter.

base_url: str,

scriptSource: inline
workingDirectory: $(Build.SourcesDirectory)
script: |
import os, shotgun_api3

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.

Suggested change
import os, shotgun_api3
import os, shotgun_api3, sys

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.

3 participants