feat(master): suggest newer version tags for third-party images (#11) (#31)
Docker Build / docker (push) Successful in 45s
Docker Build / docker (push) Successful in 45s
This commit was merged in pull request #31.
This commit is contained in:
@@ -106,9 +106,9 @@ type mergeRow struct {
|
||||
|
||||
// MergeService moves the live service toID onto the removed service fromID:
|
||||
// the old row keeps its id, first_seen_at, update mode and desired ref, takes
|
||||
// the location and inventory of the live row (and its available suggestion),
|
||||
// becomes live, and the live row is deleted. The jobs of the live row move to
|
||||
// the old one. This is the only place a services row is deleted.
|
||||
// the location and inventory of the live row (and its available and newer-tag
|
||||
// suggestions), becomes live, and the live row is deleted. The jobs of the live
|
||||
// row move to the old one. This is the only place a services row is deleted.
|
||||
//
|
||||
// It returns *model.MergeRefusedError when the pair cannot be merged,
|
||||
// model.ErrJobActive when either row has a queued or running job,
|
||||
@@ -195,12 +195,12 @@ func (s *Store) MergeService(ctx context.Context, fromID, toID int64) error {
|
||||
SELECT agent_id, location_key, compose_project, compose_service, working_dir, config_files, built,
|
||||
swarm_cluster_id, swarm_service, container_name, image_repo, actual_ref, actual_digest, status, self,
|
||||
updated_at, available_ref, available_digest, available_source, available_at, last_poll_error,
|
||||
last_tag_digest
|
||||
last_tag_digest, newer_ref, newer_at
|
||||
FROM services WHERE id = $1`, toID).Scan(
|
||||
&t.AgentID, &t.LocationKey, &t.ComposeProject, &t.ComposeService, &t.WorkingDir, &t.ConfigFiles, &t.Built,
|
||||
&t.SwarmClusterID, &t.SwarmService, &t.ContainerName, &t.ImageRepo, &t.ActualRef, &t.ActualDigest, &t.Status, &t.Self,
|
||||
&t.UpdatedAt, &t.AvailableRef, &t.AvailableDigest, &t.AvailableSource, &t.AvailableAt, &t.LastPollError,
|
||||
&lastTagDigest)
|
||||
&lastTagDigest, &t.NewerRef, &t.NewerAt)
|
||||
if err != nil {
|
||||
return fmt.Errorf("merge: read new service: %w", err)
|
||||
}
|
||||
@@ -215,13 +215,14 @@ func (s *Store) MergeService(ctx context.Context, fromID, toID int64) error {
|
||||
available_ref = $18, available_digest = $19, available_source = $20, available_at = $21,
|
||||
last_poll_error = $22,
|
||||
last_tag_digest = CASE WHEN last_tag_digest <> '' THEN last_tag_digest ELSE $23 END,
|
||||
newer_ref = $24, newer_at = $25,
|
||||
removed_at = NULL, awaiting_inventory = false
|
||||
WHERE id = $1`,
|
||||
fromID, t.AgentID, t.LocationKey, t.ComposeProject, t.ComposeService, t.WorkingDir,
|
||||
t.ConfigFiles, t.Built, t.SwarmClusterID, t.SwarmService, t.ContainerName,
|
||||
t.ImageRepo, t.ActualRef, t.ActualDigest, t.Status, t.Self, t.UpdatedAt,
|
||||
t.AvailableRef, t.AvailableDigest, t.AvailableSource, t.AvailableAt,
|
||||
t.LastPollError, lastTagDigest); err != nil {
|
||||
t.LastPollError, lastTagDigest, t.NewerRef, t.NewerAt); err != nil {
|
||||
return fmt.Errorf("merge: update old service: %w", err)
|
||||
}
|
||||
if err := tx.Commit(ctx); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user