bib/internal/setup: validate container tags early
Check that the container has the expected bootc tags early and fail if they are missing.
This commit is contained in:
parent
4fa4ad34a0
commit
2a89cb6739
2 changed files with 25 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
|
|
@ -148,3 +149,17 @@ func validateCanRunTargetArch(targetArch string) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateHasContainerTags(imgref string) error {
|
||||
output, err := exec.Command("podman", "image", "inspect", imgref, "--format", "{{.Labels}}").Output()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed inspect image: %w", util.OutputErr(err))
|
||||
}
|
||||
|
||||
tags := string(output)
|
||||
if !strings.Contains(tags, "containers.bootc:1") {
|
||||
return fmt.Errorf("image %s is not a bootc image", imgref)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue