Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Working clones occasionally balk at fetching sync tag #2169

Closed
squaremo opened this issue Jun 19, 2019 · 1 comment · Fixed by #2184
Closed

Working clones occasionally balk at fetching sync tag #2169

squaremo opened this issue Jun 19, 2019 · 1 comment · Fixed by #2184
Labels
blocked-needs-validation Issue is waiting to be validated before we can proceed bug

Comments

@squaremo
Copy link
Member

squaremo commented Jun 19, 2019

A user that has fluxd 1.12.3 connected to weave cloud occasionally sees an error message in the UI, represented in the log like this:

ts=2019-05-29T06:51:26.34694615Z caller=logging.go:42 component=upstream method=ListServices error="git fetch --tags /tmp/flux-gitclone212733495 [refs/notes/flux-flux:refs/notes/flux]: From /tmp/flux-gitclone212733495\n * [new ref]         refs/notes/flux -> refs/notes/flux\n ! [rejected]        flux-sync -> flux-sync (would clobber existing tag)\n"

(NB I have anonymised the name of the ref)
I think the chain of events is something along the lines of:

  1. The UI calls the API ListServices
  2. fluxd clones its repo mirror into a temporary directory, at HEAD, so it can examine the files
  3. as part of the clone, it fetches the sync tag from the mirror to the temp dir
  4. for whatever reason, between the clone and the subsequent fetch, the tag has changed
@squaremo squaremo added bug blocked-needs-validation Issue is waiting to be validated before we can proceed labels Jun 19, 2019
@errordeveloper
Copy link
Contributor

errordeveloper commented Jun 20, 2019

I came across this earlier, as we've had an issue with eksctl release script. As of git 2.20.0, one has to run git fetch --tags --force, if they'd like to trust the remote tags.

hiddeco added a commit that referenced this issue Jun 25, 2019
In Git 2.20 "git fetch" was taught to forbid updates to existing tags
without the "--force" option[1]. As Flux force-pushes a tag all the
time to keep track of the sync state, this would sometimes lead to
'would clobber existing tag' errors while making sure a fresh checkout
was up-to-date with its mirror, as described issue 2169[2].

To prevent this from happening: force fetch all tags from the mirror
while creating the local working clone, and _before_ fetching anything
else.

NB: We only have to do this while creating a working clone from a
mirror, as a mirror (bare clone) will accept non-fast-forward tag
changes from remote.

[1]: https://github.com/git/git/blob/master/Documentation/RelNotes/2.20.0.txt#L67-L71
[2]: #2169
hiddeco added a commit that referenced this issue Jun 25, 2019
In Git 2.20 "git fetch" was taught to forbid updates to existing tags
without the "--force" option[1]. As Flux force-pushes a tag all the
time to keep track of the sync state, this would sometimes lead to
'would clobber existing tag' errors while making sure a fresh checkout
was up-to-date with its mirror, as described issue 2169[2].

To prevent this from happening: force fetch all tags from the mirror
while creating the local working clone, and _before_ fetching anything
else.

NB: We only have to do this while creating a working clone from a
mirror, as a mirror (bare clone) will accept non-fast-forward tag
changes from remote.

[1]: https://github.com/git/git/blob/master/Documentation/RelNotes/2.20.0.txt#L67-L71
[2]: #2169
hiddeco added a commit that referenced this issue Jun 25, 2019
In Git 2.20 "git fetch" was taught to forbid updates to existing tags
without the "--force" option[1]. As Flux force-pushes a tag all the
time to keep track of the sync state, this would sometimes lead to
'would clobber existing tag' errors while making sure a fresh checkout
was up-to-date with its mirror, as described issue 2169[2].

To prevent this from happening: force fetch all tags from the mirror
while creating the local working clone, and _before_ fetching anything
else.

NB: We only have to do this while creating a working clone from a
mirror, as a mirror (bare clone) will accept non-fast-forward tag
changes from remote.

[1]: https://github.com/git/git/blob/master/Documentation/RelNotes/2.20.0.txt#L67-L71
[2]: #2169
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked-needs-validation Issue is waiting to be validated before we can proceed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants