1
0
Fork 0

feat: prebuilt containers

timestamps
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"
@ -24,17 +25,18 @@ import (
) )
type KernelCmd struct { type KernelCmd struct {
NoDownload bool `help:"do not download qemu image while kernel generation"` NoDownload bool `help:"do not download qemu image while kernel generation"`
UseHost bool `help:"also use host kernels"` UseHost bool `help:"also use host kernels"`
Force bool `help:"force reinstall kernel"` Force bool `help:"force reinstall kernel"`
NoHeaders bool `help:"do not install kernel headers"` NoHeaders bool `help:"do not install kernel headers"`
Shuffle bool `help:"randomize kernels installation order"` Shuffle bool `help:"randomize kernels installation order"`
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"`
Max int `help:"maximum kernels to download" default:"100500"` ContainerCache bool `help:"try prebuilt container images first" default:"true" negatable:""`
NoPrune bool `help:"do not remove dangling or unused images from local storage after build"` Max int `help:"maximum kernels to download" default:"100500"`
NoCfgRegen bool `help:"do not update kernels.toml"` NoPrune bool `help:"do not remove dangling or unused images from local storage after build"`
NoCfgRegen bool `help:"do not update kernels.toml"`
ContainerTimeout time.Duration `help:"container timeout"` ContainerTimeout time.Duration `help:"container timeout"`
@ -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