From 188cbdf6f8be06ad9facb5d7a9ded31f40e6c3db Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Mon, 5 Jan 2026 15:51:58 -0800 Subject: [PATCH 1/6] tests --- azure-pipelines-templates/run-tests.yml | 3 ++- azure-pipelines.yml | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/azure-pipelines-templates/run-tests.yml b/azure-pipelines-templates/run-tests.yml index 2eb2b311..92710798 100644 --- a/azure-pipelines-templates/run-tests.yml +++ b/azure-pipelines-templates/run-tests.yml @@ -52,7 +52,8 @@ jobs: # Otherwise we may hit the GitHub anonymous download limit. - task: UsePythonVersion@0 inputs: - versionSpec: ${{ parameters.python_version }} + versionSpec: "3.7" + allowUnstable: true # Install all dependencies needed for running the tests. This command is good # for all OSes diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2d7c314a..9d14fe20 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -62,9 +62,10 @@ parameters: - name: python_versions type: object default: - - '3.9' - - '3.10' - - '3.11' + - '3.7' + # - '3.9' + # - '3.10' + # - '3.11' - name: os_versions type: object @@ -72,11 +73,11 @@ parameters: - name: Linux vm_image: ubuntu-latest - - name: macOS - vm_image: macOS-latest + # - name: macOS + # vm_image: macOS-latest - - name: Windows - vm_image: windows-latest + # - name: Windows + # vm_image: windows-latest # This here is the list of jobs we want to run for our build. # Jobs run in parallel. From 3a0f55def51ac09f619954719f7f22ec8cbecff8 Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Mon, 5 Jan 2026 15:54:58 -0800 Subject: [PATCH 2/6] tests --- azure-pipelines-templates/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-templates/run-tests.yml b/azure-pipelines-templates/run-tests.yml index 92710798..323113d7 100644 --- a/azure-pipelines-templates/run-tests.yml +++ b/azure-pipelines-templates/run-tests.yml @@ -52,7 +52,7 @@ jobs: # Otherwise we may hit the GitHub anonymous download limit. - task: UsePythonVersion@0 inputs: - versionSpec: "3.7" + versionSpec: "3.7.17" allowUnstable: true # Install all dependencies needed for running the tests. This command is good From d66a60af00f0f6618d3f346ca5826b290479edd3 Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Mon, 5 Jan 2026 16:12:41 -0800 Subject: [PATCH 3/6] Tests --- azure-pipelines-templates/run-tests.yml | 5 +++-- azure-pipelines.yml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-templates/run-tests.yml b/azure-pipelines-templates/run-tests.yml index 323113d7..1ffa7869 100644 --- a/azure-pipelines-templates/run-tests.yml +++ b/azure-pipelines-templates/run-tests.yml @@ -52,8 +52,9 @@ jobs: # Otherwise we may hit the GitHub anonymous download limit. - task: UsePythonVersion@0 inputs: - versionSpec: "3.7.17" - allowUnstable: true + versionSpec: "3.7" + #disableDownloadFromRegistry: false + #allowUnstable: true # Install all dependencies needed for running the tests. This command is good # for all OSes diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9d14fe20..b9e26476 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -71,7 +71,7 @@ parameters: type: object default: - name: Linux - vm_image: ubuntu-latest + vm_image: ubuntu-22.04 # - name: macOS # vm_image: macOS-latest From befcd17eeb8eb1cc04e87667539c72f0fe57040f Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Mon, 5 Jan 2026 17:29:52 -0800 Subject: [PATCH 4/6] Tetss --- azure-pipelines-templates/run-tests.yml | 176 ++++++++++++------------ azure-pipelines.yml | 86 +++++++----- 2 files changed, 142 insertions(+), 120 deletions(-) diff --git a/azure-pipelines-templates/run-tests.yml b/azure-pipelines-templates/run-tests.yml index 1ffa7869..2b1c2702 100644 --- a/azure-pipelines-templates/run-tests.yml +++ b/azure-pipelines-templates/run-tests.yml @@ -52,96 +52,94 @@ jobs: # Otherwise we may hit the GitHub anonymous download limit. - task: UsePythonVersion@0 inputs: - versionSpec: "3.7" - #disableDownloadFromRegistry: false - #allowUnstable: true + versionSpec: ${{ parameters.python_version }} - # Install all dependencies needed for running the tests. This command is good - # for all OSes - - task: Bash@3 - displayName: Install dependencies - inputs: - targetType: inline - script: | - pip install --upgrade pip - pip install --upgrade setuptools wheel - pip install --upgrade --requirement tests/ci_requirements.txt + # # Install all dependencies needed for running the tests. This command is good + # # for all OSes + # - task: Bash@3 + # displayName: Install dependencies + # inputs: + # targetType: inline + # script: | + # pip install --upgrade pip + # pip install --upgrade setuptools wheel + # pip install --upgrade --requirement tests/ci_requirements.txt - # The {{}} syntax is meant for the the pre-processor of Azure pipeline. Every statement inside - # a {{}} block will be evaluated and substituted before the file is parsed to create the jobs. - # So here we're inserting an extra step if the template is being invoked for Windows. - - ${{ if eq(parameters.os_name, 'Windows') }}: - # On Windows, we need to update the certificates, the cert store is missing the newer one - # from Amazon like some clients experienced a while back. Who would have thought Microsoft - # would have been out of date! ;) - - powershell: | - $cert_url = "https://www.amazontrust.com/repository/SFSRootCAG2.cer" - $cert_file = New-TemporaryFile - Invoke-WebRequest -Uri $cert_url -UseBasicParsing -OutFile $cert_file.FullName - Import-Certificate -FilePath $cert_file.FullName -CertStoreLocation Cert:\LocalMachine\Root - displayName: Updating OS Certificates + # # The {{}} syntax is meant for the the pre-processor of Azure pipeline. Every statement inside + # # a {{}} block will be evaluated and substituted before the file is parsed to create the jobs. + # # So here we're inserting an extra step if the template is being invoked for Windows. + # - ${{ if eq(parameters.os_name, 'Windows') }}: + # # On Windows, we need to update the certificates, the cert store is missing the newer one + # # from Amazon like some clients experienced a while back. Who would have thought Microsoft + # # would have been out of date! ;) + # - powershell: | + # $cert_url = "https://www.amazontrust.com/repository/SFSRootCAG2.cer" + # $cert_file = New-TemporaryFile + # Invoke-WebRequest -Uri $cert_url -UseBasicParsing -OutFile $cert_file.FullName + # Import-Certificate -FilePath $cert_file.FullName -CertStoreLocation Cert:\LocalMachine\Root + # displayName: Updating OS Certificates - # Runs the tests and generates test coverage. The tests results are uploaded to Azure Pipelines in the - # Tests tab of the build and each test run will be named after the --test-run-title argument to pytest, - # for example 'Windows - 2.7' - - task: Bash@3 - displayName: Running tests - inputs: - targetType: inline - script: | - cp ./tests/example_config ./tests/config - pytest --durations=0 -v \ - --cov shotgun_api3 --cov-report xml \ - --test-run-title="${{ parameters.os_name }}-${{ parameters.python_version }}" - env: - # Pass the values needed to authenticate with the Flow Production Tracking site and create some entities. - # Remember, on a pull request from a client or on forked repos, those variables - # will be empty! - SG_SERVER_URL: $(ci_site) - SG_SCRIPT_NAME: $(ci_site_script_name) - SG_API_KEY: $(ci_site_script_key) - # The unit tests manipulate the user and project during the tests, which can cause collisions, - # so sandbox each build variant. - # Ideally, we would use the agent name here. The problem is that the agent name is in a build - # variable, so we can't edit it's value through a ${{replace(a,b,c)}} expression, which are evaluated before - # build variables are available. Because of this, we need to find another way to generate a - # unique login. So instead, we'll use the the name of the platform and the python version, - # which should make it unique. - SG_HUMAN_LOGIN: $(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} - # This will give a user name like 'something macOS 2.7' - SG_HUMAN_NAME: $(python_api_human_name) ${{ parameters.os_name }} ${{ parameters.python_version }} - SG_HUMAN_PASSWORD: $(python_api_human_password) - # So, first, we need to make sure that two builds running at the same time do not manipulate - # the same entities, so we're sandboxing build nodes based on their name. - SG_PROJECT_NAME: Python API CI - $(Agent.Name) - # The entities created and then reused between tests assume that the same user is always - # manipulating them. Because different builds will be assigned different agents and therefore - # different projects, it means each project needs to have an entity specific to a given user. - # Again, this would have been a lot simpler if we could simply have had a login based on the - # agent name, but alas, the agent name has a space in it which needs to be replaced to something - # else and string substitution can't be made on build variables, only template parameters. - SG_ASSET_CODE: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} - SG_VERSION_CODE: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} - SG_SHOT_CODE: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} - SG_TASK_CONTENT: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} - SG_PLAYLIST_CODE: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} + # # Runs the tests and generates test coverage. The tests results are uploaded to Azure Pipelines in the + # # Tests tab of the build and each test run will be named after the --test-run-title argument to pytest, + # # for example 'Windows - 2.7' + # - task: Bash@3 + # displayName: Running tests + # inputs: + # targetType: inline + # script: | + # cp ./tests/example_config ./tests/config + # pytest --durations=0 -v \ + # --cov shotgun_api3 --cov-report xml \ + # --test-run-title="${{ parameters.os_name }}-${{ parameters.python_version }}" + # env: + # # Pass the values needed to authenticate with the Flow Production Tracking site and create some entities. + # # Remember, on a pull request from a client or on forked repos, those variables + # # will be empty! + # SG_SERVER_URL: $(ci_site) + # SG_SCRIPT_NAME: $(ci_site_script_name) + # SG_API_KEY: $(ci_site_script_key) + # # The unit tests manipulate the user and project during the tests, which can cause collisions, + # # so sandbox each build variant. + # # Ideally, we would use the agent name here. The problem is that the agent name is in a build + # # variable, so we can't edit it's value through a ${{replace(a,b,c)}} expression, which are evaluated before + # # build variables are available. Because of this, we need to find another way to generate a + # # unique login. So instead, we'll use the the name of the platform and the python version, + # # which should make it unique. + # SG_HUMAN_LOGIN: $(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} + # # This will give a user name like 'something macOS 2.7' + # SG_HUMAN_NAME: $(python_api_human_name) ${{ parameters.os_name }} ${{ parameters.python_version }} + # SG_HUMAN_PASSWORD: $(python_api_human_password) + # # So, first, we need to make sure that two builds running at the same time do not manipulate + # # the same entities, so we're sandboxing build nodes based on their name. + # SG_PROJECT_NAME: Python API CI - $(Agent.Name) + # # The entities created and then reused between tests assume that the same user is always + # # manipulating them. Because different builds will be assigned different agents and therefore + # # different projects, it means each project needs to have an entity specific to a given user. + # # Again, this would have been a lot simpler if we could simply have had a login based on the + # # agent name, but alas, the agent name has a space in it which needs to be replaced to something + # # else and string substitution can't be made on build variables, only template parameters. + # SG_ASSET_CODE: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} + # SG_VERSION_CODE: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} + # SG_SHOT_CODE: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} + # SG_TASK_CONTENT: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} + # SG_PLAYLIST_CODE: CI-$(python_api_human_login)-${{ parameters.os_name }}-${{ parameters.python_version }} - # Upload the code coverage result to codecov.io. - - ${{ if eq(parameters.os_name, 'Windows') }}: - - powershell: | - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe - .\codecov.exe -f coverage.xml - displayName: Uploading code coverage - - ${{ elseif eq(parameters.os_name, 'Linux') }}: - - script: | - curl -Os https://uploader.codecov.io/latest/linux/codecov - chmod +x codecov - ./codecov -f coverage.xml - displayName: Uploading code coverage - - ${{ else }}: - - script: | - curl -Os https://uploader.codecov.io/v0.7.3/macos/codecov - chmod +x codecov - ./codecov -f coverage.xml - displayName: Uploading code coverage + # # Upload the code coverage result to codecov.io. + # - ${{ if eq(parameters.os_name, 'Windows') }}: + # - powershell: | + # $ProgressPreference = 'SilentlyContinue' + # Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe + # .\codecov.exe -f coverage.xml + # displayName: Uploading code coverage + # - ${{ elseif eq(parameters.os_name, 'Linux') }}: + # - script: | + # curl -Os https://uploader.codecov.io/latest/linux/codecov + # chmod +x codecov + # ./codecov -f coverage.xml + # displayName: Uploading code coverage + # - ${{ else }}: + # - script: | + # curl -Os https://uploader.codecov.io/v0.7.3/macos/codecov + # chmod +x codecov + # ./codecov -f coverage.xml + # displayName: Uploading code coverage diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b9e26476..88208a85 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,15 +36,45 @@ resources: # Despite using the "tk-" prefix, tk-ci-tools is not a Toolkit only tool. # We use it to avoid duplicating and maintaining CI pipeline code. -# We've stored some variables in Azure. They contain credentials -# and are encrypted. They are also not available to clients. -# This statement says which variable groups this repo requires. -# We have two: one that can be shared by all repos that use CI -# and another that is used just by the Python API, which creates -# HumanUser's and as such need a password, which we can't -# hardcode in the .yml files. + variables: - group: sg-credentials + # We've stored some variables in Azure. They contain credentials + # and are encrypted. They are also not available to clients. + # This statement says which variable groups this repo requires. + # We have two: one that can be shared by all repos that use CI + # and another that is used just by the Python API, which creates + # HumanUser's and as such need a password, which we can't + # hardcode in the .yml files. + + - name: vfx_reference_platform_versions + value: + - name: VFX CY2021 + # Python 3.7 is no longer supported but we want to ensure that we don't break compatiblity just yet. + python_version: '3.7' + os_versions: + - name: Linux + vm_image: ubuntu-22.04 + + - name: VFX CY2022 + python_version: '3.9' + + - name: VFX CY2023 + python_version: '3.10' + + - name: VFX CY2024 + python_version: '3.11' + + - name: os_versions + value: + - name: Linux + vm_image: ubuntu-latest + + - name: macOS + vm_image: macOS-latest + + - name: Windows + vm_image: windows-latest # We want builds to trigger for 3 reasons: # - The master branch sees new commits @@ -59,25 +89,20 @@ pr: - "*" parameters: - - name: python_versions - type: object - default: - - '3.7' - # - '3.9' - # - '3.10' - # - '3.11' - - - name: os_versions + - name: test_matrix type: object default: - - name: Linux - vm_image: ubuntu-22.04 - - # - name: macOS - # vm_image: macOS-latest - - # - name: Windows - # vm_image: windows-latest + - ${{ each vfx_version in variables.vfx_reference_platform_versions }}: + - ${{ if vfx_version.os_versions }}: + - ${{ each os_version in vfx_version.os_versions }}: + - os_name: "${{ os_version.name }}" + vm_image: ${{ os_version.vm_image }} + python_version: ${{ vfx_version.python_version }} + - ${{ else }}: + - ${{ each os_version in variables.os_versions }}: + - os_name: "${{ os_version.name }}" + vm_image: ${{ os_version.vm_image }} + python_version: ${{ vfx_version.python_version }} # This here is the list of jobs we want to run for our build. # Jobs run in parallel. @@ -92,10 +117,9 @@ jobs: - template: azure-pipelines-templates/type_checking.yml -- ${{ each os_version in parameters.os_versions }}: - - ${{ each python_version in parameters.python_versions }}: - - template: azure-pipelines-templates/run-tests.yml - parameters: - os_name: "${{ os_version.name }}" - vm_image: ${{ os_version.vm_image }} - python_version: ${{ python_version }} +- ${{ each test_item in parameters.test_matrix }}: + - template: azure-pipelines-templates/run-tests.yml + parameters: + os_name: "${{ test_item.os_name }}" + vm_image: ${{ test_item.vm_image }} + python_version: ${{ test_item.python_version }} From 698f974eca10c1b116169c946ab13fd9731de035 Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Mon, 5 Jan 2026 17:31:57 -0800 Subject: [PATCH 5/6] fixup! Tetss --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 88208a85..572c6ab0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -48,6 +48,7 @@ variables: # hardcode in the .yml files. - name: vfx_reference_platform_versions + type: object value: - name: VFX CY2021 # Python 3.7 is no longer supported but we want to ensure that we don't break compatiblity just yet. @@ -66,6 +67,7 @@ variables: python_version: '3.11' - name: os_versions + type: object value: - name: Linux vm_image: ubuntu-latest From fa1ebf62888f6064feeebbb022f4d5379b4ad401 Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Mon, 5 Jan 2026 17:38:45 -0800 Subject: [PATCH 6/6] fixup! fixup! Tetss --- azure-pipelines.yml | 84 +++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 572c6ab0..88bcb361 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,22 +36,35 @@ resources: # Despite using the "tk-" prefix, tk-ci-tools is not a Toolkit only tool. # We use it to avoid duplicating and maintaining CI pipeline code. - +# We've stored some variables in Azure. They contain credentials +# and are encrypted. They are also not available to clients. +# This statement says which variable groups this repo requires. +# We have two: one that can be shared by all repos that use CI +# and another that is used just by the Python API, which creates +# HumanUser's and as such need a password, which we can't +# hardcode in the .yml files. variables: - group: sg-credentials - # We've stored some variables in Azure. They contain credentials - # and are encrypted. They are also not available to clients. - # This statement says which variable groups this repo requires. - # We have two: one that can be shared by all repos that use CI - # and another that is used just by the Python API, which creates - # HumanUser's and as such need a password, which we can't - # hardcode in the .yml files. +# We want builds to trigger for 3 reasons: +# - The master branch sees new commits +# - Each PR should get rebuilt when commits are added to it. +trigger: + branches: + include: + - master +pr: + branches: + include: + - "*" + +parameters: - name: vfx_reference_platform_versions type: object - value: + default: - name: VFX CY2021 - # Python 3.7 is no longer supported but we want to ensure that we don't break compatiblity just yet. + # Python 3.7 is no longer supported but we want to ensure that we don't + # break compatiblity just yet. python_version: '3.7' os_versions: - name: Linux @@ -68,7 +81,7 @@ variables: - name: os_versions type: object - value: + default: - name: Linux vm_image: ubuntu-latest @@ -78,34 +91,6 @@ variables: - name: Windows vm_image: windows-latest -# We want builds to trigger for 3 reasons: -# - The master branch sees new commits -# - Each PR should get rebuilt when commits are added to it. -trigger: - branches: - include: - - master -pr: - branches: - include: - - "*" - -parameters: - - name: test_matrix - type: object - default: - - ${{ each vfx_version in variables.vfx_reference_platform_versions }}: - - ${{ if vfx_version.os_versions }}: - - ${{ each os_version in vfx_version.os_versions }}: - - os_name: "${{ os_version.name }}" - vm_image: ${{ os_version.vm_image }} - python_version: ${{ vfx_version.python_version }} - - ${{ else }}: - - ${{ each os_version in variables.os_versions }}: - - os_name: "${{ os_version.name }}" - vm_image: ${{ os_version.vm_image }} - python_version: ${{ vfx_version.python_version }} - # This here is the list of jobs we want to run for our build. # Jobs run in parallel. jobs: @@ -119,9 +104,18 @@ jobs: - template: azure-pipelines-templates/type_checking.yml -- ${{ each test_item in parameters.test_matrix }}: - - template: azure-pipelines-templates/run-tests.yml - parameters: - os_name: "${{ test_item.os_name }}" - vm_image: ${{ test_item.vm_image }} - python_version: ${{ test_item.python_version }} +- ${{ each vfx_version in variables.vfx_reference_platform_versions }}: + - ${{ if vfx_version.os_versions }}: + - ${{ each os_version in vfx_version.os_versions }}: + - template: azure-pipelines-templates/run-tests.yml + parameters: + os_name: "${{ os_version.name }}" + vm_image: ${{ os_version.vm_image }} + python_version: ${{ vfx_version.python_version }} + - ${{ else }}: + - ${{ each os_version in variables.os_versions }}: + - template: azure-pipelines-templates/run-tests.yml + parameters: + os_name: "${{ os_version.name }}" + vm_image: ${{ os_version.vm_image }} + python_version: ${{ vfx_version.python_version }}