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

Tag not fetched from Git Repo #1218

Closed
pascalberger opened this Issue Feb 11, 2016 · 15 comments

Comments

Projects
None yet
6 participants
@pascalberger
Contributor

pascalberger commented Feb 11, 2016

This is maybe not directly on issue with the tasks but more with the agent. We're using GitFlow and have pushed a master release containing tag to VSTS, which kicks off the build.

Latest commit on master is:
201b3672ff4fe1c9e1fac0c1912998ca25948a48: Merge branch release/1.1.5

This commit is tagged with 1.1.5.

The log for Get Sources mentions that it checks out this commit. Afterwards I run GitVersion to determine the version which requires the tag on the master commit to correctly determine the version. Unfortunately it seems like the latest tag was not fetched to the agent (everything up to 1.1.4 seems to be there, but not 1.1.5).

Do you have any idea why tags sometimes are not fetched to the agent?

@ericsciple

This comment has been minimized.

Show comment
Hide comment
@ericsciple

ericsciple Feb 11, 2016

Member

I think Ting knows offhand. If not I can dig in.

Member

ericsciple commented Feb 11, 2016

I think Ting knows offhand. If not I can dig in.

@TingluoHuang

This comment has been minimized.

Show comment
Hide comment
@TingluoHuang

TingluoHuang Feb 11, 2016

Member

@pascalberger I believe this was the limitation of libgit2sharp. you won't get annotated tags. If you have access to the build machine, add "build.fetchtags = true" to system environment variable. it would fetch the annotated tags. In the coming release, we provide an option in agent to let it using git.exe to sync code. once that in place, this problem will be solved.

Member

TingluoHuang commented Feb 11, 2016

@pascalberger I believe this was the limitation of libgit2sharp. you won't get annotated tags. If you have access to the build machine, add "build.fetchtags = true" to system environment variable. it would fetch the annotated tags. In the coming release, we provide an option in agent to let it using git.exe to sync code. once that in place, this problem will be solved.

@pascalberger

This comment has been minimized.

Show comment
Hide comment
@pascalberger

pascalberger Feb 11, 2016

Contributor

@TingluoHuang Thanks. Adding a environment variable named build.fetchtags with the value of true doesn't seem to help. In the above case it still only fetches tags up to 1.1.4 but not the recent 1.1.5.

Btw. Clean repository is set to true

Contributor

pascalberger commented Feb 11, 2016

@TingluoHuang Thanks. Adding a environment variable named build.fetchtags with the value of true doesn't seem to help. In the above case it still only fetches tags up to 1.1.4 but not the recent 1.1.5.

Btw. Clean repository is set to true

@pascalberger

This comment has been minimized.

Show comment
Hide comment
@pascalberger

pascalberger Feb 11, 2016

Contributor

It seems to work if I set the build.clean variable to all. Is it expected behavior that tags are not fetched with the default cleaning behavior?

Contributor

pascalberger commented Feb 11, 2016

It seems to work if I set the build.clean variable to all. Is it expected behavior that tags are not fetched with the default cleaning behavior?

@ericsciple

This comment has been minimized.

Show comment
Hide comment
@ericsciple

ericsciple Feb 11, 2016

Member

Clean checkbox on the repo tab only does git clean -fdx/reset --hard (assuming git.exe is in your PATH). Build.Clean=all will drop the entire build folder (and re-clone).

Setting a system env var may require rebooting the agent. You could double check whether it's set in the agent's context by looking for it as a system capability on the admin page for the agent.

Member

ericsciple commented Feb 11, 2016

Clean checkbox on the repo tab only does git clean -fdx/reset --hard (assuming git.exe is in your PATH). Build.Clean=all will drop the entire build folder (and re-clone).

Setting a system env var may require rebooting the agent. You could double check whether it's set in the agent's context by looking for it as a system capability on the admin page for the agent.

@pascalberger

This comment has been minimized.

Show comment
Hide comment
@pascalberger

pascalberger Feb 11, 2016

Contributor

Restarted the agent to make sure the he sees the env variable (they are shown in the agent page), but still tags are not fetched without re-cloning.

