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

Move sync tag only when changed #1605

Merged
merged 2 commits into from
Dec 17, 2018
Merged

Conversation

squaremo
Copy link
Member

Upstream git hosts (e.g., GitHub) can treat each tag push as a fresh
event for the purpose of their own notifications; and since fluxd
pushes the sync tag, every sync, unconditionally, this means there are
many many events.

To avoid most of these spurious events, we can push the tag only when
it looks like it's changed. That is, when the HEAD of the branch
points at a different revision to the sync tag. This was already the
condition used to guard logging the sync event.

You might question whether it's safe to push the tag conditionally --
could it result in an invalid state?

  • in a correct configuration, the sync loop in a single fluxd will be
    the only process moving the tag -- so the view in that process is
    the only one that matters;

  • in an incorrect configuration (e.g., more than one fluxd using
    the same sync tag), we might fail to push the tag if some other
    process has already shifted it to the revision we're looking at. In
    that case, we wouldn't want to move it anyway. (And if someone has
    shifted the tag to a different revision, well we would have pushed
    it before ..)

Fixes #1533.

Upstream git hosts (e.g., GitHub) can treat each tag push as a fresh
event for the purpose of their own notifications; and since fluxd
pushes the sync tag, every sync, unconditionally, this means there are
many many events.

To avoid most of these spurious events, we can push the tag only when
it looks like it's changed. That is, when the HEAD of the branch
points at a different revision to the sync tag. This was already the
condition used to guard _logging_ the sync event.

You might question whether it's safe to push the tag conditionally --
could it result in an invalid state?

 - in a correct configuration, the sync loop in a single fluxd will be
   the only process moving the tag -- so the view in that process is
   the only one that matters;

 - in an _incorrect_ configuration (e.g., more than one fluxd using
   the same sync tag), we might fail to push the tag if some other
   process has already shifted it to the revision we're looking at. In
   that case, we wouldn't want to move it anyway. (And if someone has
   shifted the tag to a different revision, well we would have pushed
   it before ..)
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@squaremo squaremo merged commit 08a7c7b into master Dec 17, 2018
@squaremo squaremo deleted the issue/1533-move-tag-when-changed branch December 17, 2018 14:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants