Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/platform/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ func newRunLogger(clients *shared.ClientFactory, cmd *cobra.Command) *logger.Log
cmd.Println(style.Secondary(fmt.Sprintf("Manifest change detected: %s, reinstalling app...", path)))
case "on_cloud_run_watch_manifest_change_reinstalled":
cmd.Println(style.Secondary("App successfully reinstalled"))
case "on_cloud_run_watch_manifest_change_skipped_remote":
path := event.DataToString("cloud_run_watch_manifest_change_skipped")
cmd.Println(style.Secondary(fmt.Sprintf("Manifest change detected: %s, skipped reinstalling app because manifest.source=remote", path)))
case "on_cloud_run_watch_app_change":
path := event.DataToString("cloud_run_watch_app_change")
cmd.Println(style.Secondary(fmt.Sprintf("App change detected: %s, restarting server...", path)))
Expand Down
37 changes: 19 additions & 18 deletions internal/pkg/platform/localserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,10 @@ func (r *LocalServer) WatchManifest(ctx context.Context, auth types.SlackAuth, a
return err
}

// Skip manifest watching if manifest source is remote
if manifestSource.Equals(config.ManifestSourceRemote) {
r.clients.IO.PrintDebug(ctx, "Manifest watching disabled: manifest.source is set to remote")
// Block until context is cancelled to keep the goroutine alive
<-ctx.Done()
return nil
// Check if manifest source is remote - we'll still watch but only log changes
isRemoteManifest := manifestSource.Equals(config.ManifestSourceRemote)
if isRemoteManifest {
r.clients.IO.PrintDebug(ctx, "Manifest source is remote - file changes will be logged only")
}

// Get manifest watch configuration
Expand All @@ -396,8 +394,7 @@ func (r *LocalServer) WatchManifest(ctx context.Context, auth types.SlackAuth, a
// Add provided paths to watcher
for _, path := range paths {
if err := w.AddRecursive(path); err != nil {
r.log.Data["cloud_run_watch_error"] = fmt.Sprintf("manifest_watcher.paths: %s", err)
r.log.Warn("on_cloud_run_watch_error")
r.clients.IO.PrintDebug(ctx, "Skipping watch path %s: %s", path, err)
}
}

Expand All @@ -409,15 +406,20 @@ func (r *LocalServer) WatchManifest(ctx context.Context, auth types.SlackAuth, a
r.clients.IO.PrintDebug(ctx, "Manifest file watcher context canceled, returning.")
return
case event := <-w.Event:
r.log.Data["cloud_run_watch_manifest_change"] = event.Path
r.log.Info("on_cloud_run_watch_manifest_change")

// Reinstall the app when manifest changes
if _, _, _, err := apps.InstallLocalApp(ctx, r.clients, "", r.log, auth, app); err != nil {
r.log.Data["cloud_run_watch_error"] = err.Error()
r.log.Warn("on_cloud_run_watch_error")
if isRemoteManifest {
r.log.Data["cloud_run_watch_manifest_change_skipped"] = event.Path
r.log.Info("on_cloud_run_watch_manifest_change_skipped_remote")
} else {
r.log.Info("on_cloud_run_watch_manifest_change_reinstalled")
r.log.Data["cloud_run_watch_manifest_change"] = event.Path
r.log.Info("on_cloud_run_watch_manifest_change")

// Reinstall the app when manifest changes
if _, _, _, err := apps.InstallLocalApp(ctx, r.clients, "", r.log, auth, app); err != nil {
r.log.Data["cloud_run_watch_error"] = err.Error()
r.log.Warn("on_cloud_run_watch_error")
} else {
r.log.Info("on_cloud_run_watch_manifest_change_reinstalled")
}
}
case err := <-w.Error:
r.log.Data["cloud_run_watch_error"] = err.Error()
Expand Down Expand Up @@ -474,8 +476,7 @@ func (r *LocalServer) WatchApp(ctx context.Context) error {
// Add provided paths to watcher
for _, path := range paths {
if err := w.AddRecursive(path); err != nil {
r.log.Data["cloud_run_watch_error"] = fmt.Sprintf("app_watcher.paths: %s", err)
r.log.Warn("on_cloud_run_watch_error")
r.clients.IO.PrintDebug(ctx, "Skipping watch path %s: %s", path, err)
}
}

Expand Down
Loading