Azure / Azure/azure-sdk-tools

[ARH] Support 1ES

Open
#16,814 0 comments 0 reactions 1 assignee Claimed by @tjprescott View on GitHub
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 2h
Merged PRs (30d)
130

Description

## Context

The API Review Hub request pipeline currently triggers the Azure DevOps S360 warning because `eng/pipelines/handle-apireview-hub-request.yml` does not extend an approved 1ES pipeline template.

A trial migration to `/eng/pipelines/templates/stages/1es-redirect.yml` failed pipeline compilation because 1ES rejects `PublishBuildArtifacts@1`:

> `PublishBuildArtifacts@1 task is not allowed. Please use output: pipelineArtifact instead.`

The artifact publication declarations must live in the generated job's `templateContext.outputs`. The language-specific template currently owns that job, so the handler cannot add the outputs without changes to the wrapper contract.

## Required changes

### azure-sdk-tools

- Update `eng/common/pipelines/templates/jobs/apireview-hub-job-base.yml`:
- Add an `outputs` object parameter with an empty default.
- Add `templateContext.outputs` to the generated job and populate it from that parameter.
- Update `eng/pipelines/handle-apireview-hub-request.yml`:
- Replace the three `PublishBuildArtifacts@1` steps with job outputs passed to the language wrapper.
- Publish the target bundle on `succeeded()` from `$(Build.ArtifactStagingDirectory)/target`.
- Publish the result summary on `succeededOrFailed()` from `$(Build.ArtifactStagingDirectory)/result`.
- Conditionally add the base bundle output on `succeeded()` from `$(Build.ArtifactStagingDirectory)/base` only when `baseRef` is present.
- Preserve the configurable `baseArtifactName`, `targetArtifactName`, and `resultArtifactName` values.
- Wrap the existing single `Generate` stage with `/eng/pipelines/templates/stages/1es-redirect.yml` using `Use1ESOfficial: true`.
- Preserve the current one-stage, one-generation-job execution model.

### azure-sdk-for-python

- Update `eng/pipelines/templates/jobs/apireview-hub-job-python.yml`:
- Add an `outputs` object parameter with an empty default.
- Forward `outputs` to `/eng/common/pipelines/templates/jobs/apireview-hub-job-base.yml`.
- Consume the synchronized base-job change in `eng/common/pipelines/templates/jobs/apireview-hub-job-base.yml`, including `templateContext.outputs` support.
- Validate the Python API Review Hub request pipeline through Azure DevOps template compilation.

## Expected output shape

```yaml
templateContext:
outputs:
- output: pipelineArtifact
displayName: Publish target API review bundle
condition: succeeded()
artifactName:
targetPath: $(Build.ArtifactStagingDirectory)/target
- output: pipelineArtifact
displayName: Publish API review result summary
condition: succeededOrFailed()
artifactName:
targetPath: $(Build.ArtifactStagingDirectory)/result
```

Add the equivalent base output conditionally when `baseRef` is non-empty.

## Acceptance criteria

- Pipeline 8305 queues successfully under the official 1ES template.
- No `PublishBuildArtifacts@1` tasks remain in the handler.
- Base, target, and result artifact names and contents remain compatible with API Review Hub.
- Target-only requests do not attempt to publish a missing base directory.
- The Python language wrapper forwards the 1ES output contract to the base job.
- The pipeline retains one functional generation job.
- The S360/1ES template warning is resolved.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.