Skip to content

Add code-only function init and runtime discovery support#707

Open
Jaytee-fn wants to merge 2 commits intomasterfrom
PR1-init-runtime-discovery
Open

Add code-only function init and runtime discovery support#707
Jaytee-fn wants to merge 2 commits intomasterfrom
PR1-init-runtime-discovery

Conversation

@Jaytee-fn
Copy link
Copy Markdown
Contributor

This PR introduces the first slice of code-only function support in Fn CLI.

It adds:

  1. code-only 'fn init'
  2. func.yaml/schema support for code-only fields
  3. runtime discovery commands inside Fn CLI

This allows users to initialize code-only functions using the new schema/version and discover valid managed runtimes and runtime versions without leaving Fn CLI.

Included in this PR

Code-only init

  1. support for 'fn init --code-only'
  2. support for: --runtime-name and --runtime-config-type
  3. code-only func.yaml generation using: schema_version: 20260325
  4. generation of runtime-specific default handler values for code-only functions

Funcfile/schema support

  1. support for code-only func.yaml fields in the internal funcfile model
  2. schema support for: code_only, runtime_config and handler

Runtime discovery

  1. fn list runtimes
  2. fn list runtime-versions --runtime-name
  3. fn get latest-runtime-version --runtime-name

### Runtime-specific code-only init behaviour
For code-only init, runtime handling is explicit.

Python / Node

Python and Node use custom code-only boilerplate generators because the existing helpers produce file names and conventions tied to older image-based flows.

Java / Go

Java and Go also go through explicit code-only init branches, but delegate to the existing shared language helpers

This keeps the code-only init flow more uniform across supported runtimes while still reusing the existing language generators where appropriate.

### Validation

Code-only init
fn init --code-only --runtime-name python311.ol9 --runtime-config-type function-update
cat func.yaml

schema_version: 20260325
code_only: true
runtime_config:
type: function-update
runtime_name: python311.ol9
handler: hello_world.handler

Runtime discovery
fn list runtimes
fn list runtime-versions --runtime-name python311.ol9
fn get latest-runtime-version --runtime-name python311.ol9

This PR establishes the initialization and runtime discovery for code-only workflows. The PR intentionally leaves the existing legacy versioned internal type names (for example 'FuncFileV20180708' and 'RuntimeConfigV20180708') unchanged. Renaming these to version-agnostic names is planned as a follow-up cleanup PR.

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.

1 participant