Skip to content

Add func workload design proposal#4923

Open
liliankasem wants to merge 6 commits intodocsfrom
liliankasem/docs/workload-spec
Open

Add func workload design proposal#4923
liliankasem wants to merge 6 commits intodocsfrom
liliankasem/docs/workload-spec

Conversation

@liliankasem
Copy link
Copy Markdown
Member

@liliankasem liliankasem commented May 1, 2026

Proposed spec for the v5 workload extension model. Lives under proposed/ so it can be iterated on without affecting vnext.

Highlights

  • DI extension model. Workloads register services (e.g. IProjectInitializer, ITemplateProvider, IPackProvider) into a hosted DI container. Built-in commands consume those services via IEnumerable<T>. No per-workload manifest file: workloads are pure NuGet packages with [assembly: ExportCliWorkload<T>].
  • Single global manifest at ~/.azure-functions/workloads.json records what's installed; the loader is a single JSON read + N assembly loads, no filesystem walking.
  • $schema URL identifies the manifest format (https://aka.ms/func-workloads/v1/schema.json). Editors and validators consume it directly; breaking changes ship under a new versioned URL.
  • packageType: FuncCliWorkload is the discriminator on NuGet, mirroring how dotnet finds tools (packageType=dotnettool).
  • func new (no args) lists templates from every installed workload that targets the active stack (resolved via local.settings.json or .func/config.json).
  • --stack replaces --worker-runtime as the user-facing language selector.

Updates from earlier rounds

  • Removed per-workload manifest file (DI replaces it).
  • Switched manifest version field from schemaVersion: <int> to $schema: <url>.
  • Documented packageType filter convention.
  • Renamed --worker-runtime to --stack throughout.
  • Clarified func new template scoping by active stack.

Base branch

Targets docs so the proposal can be iterated on independently of code branches. Once accepted, content moves into the main spec under docs/.

Use a versioned JSON Schema URL ('https://aka.ms/func-workloads/v1/schema.json')
instead of an opaque integer. Matches tsconfig.json / azure-pipelines.yml /
dotnet/global.json convention so editors and validators can consume the
schema directly, and breaking changes ship under a new URL path.
@liliankasem liliankasem force-pushed the liliankasem/docs/workload-spec branch from e587b80 to 28f3452 Compare May 2, 2026 00:27
@liliankasem liliankasem changed the title Add workload spec proposal Workload spec proposal May 2, 2026
Comment thread proposed/workload-spec.md Outdated
Comment thread proposed/workload-spec.md Outdated
Comment thread proposed/workload-spec.md Outdated

| Command | Behavior |
|----------------------------------------|-------------------------------------------------------------------|
| `func workload list` | List installed workloads with id, version, capabilities, install path. |
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.

A command to check if a specific workload (with optional version) is installed would be useful for desired-state scripts.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do we want this to be a new command, or can we just make this a property of list?

Option A: New dedicated subcommand

func workload check <id> [--version <v>]

Exit 0 if the workload (and optional version) is installed; non-zero otherwise. Prints nothing by default; --verbose prints resolved version.

Option B: Flag on list

func workload list <id> [--version <v>] --exists # exit code only

Comment thread proposed/workload-spec.md

- If no workload is installed for the requested runtime, the Func CLI **must**
print an actionable hint with the exact command to install one (e.g.
`func workload install python`) and exit with a clear error.
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.

How is the CLI going to know what workload the user is missing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's a good question - I am not sure that this is going to be possible for every command, but I think we can do some basic project detection to say "looks like this might be a python function app, install the python workload". I just want us to be able to provide clear signposting for the basic commands to help onboard folks to the new cli

Copy link
Copy Markdown
Member Author

@liliankasem liliankasem May 5, 2026

Choose a reason for hiding this comment

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

We can use:

  • An explicit --stack flag, if provided.
  • FUNCTIONS_WORKER_RUNTIME from local.settings.json, if present.
  • Lightweight project-marker detection (e.g. presence of *.csproj, requirements.txt, package.json) to make a best-effort guess.

I am not sure about other workloads, but I at least want to ensure the base important ones are signposted.

Another idea I have here is that we can have some list or legacy map of previous commands from v4 that are now workloads, so if someone tries to run func azure or func kubernetes we should say "this is now a workload, please install _"

Comment thread proposed/workload-spec.md Outdated
Comment thread proposed/workload-spec.md Outdated
- `version` → semver, the workload version.
- `title` → display name shown in `func workload list`.
- `description` → one-line summary shown in `func workload list`.
- `tags` → space-separated short aliases (e.g. `dotnet csharp`)
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.

We need a spec of the exact tags we will use for determining the alias, we can't use all the tags. Would it be a tag like alias:python?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call out, we should document all planned tags here. For alias, I think alias:python makes sense. But I recall we discussed having a func-workload tag as well for easier discoverability of workloads in search

Comment thread proposed/workload-spec.md
Comment thread proposed/workload-spec.md Outdated
Comment thread proposed/workload-spec.md
Comment thread proposed/workload-spec.md Outdated
Comment thread proposed/workload-spec.md Outdated
@jviau
Copy link
Copy Markdown
Contributor

jviau commented May 5, 2026

As I review more and more error handling, I think we need a spec for a diagnostics/verbose mode. Where we will collect errors/traces into a shareable log file users can attach to github issues.

liliankasem and others added 2 commits May 5, 2026 09:12
Co-authored-by: Jacob Viau <javia@microsoft.com>
@liliankasem
Copy link
Copy Markdown
Member Author

As I review more and more error handling, I think we need a spec for a diagnostics/verbose mode. Where we will collect errors/traces into a shareable log file users can attach to github issues.

Agree - would you be interested in throwing a quick spec for that together?

Comment thread proposed/workload-spec.md
@liliankasem liliankasem changed the title Workload spec proposal Add func workload design proposal May 6, 2026
@fabiocav fabiocav mentioned this pull request May 6, 2026
7 tasks
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