Move ignition functions into Containerfiles

We used to use ignition to perform any customization required for podman
machine because our input was a generic FCOS image.  Now that we are
building our own images, some of this customization can be migrated to
the Containerfile itself and be less of a burden in our code at boot up.

At the time of this PR, the Containerfile can be found at
https://github.com/baude/podman-machine-images/tree/main.  It is only
present for a so-called daily image.  There is little liklihood that
this would the final location for the Containerfile so consider it a
working version only.

Split WSL and rest apart in the e2e tests so we no longer ppull the
generic FCOS image for testing.

Note: the change to the pull image name is so PRs are not immediately
broken that are already in the queue.

[NO NEW TESTS REQUIRED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2024-02-16 09:47:12 -06:00
committed by Brent Baude
parent 031e7a15b0
commit fd1d951262
9 changed files with 226 additions and 303 deletions

View File

@ -0,0 +1,43 @@
package e2e_test
import (
"context"
"fmt"
"path/filepath"
"runtime"
"strings"
"github.com/containers/podman/v5/pkg/machine/compression"
"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/podman/v5/pkg/machine/ocipull"
)
func pullOCITestDisk(finalDir string, vmType define.VMType) error {
imageCacheDir, err := define.NewMachineFile(finalDir, nil)
if err != nil {
return err
}
unusedFinalPath, err := imageCacheDir.AppendToNewVMFile(fmt.Sprintf("machinetest-%s", runtime.GOOS), nil)
if err != nil {
return err
}
dirs := define.MachineDirs{ImageCacheDir: imageCacheDir}
ociArtPull, err := ocipull.NewOCIArtifactPull(context.Background(), &dirs, "e2emachine", vmType, unusedFinalPath)
if err != nil {
return err
}
err = ociArtPull.GetNoCompress()
if err != nil {
return err
}
fp, originalName := ociArtPull.OriginalFileName()
// Rename the download to something we recognize
compressionExt := filepath.Ext(fp)
fqImageName = filepath.Join(tmpDir, strings.TrimSuffix(originalName, compressionExt))
suiteImageName = filepath.Base(fqImageName)
compressedImage, err := define.NewMachineFile(fp, nil)
if err != nil {
return err
}
return compression.Decompress(compressedImage, fqImageName)
}