knative / func

Knative Functions client API and CLI
Apache License 2.0
264 stars 135 forks source link

Function Local Settings #1931

Open lkingland opened 11 months ago

lkingland commented 11 months ago

Summary

We need to move Function.Deploy.Remote onto a new "Local Settings" structure: Function.Local.BuildRemote which is stored in a separate config file .func/config.yaml (not on func.yaml).

Rationale

There exists certain data which is not part of a function's source-controlled state, but rather is metadata about the current working environment. The .func directory is explicitly set to be ignored in .gitignore, and is to be used for this locally-specific metadata. One such data is whether or not the user would like the function to be built locally or to trigger a remote build when deploying.

For example: User Alice creates a new Function and deploys this function directly from her PC. User Bob then checks out this function, makes some changes, deploys and commits the result. However, user Bob used --remote, triggering a remote build. This setting is remembered, so the next time Bob deploys, it will also be remote. However, hen user Alice updates her source code and deploys, it should not also now trigger a remote build. The default value of the remote flag is local only.

Furthermore, when Bob checks in his code, if it alters the value of the Remote setting, the CI/CD system (if configured) set up to rebuild the Function via notification via a git hook, will now also have its value of remote set, causing an infinite recursion.

Implementation

For settings such as this (remote is just the first), this .Local structure is a member of the Function. However it should be set to not be serialized as part of func.yaml, but instead be stored in .func/config.yaml. This will require being explicitly serialized and deserialized whenever func.yaml is loaded and written.

There should be a minimal test confirming the setting is persisted and read on .Write and instantiation.

vyasgun commented 11 months ago

/assign

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.