Skip to content

Commit

Permalink
feat(pkg): Recognize the --label flag when packaging a kernel
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Jung <alex@unikraft.io>
  • Loading branch information
nderjung committed Nov 21, 2024
1 parent c204c38 commit a80c007
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions internal/cli/kraft/pkg/packager_cli_kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ func (p *packagerCliKernel) Pack(ctx context.Context, opts *PkgOptions, args ...
opts.Env = append(opts.Env, envs...)
}

var labels map[string]string
if len(opts.Labels) > 0 {
for _, label := range opts.Labels {
kv := strings.SplitN(label, "=", 2)
if len(kv) != 2 {
return nil, fmt.Errorf("invalid label format: %s", label)
}

labels[kv[0]] = kv[1]

Check failure on line 87 in internal/cli/kraft/pkg/packager_cli_kernel.go

View workflow job for this annotation

GitHub Actions / go

SA5000: assignment to nil map (staticcheck)
}
}

var result []pack.Package
norender := log.LoggerTypeFromString(config.G[config.KraftKit](ctx).Log.Type) != log.FANCY

Expand All @@ -96,6 +108,7 @@ func (p *packagerCliKernel) Pack(ctx context.Context, opts *PkgOptions, args ...
packmanager.PackKConfig(!opts.NoKConfig),
packmanager.PackName(opts.Name),
packmanager.PackOutput(opts.Output),
packmanager.PackLabels(labels),
)

envs := opts.aggregateEnvs()
Expand Down

0 comments on commit a80c007

Please sign in to comment.