-
Notifications
You must be signed in to change notification settings - Fork 651
Docs for building PRs with VSTS #993
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
Comments
I'm not sure this is always the best way to to go. There is also another issue that tags were not fetched in certain scenarios, for which there is already another workaround documented here, by setting the IMHO it would be a better approach to document what is required for GitVersion to work properly (eg. have all tags fetched, have certain branches fetched, etc), and list the possible ways to achieve this with their pros/cons, so that the user can decide what best fits its setup. |
I don't know how to make pull requests fetch everything without this change? I am using on prem agents |
@JakeGinnivan Ah yes, you're right. Seems to always checkout a ref.< But instead of having the user to add an additional task to every build definition, wouldn't it be better if the GitVersion VSTS task or GitVersion itself would fetch the missing branches itself? |
This can probably be built into GitVersion itself to fetch automatically, and throw if the OAuth token is not available |
This would presumably be surfaced as an option on the GitVersion build step. |
It would be built into the core. Disabled with the /nofetch option. |
Your using on-premises build agents? |
Both actually. The one I'm currently troubleshooting is a hosted agent with the repository that just has some binaries and a nuspec. Is there a recommended option for current versions that will sort out this PR issue and the possibility of tags not being fetched? |
Follow the instructions in the first post to work around it. I haven't had time to really take this further as this workaround worked for me |
First post being the extra build step outlined above? Seems like a good time to look at that new meta-task thingy :) |
heh, I don't want to make the workaround the primary fix. Id prefer we just build it in and make it transparent :) |
@nulltoken do you know if we can specify additional headers through libgit2sharp? Need to do something like this |
@JakeGinnivan Not that I know of. @ethomson @carlosmn Did you make something like this happen? |
@nulltoken No, we do not yet support this, though it seems like it would be a nice addition. Patches welcome! ;) |
@ethomson Thanks for the feedback ❤️ |
When built into the task itself, it will be able to access the oauth token without needing a special setting. |
Since libgit2sharp doesn't seem to support passing an OAuth token, it may be the best solution at the moment to implement this in the VSTS task, and require the user to make the OAuth token available to the task and have Git installed on the agent (which should be no longer an issue using the new agent). |
The task itself is able to access the OAuth token directly using the following code (old powershell host, the code for powershell3 is very similar, but it looks like you're still on the old host):
I'd personally stick a demand for git.exe on the task and have checkbox to perform You could skip the demand and perform a |
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions. |
VSTS seems to specify a refspec when fetching, something like this:
This means it doesn't fetch master or develop.
The workaround is:
git fetch
task inThe argument should be
-c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" fetch --prune --progress origin
We need to add this info to the docs.
The text was updated successfully, but these errors were encountered: