Skip to content

Commit

Permalink
refactor: Handle missing images and improve service deployment logic
Browse files Browse the repository at this point in the history
  • Loading branch information
yarlson committed Nov 22, 2024
1 parent 8b48a15 commit 3e5d06b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ func (d *Deployment) getImageHash(imageName string) (string, error) {
return "", err
}

if strings.Contains(output, "Error: No such ") {
return "", nil
}

return strings.TrimSpace(output), nil
}

Expand Down Expand Up @@ -748,7 +752,12 @@ func (d *Deployment) serviceChanged(project string, service *config.Service) (bo
}

func (d *Deployment) deployService(project string, service *config.Service) error {
hash, err := d.getImageHash(service.Image)
imageName := service.Image
if imageName == "" {
imageName = fmt.Sprintf("%s-%s", project, service.Name)
}

hash, err := d.getImageHash(imageName)
if err != nil {
return fmt.Errorf("failed to pull image for %s: %w", service.Name, err)
}
Expand Down

0 comments on commit 3e5d06b

Please sign in to comment.