You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a workflow that configures create-pull-request and checks out additional
repositories, ado-aw generates a SafeOutputs job that references every
PR-eligible repository directory but checks out only self.
This leaves the additional repository directories absent in Stage 3. It also
changes Azure Pipelines' placement of self: with only one checkout, self
lives directly at $(Build.SourcesDirectory), while the generated executor
source path assumes the multi-checkout layout under $(Build.SourcesDirectory)/$(Build.Repository.Name).
As a result, the SafeOutputs job cannot reliably prepare or execute a
multi-repository create-pull-request.
PR #1458 correctly fixed the shallow-checkout failure tracked by #1453. It
staged prepare-pr-base.js in the SafeOutputs job and fetched the target ref
before ado-aw execute.
The remaining gap is narrower:
create_pr_prepare_repos emits --repo-dir arguments for self and every
additional checkout.
build_safeoutputs_job still emits only checkout: self.
---name: Multi-repo PRdescription: Opens a pull request in an additional Azure Repos repositoryworkspace: rootrepos:
- name: Project/toolsalias: toolssafe-outputs:
create-pull-request:
target-branch: main---## Objective
Update one file in the `tools` checkout and create a pull request with
`repository: tools`.
Compile the workflow and inspect the generated SafeOutputs job.
Azure Pipelines jobs have isolated workspaces. The Agent job's tools
checkout is therefore unavailable in SafeOutputs.
Because SafeOutputs has only one checkout:
$(Build.SourcesDirectory)/tools does not exist.
self is placed directly at $(Build.SourcesDirectory).
The nested --source path under $(Build.Repository.Name) does not exist.
The prepare step or executor fails before the proposed PR can be applied.
Expected behavior
Any SafeOutputs variant that executes create-pull-request should check out:
self.
Every additional unified repos: entry with checkout: true.
Those checkouts must use the same aliases as the Agent job and run before prepare-pr-base.js and ado-aw execute.
This gives SafeOutputs the same multi-checkout layout assumed by:
create_pr_prepare_repos;
CreatePullRequestResult repository resolution; and
the generated executor source path.
Repositories declared with checkout: false must remain resource-only.
For split approval, additional checkouts should appear only in the
SafeOutputs/SafeOutputs_Reviewed variant whose tool set actually includes create-pull-request.
Suggested implementation
In build_safeoutputs_job, after checkout_self_step and when variant.runs_create_pull_request is true, emit the same additional checkout
steps used by the Agent job for every checked-out repository alias.
Keep the current per-repository target-branch resolution and prepare-pr-base.js invocation unchanged.
Regression tests
Extend the existing issue-1453 compiler coverage with a workflow containing
two additional repositories:
Assert the Agent job has:
checkout: self
checkout: tools
checkout: docs
Assert the SafeOutputs variant that runs create-pull-request has the same
three checkout steps before prepare-pr-base.js.
Assert the generated executor --source path matches Azure's
multi-checkout placement of self.
Assert a checkout: false repository is not checked out.
Assert split-approval emits the additional checkouts only in the variant
that executes create-pull-request.
An ADO smoke test should create a PR against an additional checkout, since a
hermetic prepare-pr-base.js test cannot detect missing Azure checkout steps.
Affected versions
Reproduced in v0.45.1.
Still present on main at 120f6600.
Still present in the open v0.46.0 release PR chore(main): release 0.46.0 #1530; that release branch has
no checkout-logic diff from main.
Summary
For a workflow that configures
create-pull-requestand checks out additionalrepositories, ado-aw generates a SafeOutputs job that references every
PR-eligible repository directory but checks out only
self.This leaves the additional repository directories absent in Stage 3. It also
changes Azure Pipelines' placement of
self: with only one checkout,selflives directly at
$(Build.SourcesDirectory), while the generated executorsource path assumes the multi-checkout layout under
$(Build.SourcesDirectory)/$(Build.Repository.Name).As a result, the SafeOutputs job cannot reliably prepare or execute a
multi-repository
create-pull-request.Relationship to #1458
PR #1458 correctly fixed the shallow-checkout failure tracked by #1453. It
staged
prepare-pr-base.jsin the SafeOutputs job and fetched the target refbefore
ado-aw execute.The remaining gap is narrower:
create_pr_prepare_reposemits--repo-dirarguments forselfand everyadditional checkout.
build_safeoutputs_jobstill emits onlycheckout: self.--repo-dirarguments are present, but does not assert that correspondingcheckout steps create those directories.
Minimal reproduction
Compile the workflow and inspect the generated
SafeOutputsjob.Actual generated shape
The job effectively contains:
Azure Pipelines jobs have isolated workspaces. The Agent job's
toolscheckout is therefore unavailable in SafeOutputs.
Because SafeOutputs has only one checkout:
$(Build.SourcesDirectory)/toolsdoes not exist.selfis placed directly at$(Build.SourcesDirectory).--sourcepath under$(Build.Repository.Name)does not exist.The prepare step or executor fails before the proposed PR can be applied.
Expected behavior
Any SafeOutputs variant that executes
create-pull-requestshould check out:self.repos:entry withcheckout: true.Those checkouts must use the same aliases as the Agent job and run before
prepare-pr-base.jsandado-aw execute.This gives SafeOutputs the same multi-checkout layout assumed by:
create_pr_prepare_repos;CreatePullRequestResultrepository resolution; andRepositories declared with
checkout: falsemust remain resource-only.For split approval, additional checkouts should appear only in the
SafeOutputs/SafeOutputs_Reviewed variant whose tool set actually includes
create-pull-request.Suggested implementation
In
build_safeoutputs_job, aftercheckout_self_stepand whenvariant.runs_create_pull_requestis true, emit the same additional checkoutsteps used by the Agent job for every checked-out repository alias.
Keep the current per-repository target-branch resolution and
prepare-pr-base.jsinvocation unchanged.Regression tests
Extend the existing issue-1453 compiler coverage with a workflow containing
two additional repositories:
checkout: selfcheckout: toolscheckout: docscreate-pull-requesthas the samethree checkout steps before
prepare-pr-base.js.--sourcepath matches Azure'smulti-checkout placement of
self.checkout: falserepository is not checked out.that executes
create-pull-request.An ADO smoke test should create a PR against an additional checkout, since a
hermetic
prepare-pr-base.jstest cannot detect missing Azure checkout steps.Affected versions
mainat120f6600.no checkout-logic diff from
main.Related
create-pull-requestworktree fails — the prepare-pr-base step runs in the Agent job, but the executor runs in the SafeOutputs job (standalone target) #1453