Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot checkout to $(Build.SourcesDirectory) #16093

Closed
d5han opened this issue Apr 1, 2022 · 3 comments
Closed

Cannot checkout to $(Build.SourcesDirectory) #16093

d5han opened this issue Apr 1, 2022 · 3 comments

Comments

@d5han
Copy link

d5han commented Apr 1, 2022

Required Information

Question, Bug, or Feature?
Type: bug

Enter Task Name: checkout

Issue Description

The checkout task cannot make use of the $(Build.SourcesDirectory) variable in its path argument because it is a "rooted" path. This requires working around the issue by knowing what the SourcesDirectory will resolve to, and what working directory the checkout task will run in (especially since it doesn't take a workingDirectory argument).

If the reason for blocking rooted paths is concern the task will create files outside of its pipeline workspace, allowing an exception to this error when the argument to path is within $(Pipeline.Workspace) would be a good resolution.

Example:

- checkout: example-repo
  path: $(Build.SourcesDirectory)/example-repo

Results in:

##[error]/home/agent/myagent/_work/13/s/example-repo can not be a rooted path.
@anatolybolshakov
Copy link
Contributor

Hi @d5han at the moment it is by design - checkout task supports only relative paths and chooses root directory by itself - depending on set of repositories used/build definition/project collection (see docs for more details).
We also have another enhancement in a backlog and PRs on review which add capability to re-use repositories outside of working directory - feel free to track progress around these changes here.

@github-actions
Copy link

github-actions bot commented Oct 1, 2022

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Oct 1, 2022
@github-actions github-actions bot closed this as completed Oct 6, 2022
@ghost
Copy link

ghost commented Oct 13, 2023

Documentation implies this is a perfectly OK thing to do.

https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-checkout?view=azure-pipelines

" path: string # Where to put the repository. The root directory is $(Pipeline.Workspace)."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants