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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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