Contributor

pascalberger commented Feb 11, 2016

Restarted the agent to make sure the he sees the env variable (they are shown in the agent page), but still tags are not fetched without re-cloning.

@TingluoHuang

This comment has been minimized.

Show comment
Hide comment
@TingluoHuang

TingluoHuang Feb 11, 2016

Member

@pascalberger can you try to use git.exe do "git fetch --tags" on the source folder after the build finish, see whether you will get the tag you wanted?

Member

TingluoHuang commented Feb 11, 2016

@pascalberger can you try to use git.exe do "git fetch --tags" on the source folder after the build finish, see whether you will get the tag you wanted?

@pascalberger

This comment has been minimized.

Show comment
Hide comment
@pascalberger

pascalberger Feb 12, 2016

Contributor

@TingluoHuang Unfortunately I already have updated all build definitions already to use Build.Clean=all to get stuff working again for us. Therefore I'm no longer to replicate the old behavior (which occurred only if repo was cloned, later tags were introduced and repo was cleaned with git clean -fdx/reset --hard) without doing a whole reproduction.

Just running a build from an old commit still fetches all tags (even the ones newer than the commit). Which is another thing leading to trouble while depending on git tags to determine the version during build.

Contributor

pascalberger commented Feb 12, 2016

@TingluoHuang Unfortunately I already have updated all build definitions already to use Build.Clean=all to get stuff working again for us. Therefore I'm no longer to replicate the old behavior (which occurred only if repo was cloned, later tags were introduced and repo was cleaned with git clean -fdx/reset --hard) without doing a whole reproduction.

Just running a build from an old commit still fetches all tags (even the ones newer than the commit). Which is another thing leading to trouble while depending on git tags to determine the version during build.

@c0bra

This comment has been minimized.

Show comment
Hide comment
@c0bra

c0bra May 25, 2016

Any updates on this issue?

c0bra commented May 25, 2016

Any updates on this issue?

@bryanmacfarlane

This comment has been minimized.

Show comment
Hide comment
@bryanmacfarlane
Member

bryanmacfarlane commented May 25, 2016

@bryanmacfarlane

This comment has been minimized.

Show comment
Hide comment
@bryanmacfarlane

bryanmacfarlane May 25, 2016

Member

... new preview will drop in day or two

Member

bryanmacfarlane commented May 25, 2016

... new preview will drop in day or two

@maximpashuk

This comment has been minimized.

Show comment
Hide comment
@maximpashuk

maximpashuk Jun 20, 2016

I was able to fetch annotated tags when set variable 'build.fetchtags' to 'true' in build definition (TFS 2015.2).

maximpashuk commented Jun 20, 2016

I was able to fetch annotated tags when set variable 'build.fetchtags' to 'true' in build definition (TFS 2015.2).

@ericsciple

This comment has been minimized.

Show comment
Hide comment
@ericsciple

ericsciple Jun 27, 2016

Member

I talked with @TingluoHuang. Support for prefering git.exe has been added: https://www.visualstudio.com/en-us/docs/build/scripts/git-commands#how-does-enabling-scripts-to-run-git-commands-affect-how-the-build-process-gets-build-sources

Also as mentioned previously, the new agent (currently in preview) always uses git (not LibGit2Sharp).

Member

ericsciple commented Jun 27, 2016

I talked with @TingluoHuang. Support for prefering git.exe has been added: https://www.visualstudio.com/en-us/docs/build/scripts/git-commands#how-does-enabling-scripts-to-run-git-commands-affect-how-the-build-process-gets-build-sources

Also as mentioned previously, the new agent (currently in preview) always uses git (not LibGit2Sharp).

@ericsciple ericsciple closed this Jun 27, 2016

@ericsciple

This comment has been minimized.

Show comment
Hide comment
@ericsciple
Member

ericsciple commented Jun 27, 2016

@pascalberger

This comment has been minimized.

Show comment
Hide comment
@pascalberger

pascalberger Jun 27, 2016

Contributor

@ericsciple Great, Thanks!

Contributor

pascalberger commented Jun 27, 2016

@ericsciple Great, Thanks!

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