Allow to force bump docker container
This commit is contained in:
parent
f85c37fea6
commit
7707f75a02
43
kernel.go
43
kernel.go
@ -389,7 +389,7 @@ func hasKernel(ki config.KernelInfo, kcfg config.KernelConfig) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func kernelAutogenHandler(kcfg config.KernelConfig, workPath string) (err error) {
|
func kernelAutogenHandler(workPath string) (err error) {
|
||||||
ka, err := config.ReadArtifactConfig(workPath + "/.out-of-tree.toml")
|
ka, err := config.ReadArtifactConfig(workPath + "/.out-of-tree.toml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -433,3 +433,44 @@ func kernelAutogenHandler(kcfg config.KernelConfig, workPath string) (err error)
|
|||||||
err = updateKernelsCfg()
|
err = updateKernelsCfg()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func kernelDockerRegenHandler() (err error) {
|
||||||
|
dockerImages, err := listDockerImages()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, d := range dockerImages {
|
||||||
|
var imagePath string
|
||||||
|
imagePath, err = dockerImagePath(config.KernelMask{
|
||||||
|
DistroType: d.DistroType,
|
||||||
|
DistroRelease: d.DistroRelease,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd := exec.Command("docker", "build", "-t",
|
||||||
|
d.ContainerName, imagePath)
|
||||||
|
var rawOutput []byte
|
||||||
|
rawOutput, err = cmd.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("docker build:", string(rawOutput))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = kickImage(d.ContainerName)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("kick image", d.ContainerName, ":", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
err = copyKernels(d.ContainerName)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("copy kernels", d.ContainerName, ":", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return updateKernelsCfg()
|
||||||
|
}
|
||||||
|
6
main.go
6
main.go
@ -59,6 +59,8 @@ func main() {
|
|||||||
kernelListCommand := kernelCommand.Command("list", "List kernels")
|
kernelListCommand := kernelCommand.Command("list", "List kernels")
|
||||||
kernelAutogenCommand := kernelCommand.Command("autogen",
|
kernelAutogenCommand := kernelCommand.Command("autogen",
|
||||||
"Generate kernels based on a current config")
|
"Generate kernels based on a current config")
|
||||||
|
kernelDockerRegenCommand := kernelCommand.Command("docker-regen",
|
||||||
|
"Regenerate kernels config from out_of_tree_* docker images")
|
||||||
|
|
||||||
genCommand := app.Command("gen", "Generate .out-of-tree.toml skeleton")
|
genCommand := app.Command("gen", "Generate .out-of-tree.toml skeleton")
|
||||||
genModuleCommand := genCommand.Command("module",
|
genModuleCommand := genCommand.Command("module",
|
||||||
@ -94,7 +96,9 @@ func main() {
|
|||||||
case kernelListCommand.FullCommand():
|
case kernelListCommand.FullCommand():
|
||||||
err = kernelListHandler(kcfg)
|
err = kernelListHandler(kcfg)
|
||||||
case kernelAutogenCommand.FullCommand():
|
case kernelAutogenCommand.FullCommand():
|
||||||
err = kernelAutogenHandler(kcfg, *path)
|
err = kernelAutogenHandler(*path)
|
||||||
|
case kernelDockerRegenCommand.FullCommand():
|
||||||
|
err = kernelDockerRegenHandler()
|
||||||
case genModuleCommand.FullCommand():
|
case genModuleCommand.FullCommand():
|
||||||
err = genConfig(config.KernelModule)
|
err = genConfig(config.KernelModule)
|
||||||
case genExploitCommand.FullCommand():
|
case genExploitCommand.FullCommand():
|
||||||
|
Loading…
Reference in New Issue
Block a user