@@ -11,8 +11,11 @@ import (
1111 "github.com/localstack/lstk/internal/log"
1212)
1313
14- func ResolveAndCacheLabel (ctx context.Context , opts StartOptions , labelCh chan <- string ) {
15- label , ok := ResolveEmulatorLabel (ctx , opts .PlatformClient , opts .Containers , opts .AuthToken , opts .Logger )
14+ // ResolveAndCacheLabel resolves the plan label using the version returned by Start
15+ // and caches it for subsequent runs. resolvedVersion is the version extracted from
16+ // image inspection; it may be empty if Start returned early (e.g. already running).
17+ func ResolveAndCacheLabel (ctx context.Context , opts StartOptions , resolvedVersion string , labelCh chan <- string ) {
18+ label , ok := ResolveEmulatorLabel (ctx , opts .PlatformClient , opts .Containers , opts .AuthToken , resolvedVersion , opts .Logger )
1619 if ok {
1720 config .CachePlanLabel (label )
1821 }
@@ -25,7 +28,8 @@ const NoLicenseLabel = "LocalStack (No license)"
2528// to build a label like "LocalStack Ultimate". Falls back to
2629// NoLicenseLabel when the plan cannot be determined. The returned bool
2730// is true only when a real plan was resolved (i.e. the result is worth caching).
28- func ResolveEmulatorLabel (ctx context.Context , client api.PlatformAPI , containers []config.ContainerConfig , token string , logger log.Logger ) (string , bool ) {
31+ // resolvedVersion is the version from post-pull image inspection for "latest" containers.
32+ func ResolveEmulatorLabel (ctx context.Context , client api.PlatformAPI , containers []config.ContainerConfig , token , resolvedVersion string , logger log.Logger ) (string , bool ) {
2933 if len (containers ) == 0 || token == "" {
3034 return NoLicenseLabel , false
3135 }
@@ -42,14 +46,10 @@ func ResolveEmulatorLabel(ctx context.Context, client api.PlatformAPI, container
4246 if c .Type == config .EmulatorSnowflake {
4347 return "LocalStack" , false
4448 }
45- apiCtx , cancel := context .WithTimeout (ctx , 2 * time .Second )
46- v , err := client .GetLatestCatalogVersion (apiCtx , string (c .Type ))
47- cancel ()
48- if err != nil {
49- logger .Info ("could not resolve catalog version for header: %v" , err )
49+ if resolvedVersion == "" {
5050 return NoLicenseLabel , false
5151 }
52- tag = v
52+ tag = resolvedVersion
5353 }
5454
5555 hostname , _ := os .Hostname ()
0 commit comments