Skip to content

Hot Reload feature for OCI Functions local development with Fn Server#714

Merged
marvin659 merged 2 commits intomasterfrom
marleung/hotreload
Apr 29, 2026
Merged

Hot Reload feature for OCI Functions local development with Fn Server#714
marvin659 merged 2 commits intomasterfrom
marleung/hotreload

Conversation

@marvin659
Copy link
Copy Markdown
Contributor

Hot Reload feature for OCI Functions local development with Fn Server

Comment thread common/common.go
}

fd, err := ioutil.TempFile(dir, "Dockerfile")
fd, err := ioutil.TempFile(dir, "Dockerfile-fn-tmp")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the temp file name to be more specific so that "fn watch" will ignore this file if it got changed by "fn deploy"

@marvin659 marvin659 force-pushed the marleung/hotreload branch from 48e0f83 to c14e622 Compare April 27, 2026 07:23
@marvin659 marvin659 force-pushed the marleung/local-debug-python branch from c817de3 to 0b4c1c6 Compare April 27, 2026 08:52
@marvin659 marvin659 force-pushed the marleung/hotreload branch 2 times, most recently from bf47f39 to c8f66bc Compare April 27, 2026 09:27
@marvin659 marvin659 changed the base branch from marleung/local-debug-python to master April 27, 2026 09:35
@marvin659 marvin659 force-pushed the marleung/hotreload branch 2 times, most recently from abf98cb to ac638c9 Compare April 27, 2026 13:43
@marvin659 marvin659 force-pushed the marleung/hotreload branch from ac638c9 to a94aa29 Compare April 27, 2026 14:04
Comment thread commands/watch.go Outdated
}

func runFnDeployLocal(ctx context.Context, dir string, appName string) error {
cmd := exec.CommandContext(ctx, "fn", "deploy", "--app", appName, "--local", "--no-bump")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this step depends on the fn binary available on PATH. It may not be same binary user used to start watch. Would it be safe to use os.Executable() so watch always use the same exact CLI instance that started it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread commands/watch.go
Value: defaultWatchDebounce,
Destination: &cmd.debounce,
},
cli.StringSliceFlag{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The help text says --ignore matches path segments it also gives --ignore '*.log' as an example, but the implementation only check
exact segment equality (s == p), or
filepath.Match

we could have some issue here for the nested log files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ fixed and added test case

Comment thread README.md Outdated
### Ignoring paths
`fn watch` ignores these directories by default:

- `.git`, `.fn`, `node_modules`, `target`, `dist`, `vendor`, `Dockerfile-fn-temp*`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be Dockerfile-fn-tmp*

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread README.md Outdated
This watches the current directory recursively and triggers:

```sh
fn deploy --app <app> --local
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also add --no-bump here?
fn deploy --app --local --no-bump

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marvin659 marvin659 requested a review from Jaytee-fn April 29, 2026 15:37
@marvin659 marvin659 merged commit dc43c81 into master Apr 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants