diff --git a/.pipelines/release.yml b/.pipelines/release.yml index c4acd3b2..c3fc625d 100644 --- a/.pipelines/release.yml +++ b/.pipelines/release.yml @@ -462,6 +462,8 @@ extends: displayName: Setup Python 3.12 inputs: versionSpec: '3.12' + env: + PIP_INDEX_URL: https://packagefeedproxy.microsoft.io/pypi/simple/ - task: PowerShell@2 displayName: Verify complete Python release set @@ -517,7 +519,7 @@ extends: Write-Host "Packages:" Get-ChildItem $(Pipeline.Workspace)/npm-packages/ - - task: EsrpRelease@10 + - task: EsrpRelease@11 displayName: Publish to NPM via ESRP inputs: ConnectedServiceName: ${{ parameters.signingIdentity.serviceName }} @@ -576,7 +578,7 @@ extends: } $wheels | Copy-Item -Destination $destination - - task: EsrpRelease@10 + - task: EsrpRelease@11 displayName: Publish dynwinrt to PyPI via ESRP inputs: ConnectedServiceName: ${{ parameters.signingIdentity.serviceName }} @@ -627,7 +629,7 @@ extends: } $wheels | Copy-Item -Destination $destination - - task: EsrpRelease@10 + - task: EsrpRelease@11 displayName: Publish dynwinrt-codegen to PyPI via ESRP inputs: ConnectedServiceName: ${{ parameters.signingIdentity.serviceName }} diff --git a/eng/ci/test_ci.py b/eng/ci/test_ci.py index c01e2495..af5ae522 100644 --- a/eng/ci/test_ci.py +++ b/eng/ci/test_ci.py @@ -409,6 +409,42 @@ def test_gate_truth_tables_execute_the_real_gate(self): self.assertEqual(result.returncode, 0, result.stdout + result.stderr) +class ReleasePipelineTests(unittest.TestCase): + def test_python_setup_uses_approved_package_index(self): + pipeline = yaml.safe_load( + (ROOT / ".pipelines" / "release.yml").read_text(encoding="utf-8") + ) + collect = next(stage for stage in pipeline["extends"]["parameters"]["stages"] + if stage.get("stage") == "Collect_Python") + job = next(job for job in collect["jobs"] if job["job"] == "collect_python") + setup = [step for step in job["steps"] if step.get("task") == "UsePythonVersion@0"] + self.assertEqual(len(setup), 1) + self.assertEqual(setup[0]["inputs"]["versionSpec"], "3.12") + self.assertEqual( + setup[0].get("env", {}).get("PIP_INDEX_URL"), + "https://packagefeedproxy.microsoft.io/pypi/simple/", + ) + + def test_esrp_publishers_use_node20_task_version(self): + pipeline = yaml.safe_load( + (ROOT / ".pipelines" / "release.yml").read_text(encoding="utf-8") + ) + publishers = [] + for entry in pipeline["extends"]["parameters"]["stages"]: + stages = ([entry] if "stage" in entry else + [stage for conditional in entry.values() for stage in conditional]) + for stage in stages: + for job in stage["jobs"]: + for step in job["steps"]: + if step.get("task", "").startswith("EsrpRelease@"): + publishers.append((job["job"], step["task"])) + self.assertCountEqual(publishers, [ + ("publish_npm", "EsrpRelease@11"), + ("publish_python_runtime", "EsrpRelease@11"), + ("publish_python_codegen", "EsrpRelease@11"), + ]) + + class NativeImportGateTests(unittest.TestCase): def test_prebuilt_python_gate_uses_node_and_installed_no_hooks_extension(self): steps = JOBS["e2e-runtime"]["steps"] diff --git a/eng/release/README.md b/eng/release/README.md index dbb4a63e..a0362631 100644 --- a/eng/release/README.md +++ b/eng/release/README.md @@ -46,3 +46,21 @@ supplied `-RepositoryRoot` is still honored. The release job's 1ES SBOM validation remains enabled. Local configuration tests check the staging and publication paths; hosted 1ES execution is needed to verify SBOM generation and validation. + +## Python setup + +In `.pipelines/release.yml`, `Collect_Python` sets the approved package mirror +through task-scoped `PIP_INDEX_URL` on `UsePythonVersion@0`. This configures the +pip upgrade performed by the downloaded Python installer on a cold tool cache. +The `--index-url` on the later wheel-verification command cannot configure the +earlier setup task. `eng/ci/test_ci.py` checks the task's mirror configuration +without installing Python or running a release. + +## ESRP task runner + +All npm and PyPI publishers use `EsrpRelease@11`, whose installed task uses the +`Node20_1` handler. The `@10` task uses Node16 and is blocked before execution by +the agent's end-of-life Node policy. The upgrade preserves the existing task +inputs and does not change that policy or the Node version used by shipped +packages. `eng/ci/test_ci.py` checks all three publisher task versions without +invoking ESRP.