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

Commit

Permalink
Merge pull request #1605 from weaveworks/issue/1533-move-tag-when-cha…
Browse files Browse the repository at this point in the history
…nged

Move sync tag only when changed
  • Loading branch information
squaremo authored Dec 17, 2018
2 parents 113e128 + 3c903fa commit 08a7c7b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions daemon/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func TestDaemon_ListImagesWithOptions(t *testing.T) {
{
name: "Override container field selection",
opts: v10.ListImagesOptions{
Spec: specAll,
Spec: specAll,
OverrideContainerFields: []string{"Name", "Current", "NewAvailableImagesCount"},
},
expectedImages: []v6.ImageStatus{
Expand Down Expand Up @@ -320,7 +320,7 @@ func TestDaemon_ListImagesWithOptions(t *testing.T) {
{
name: "Override container field selection with invalid field",
opts: v10.ListImagesOptions{
Spec: specAll,
Spec: specAll,
OverrideContainerFields: []string{"InvalidField"},
},
expectedImages: nil,
Expand Down
30 changes: 15 additions & 15 deletions daemon/loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (d *Daemon) doSync(logger log.Logger) (retErr error) {
Error: n.Result.Error(),
},
Spec: event.ReleaseSpec{
Type: event.ReleaseContainersSpecType,
Type: event.ReleaseContainersSpecType,
ReleaseContainersSpec: &spec,
},
Cause: n.Spec.Cause,
Expand Down Expand Up @@ -411,23 +411,23 @@ func (d *Daemon) doSync(logger log.Logger) (retErr error) {
}

// Move the tag and push it so we know how far we've gotten.
{
ctx, cancel := context.WithTimeout(ctx, gitOpTimeout)
err := working.MoveSyncTagAndPush(ctx, newTagRev, "Sync pointer")
cancel()
if err != nil {
return err
}
}

if oldTagRev != newTagRev {
{
ctx, cancel := context.WithTimeout(ctx, gitOpTimeout)
err := working.MoveSyncTagAndPush(ctx, newTagRev, "Sync pointer")
cancel()
if err != nil {
return err
}
}
logger.Log("tag", d.GitConfig.SyncTag, "old", oldTagRev, "new", newTagRev)
ctx, cancel := context.WithTimeout(ctx, gitOpTimeout)
err := d.Repo.Refresh(ctx)
cancel()
return err
{
ctx, cancel := context.WithTimeout(ctx, gitOpTimeout)
err := d.Repo.Refresh(ctx)
cancel()
return err
}
}

return nil
}

Expand Down

0 comments on commit 08a7c7b

Please sign in to comment.