Files
LocalAI/pkg/addons/packaging/run.go
T
mudler-agentandEttore Di Giacinto b8f5453cc1 ci(addons): publish every add-on to one repository (#12881)
All add-ons now publish to ADDON_OCI_REPOSITORY as tags of one
repository. Each tag starts with the add-on id: <id>-sha-<short sha> for
a commit, <id>-<version> for a release, <id>-development and
<id>-latest for the channel aliases.

The publish step, the alias promotion and the catalog renderer add the
prefix, so the per-add-on repository step of the workflow is gone. A new
addonpkg target command prints the reference an add-on publishes to
without a network request. The workflow policy now refuses a derived
repository.

The host parser already reads a tag reference and a repository with a
nested path, so both the new form and the old per-repository form
install. A test covers each.

The artifact fields in gallery/addons/index.yaml were changed by hand to
the tag form. The digests are unchanged and stay until the add-ons are
published again.


Assisted-by: Claude:claude-sonnet-5-5 [Claude Code]

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
2026-10-24 18:26:40 +02:00

49 lines
1.3 KiB
Go

// SPDX-License-Identifier: MIT
// Package packaging builds, checks, merges and publishes first-party add-on
// OCI packages. It is the code behind scripts/addons/package.sh,
// scripts/addons/channel.sh and the add-on package workflow, so the rules
// that workflow relies on are code that a test can run.
//
// Every operation fails closed: a missing input is an error, never a default.
package packaging
import (
"fmt"
"io"
"os"
)
// stdout receives the key=value result lines of the subcommands.
var stdout io.Writer = os.Stdout
var commands = map[string]func(args []string) error{
"matrix": cmdMatrix,
"channel": cmdChannel,
"build": cmdBuild,
"verify": cmdVerify,
"extract": cmdExtract,
"native-check": cmdNativeCheck,
"merge": cmdMerge,
"publish": cmdPublish,
"promote": cmdPromote,
"target": cmdTarget,
"catalog": cmdCatalog,
"policy": cmdPolicy,
}
// Run executes one subcommand of the addonpkg command line.
func Run(args []string, out io.Writer) error {
if len(args) == 0 {
return fmt.Errorf("usage: addonpkg <subcommand> [flags]")
}
cmd, ok := commands[args[0]]
if !ok {
return fmt.Errorf("unknown subcommand %q", args[0])
}
previous := stdout
stdout = out
defer func() { stdout = previous }()
return cmd(args[1:])
}