Skip to content

[STUD-79858]: Publish runtime tests under separate pipeline artifact#552

Open
alexandru-petre wants to merge 1 commit into
developfrom
fix/python_runtime_tests_artifact_leak
Open

[STUD-79858]: Publish runtime tests under separate pipeline artifact#552
alexandru-petre wants to merge 1 commit into
developfrom
fix/python_runtime_tests_artifact_leak

Conversation

@alexandru-petre
Copy link
Copy Markdown
Collaborator

Context

The Community Activities solution ships per-package Azure Pipelines that build the activity, build a runtime-tests Studio project that consumes the freshly-built package, and run those tests on Windows / Portable target frameworks. The three relevant stage templates live in Activities/.pipelines/jobs/ and are shared between the Python, Database, and Cryptography packs. The Build stage publishes the activity .nupkg as a pipeline artifact named Packages; the Runtime-Tests stage builds a Studio project against that nupkg, packs the resulting test project, and publishes it for the downstream Run stages to consume.

Problem Statement

The runtime-tests .nupkg (e.g. UiPath.Python.RuntimeTests_windows.<version>.nupkg) was being published under the same Packages artifact name the Build stage uses for the activity .nupkg. The final published artifact list therefore contained both the activity package and an internal test package that should never ship — observable on every Python pipeline run, and incidentally on Database/Cryptography runs whenever those pipelines exercise the runtime-tests stage.

Analysis

stage.build.runtime.tests.yml ends with a PublishBuildArtifacts@1 step that named its output Packages. Azure Pipelines merges artifacts that share a name, so the Studio-packed test nupkg was being appended to the existing Packages artifact alongside the activity nupkg. The two consumer templates (stage.run.runtime.tests.windows.yml, stage.run.runtime.tests.portable.yml) then downloaded the merged Packages artifact and selected the test nupkg via a *_windows* / *_portable* glob, so the collision was invisible to the test pipeline itself but very visible in the final artifact list.

The fix is to give the test nupkg its own artifact name and point the two consumers at the new name. Line 40 of stage.build.runtime.tests.yml deliberately keeps artifact: "Packages" — that one is the download of the activity nupkg from the upstream Build stage and must continue to read from Packages.

Behavior Before This PR

A Python pipeline run produces a single Packages artifact containing both UiPath.Python.Activities.<version>.nupkg (correct) and UiPath.Python.RuntimeTests_windows.<version>.nupkg (internal, should not ship). Downstream consumers of the artifact list see the test nupkg as if it were a release artifact.

Behavior After This PR

The same run produces two artifacts: Packages contains only UiPath.Python.Activities.<version>.nupkg; RuntimeTestsPackages contains the *_windows*.nupkg (and *_portable*.nupkg when applicable). The Run-Tests Windows / Portable stages download from RuntimeTestsPackages and continue to select their nupkg via the existing target-framework glob, so test behavior is unchanged.

Considered Use Cases

  • Python pipeline run exercising both the Build and Runtime-Tests stages — primary case.
  • Database pipeline run with PerformDatabaseTests enabled — same shared templates, same fix applied incidentally.
  • Cryptography pipeline run with the runtime-tests stage enabled — same; the portable run has condition: false today, so the Windows run is the only realistic consumer there.
  • BuildRuntimeTests job's download of the activity nupkg (line 40) must continue to read from the upstream Packages artifact — verified untouched.
  • Any future package adopting these shared templates inherits the corrected behavior with no per-pipeline changes.

Implementation

Three single-line YAML changes, all in Activities/.pipelines/jobs/:

  • stage.build.runtime.tests.ymlPublishBuildArtifacts@1 step: ArtifactName: "Packages""RuntimeTestsPackages".
  • stage.run.runtime.tests.windows.ymlDownloadPipelineArtifact@2 step: artifact: "Packages""RuntimeTestsPackages".
  • stage.run.runtime.tests.portable.ymlDownloadPipelineArtifact@2 step: artifact: "Packages""RuntimeTestsPackages".

The download of the activity nupkg at line 40 of stage.build.runtime.tests.yml is intentionally not changed — it reads from the upstream Build stage's Packages artifact, which is unrelated to the leak.

Caveats / Potential Issues

The shared template is also consumed by the Database and Cryptography pipelines, so the fix lands in all three packs symmetrically. This is intentional and not a regression — the same leak existed in those pipelines whenever their runtime-tests stages ran. In practice those stages are usually gated off (PerformDatabaseTests defaults to false; Cryptography portable has condition: false), so the behavior change is low-risk.

How to Test

On the first pipeline run after merge:

  1. Confirm the `Packages` artifact contains only `UiPath.Python.Activities.*.nupkg`.
  2. Confirm a new `RuntimeTestsPackages` artifact appears, containing the `_windows.nupkg` (and `_portable.nupkg` if portable tests run).
  3. Confirm `RunPythonRuntimeTestsWindows` still locates its package via the existing `_windows` glob and runs to completion.

The runtime tests .nupkg was being published under the same "Packages"
artifact name as the activity .nupkg, leaking into the published
artifacts list. Publish it to a separate "RuntimeTestsPackages"
artifact that only the downstream test-runner jobs consume.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexandru-petre alexandru-petre marked this pull request as ready for review May 15, 2026 17:17
@alexandru-petre alexandru-petre requested a review from Copilot May 15, 2026 17:17
@alexandru-petre alexandru-petre requested a review from a team May 15, 2026 17:17
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

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 separates runtime-test NuGet packages from the release package artifact in the shared Activities Azure Pipelines templates, preventing internal test packages from being published under the Packages artifact.

Changes:

  • Publishes packed runtime-test projects as RuntimeTestsPackages.
  • Updates Windows and Portable runtime-test jobs to download RuntimeTestsPackages.
  • Leaves the upstream activity package download from Packages unchanged.

Reviewed changes

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

File Description
Activities/.pipelines/jobs/stage.build.runtime.tests.yml Publishes packed runtime-test packages under the new RuntimeTestsPackages artifact name.
Activities/.pipelines/jobs/stage.run.runtime.tests.windows.yml Downloads runtime-test packages from RuntimeTestsPackages for Windows test execution.
Activities/.pipelines/jobs/stage.run.runtime.tests.portable.yml Downloads runtime-test packages from RuntimeTestsPackages for Portable test execution.

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

@alexandru-petre alexandru-petre self-assigned this May 15, 2026
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.

2 participants