1
0

feat: prebuilt containers

This commit is contained in:
dump_stack() 2024-02-21 14:55:04 +00:00
parent 8a4ce9909b
commit d733cde2ae
Signed by: dump_stack
GPG Key ID: C9905BA72B5E02BB
2 changed files with 27 additions and 12 deletions

View File

@ -132,7 +132,7 @@ jobs:
echo 'Type=oneshot' >> test.service echo 'Type=oneshot' >> test.service
echo 'WorkingDirectory=/root/test' >> test.service echo 'WorkingDirectory=/root/test' >> test.service
echo 'TimeoutStopSec=1' >> test.service echo 'TimeoutStopSec=1' >> test.service
echo 'ExecStart=/usr/local/bin/out-of-tree kernel autogen --threads=4 --max=256 --shuffle' >> test.service echo 'ExecStart=/usr/local/bin/out-of-tree kernel --no-container-cache autogen --threads=4 --max=256 --shuffle' >> test.service
echo 'ExecStart=/usr/local/bin/out-of-tree pew --qemu-timeout=10m --threads=4 --include-internal-errors' >> test.service echo 'ExecStart=/usr/local/bin/out-of-tree pew --qemu-timeout=10m --threads=4 --include-internal-errors' >> test.service
scp test.service root@$IP:/etc/systemd/system/test.service scp test.service root@$IP:/etc/systemd/system/test.service

View File

@ -16,6 +16,7 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"code.dumpstack.io/tools/out-of-tree/artifact" "code.dumpstack.io/tools/out-of-tree/artifact"
"code.dumpstack.io/tools/out-of-tree/cache"
"code.dumpstack.io/tools/out-of-tree/config" "code.dumpstack.io/tools/out-of-tree/config"
"code.dumpstack.io/tools/out-of-tree/config/dotfiles" "code.dumpstack.io/tools/out-of-tree/config/dotfiles"
"code.dumpstack.io/tools/out-of-tree/container" "code.dumpstack.io/tools/out-of-tree/container"
@ -32,6 +33,7 @@ type KernelCmd struct {
Retries int `help:"amount of tries for each kernel" default:"2"` Retries int `help:"amount of tries for each kernel" default:"2"`
Threads int `help:"threads for parallel installation" default:"1"` Threads int `help:"threads for parallel installation" default:"1"`
Update bool `help:"update container"` Update bool `help:"update container"`
ContainerCache bool `help:"try prebuilt container images first" default:"true" negatable:""`
Max int `help:"maximum kernels to download" default:"100500"` Max int `help:"maximum kernels to download" default:"100500"`
NoPrune bool `help:"do not remove dangling or unused images from local storage after build"` NoPrune bool `help:"do not remove dangling or unused images from local storage after build"`
NoCfgRegen bool `help:"do not update kernels.toml"` NoCfgRegen bool `help:"do not update kernels.toml"`
@ -199,6 +201,19 @@ func (cmd *KernelCmd) Generate(g *Globals, km artifact.Target) (err error) {
return return
} }
c, err := container.New(km.Distro)
if err != nil || cmd.shutdown {
return
}
if cmd.ContainerCache {
path := cache.ContainerURL(c.Name())
err = container.Import(path, c.Name())
if err != nil || cmd.shutdown {
return
}
}
pkgs, err := kernel.MatchPackages(km) pkgs, err := kernel.MatchPackages(km)
if err != nil || cmd.shutdown { if err != nil || cmd.shutdown {
return return