feat(master): suggest newer version tags for third-party images (#11)
This commit is contained in:
@@ -104,6 +104,19 @@ func (m *memStore) SetLastTagDigest(_ context.Context, id int64, digest string)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *memStore) SetNewer(_ context.Context, id int64, ref string, at time.Time) error {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
svc, ok := m.svcRows[id]
|
||||
if !ok {
|
||||
return model.ErrNotFound
|
||||
}
|
||||
svc.NewerRef = ref
|
||||
svc.NewerAt = &at
|
||||
m.svcRows[id] = svc
|
||||
return nil
|
||||
}
|
||||
|
||||
// seedService adds a service row that jobs can be triggered for.
|
||||
func (m *memStore) seedService(svc model.Service) {
|
||||
m.mu.Lock()
|
||||
|
||||
@@ -34,6 +34,9 @@ func (f *fixedRegistry) Digest(_ context.Context, ref string) (string, error) {
|
||||
return f.digests[ref], nil
|
||||
}
|
||||
|
||||
// Tags lists no tags, so no newer tag is ever suggested.
|
||||
func (f *fixedRegistry) Tags(context.Context, string) ([]string, error) { return nil, nil }
|
||||
|
||||
func TestPickPinnedVersion(t *testing.T) {
|
||||
env := newJobEnv(t)
|
||||
env.store.seedVersion(model.ImageVersion{ID: 5, Repo: slusk, Tag: "1.3.0", Digest: "sha256:old130", Source: model.SourceRunning})
|
||||
|
||||
Reference in New Issue
Block a user