From 6bd17c7e5811114821c999ec7b3123f66a03f31f Mon Sep 17 00:00:00 2001 From: Yar Kravtsov Date: Mon, 20 Jan 2025 21:51:40 +0200 Subject: [PATCH] fix(service): prevent image update flag from affecting service hash --- pkg/config/config.go | 4 +++- pkg/deployment/dependency.go | 2 +- pkg/deployment/deployment.go | 3 ++- pkg/deployment/service.go | 3 ++- pkg/deployment/volume.go | 2 +- pkg/tunnel/tunnel.go | 3 ++- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 0ed6c71..dcce08b 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -408,7 +408,9 @@ func extractNamedVolume(volRef string) string { } func (s *Service) Hash() (string, error) { - sortedService := s.sortServiceFields() + service := *s + service.ImageUpdated = false + sortedService := service.sortServiceFields() bytes, err := json.Marshal(sortedService) if err != nil { return "", fmt.Errorf("failed to marshal sorted service: %w", err) diff --git a/pkg/deployment/dependency.go b/pkg/deployment/dependency.go index a6d2d93..13ded18 100644 --- a/pkg/deployment/dependency.go +++ b/pkg/deployment/dependency.go @@ -58,4 +58,4 @@ func (d *Deployment) startDependency(project string, dependency *config.Dependen } return nil -} \ No newline at end of file +} diff --git a/pkg/deployment/deployment.go b/pkg/deployment/deployment.go index be87a07..8e314ab 100644 --- a/pkg/deployment/deployment.go +++ b/pkg/deployment/deployment.go @@ -3,11 +3,12 @@ package deployment import ( "context" "fmt" - "github.com/yarlson/ftl/pkg/runner/local" "io" "path/filepath" "strings" + "github.com/yarlson/ftl/pkg/runner/local" + "github.com/yarlson/ftl/pkg/config" "github.com/yarlson/ftl/pkg/console" ) diff --git a/pkg/deployment/service.go b/pkg/deployment/service.go index 0a19fa1..9284ba9 100644 --- a/pkg/deployment/service.go +++ b/pkg/deployment/service.go @@ -3,10 +3,11 @@ package deployment import ( "context" "fmt" - "github.com/yarlson/ftl/pkg/config" "strings" "sync" "time" + + "github.com/yarlson/ftl/pkg/config" ) func (d *Deployment) deployServices(ctx context.Context, project string, services []config.Service) error { diff --git a/pkg/deployment/volume.go b/pkg/deployment/volume.go index 43fb53b..37a76d8 100644 --- a/pkg/deployment/volume.go +++ b/pkg/deployment/volume.go @@ -34,4 +34,4 @@ func (d *Deployment) createVolume(ctx context.Context, project, volume string) e } return nil -} \ No newline at end of file +} diff --git a/pkg/tunnel/tunnel.go b/pkg/tunnel/tunnel.go index dd31f85..a82cb9d 100644 --- a/pkg/tunnel/tunnel.go +++ b/pkg/tunnel/tunnel.go @@ -3,10 +3,11 @@ package tunnel import ( "context" "fmt" - "github.com/yarlson/ftl/pkg/config" "sync" "time" + "github.com/yarlson/ftl/pkg/config" + "github.com/yarlson/ftl/pkg/ssh" )