1
0

Allow to force bump docker container

This commit is contained in:
dump_stack() 2018-12-01 15:11:43 +00:00
parent f85c37fea6
commit 7707f75a02
2 changed files with 47 additions and 2 deletions

View File

@ -389,7 +389,7 @@ func hasKernel(ki config.KernelInfo, kcfg config.KernelConfig) bool {
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")
if err != nil {
return
@ -433,3 +433,44 @@ func kernelAutogenHandler(kcfg config.KernelConfig, workPath string) (err error)
err = updateKernelsCfg()
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()
}

View File

@ -59,6 +59,8 @@ func main() {
kernelListCommand := kernelCommand.Command("list", "List kernels")
kernelAutogenCommand := kernelCommand.Command("autogen",
"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")
genModuleCommand := genCommand.Command("module",
@ -94,7 +96,9 @@ func main() {
case kernelListCommand.FullCommand():
err = kernelListHandler(kcfg)
case kernelAutogenCommand.FullCommand():
err = kernelAutogenHandler(kcfg, *path)
err = kernelAutogenHandler(*path)
case kernelDockerRegenCommand.FullCommand():
err = kernelDockerRegenHandler()
case genModuleCommand.FullCommand():
err = genConfig(config.KernelModule)
case genExploitCommand.FullCommand():