-
Notifications
You must be signed in to change notification settings - Fork 869
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
Add AllowWorkDirectoryRepositories
knob
#4423
Add AllowWorkDirectoryRepositories
knob
#4423
Conversation
AllowWorkDirectoryRepositories
knob
It is awesome that this is being added.
|
|
… of https://github.com/microsoft/azure-pipelines-agent into users/levochkin/allow-work-directory-repositories-knob
I don't know for sure of course, but since it got merged into master right after they created the 3.229 release branch I guess it will come with release 3.231 around end of November or in December. |
By the way, I've already compiled the Windows x64 agent with this feature (commit a3067b7 from master merger) myself and we're using it for our tests with the newly structure pipelines that use multiple centralized repositories. Everything works as expected. There's the bug with the wrong detection of the primary repository if the self repository isn't checked out first of course (see #4217), but that's not urgent since all you need to do to fix it is check out the self repository first. There's also the fun behaviour of Build.SourcesDirectory which will always point to \s in a multi-checkout scenario and System.DefaultWorkingDirectory which will always point to the same directory as Build.SourcesDirectory. So people have to keep that in mind, but we've already adapted the documentation accordingly a few years ago, so the behaviour is clearly documented. There's of course my feature request and pull request for the adaptable working directory by just choosing one of the repositories as the working directory (#3479), but that would need to be added to the yaml definition of the Azure DevOps Server as well. However, as long as you know where you've checked out to and just use that exact path when calling scripts or similar that shouldn't be a problem either. The only problem I encountered is with the SonarQube extension which just assumes the System.DefaultWorkingDirectory as the projectBaseDir when the MSBuild scanner is used, but that's their problem really, since they should have made that adaptable. tl;dr: everything works as expected and as documented |
Glad to see there has been some discussion around this issue and some movement. In the latest case, it is very simple 3 step pipeline using a single repo. The .yml is currently just in my private branch. Of course, pulling the changes in git in another copy of the repo on one of my machines pulls down just the change to the yml very quickly. So appears to be an issue with ADO keeping track of which repo has been used in which workdir rather than a git issue. Though it does seem to keep track to a certain degree. When running the same job multiple times, ADO does select the same agent for the job each time unless there is alot of activity and the agent gets assigned a different job before this job is run again. Anyway, I'll check the comments and see if there are new settings or clues for how to address this. |
Part of the problem I had above was a result of a recent change to ADO where, for new pipelines, it uses shallow by default. |
Hello, I am having trouble using this knob - would you be able to share documentation or a detailed walkthrough of how to activate this feature? As a background, I work in an environment where we will easily run 8+ different pipelines in the same repository on one machine. Because of this, we are now seeing our agent work directory take upwards of 400 GB, which obviously we want to decrease :D Currently I am stuck getting this error:
Here is my file structure (with specific information obfuscated under general examples):
This is how I am specifying the path to the folder:
At this point I have tried to activate this feature 2 different ways:
System info:
Any help you can give would be greatly appreciated! It could very well be that I am missing a step in the process of activating, I just wouldn't know where that is :P |
Hi @noahzalapi, thank you for your question. As per my understanding the azure-pipelines-agent/src/Misc/layoutroot/env.sh Lines 3 to 18 in 8c756a7
If you want to add a custom variable such as Basically, after running export AZP_AGENT_ALLOW_WORK_DIRECTORY_REPOSITORIES='true' here:
Then you can run |
Hey @aleksandrlevochkin - thank you for your response! Adding this line to my Thank you again for all your help! :) |
Description
Added
AllowWorkDirectoryRepositories
knob that allows to set a relative path to the_work
directory during checkout.Related issues: #1506, #4192
Based on this PR by @echalone #3475
Testing
AZP_AGENT_ALLOW_WORK_DIRECTORY_REPOSITORIES
variable