Skip to content

Commit

Permalink
kola: support passing local OCI archives to --oscontainer
Browse files Browse the repository at this point in the history
As part of openshift/os#799, we'll want to
be able to run tests against the layered image. We want to be able to
do that by pointing at the local file instead of having to push it to a
registry first (which in the pipeline usually happens at the end).
  • Loading branch information
jlebon committed Mar 14, 2024
1 parent b8f70e8 commit 7ae5dcd
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -1843,9 +1843,26 @@ func runTest(h *harness.H, t *register.Test, pltfrm string, flight platform.Flig
if CosaBuild == nil {
h.Fatalf("Requested oscontainer pivot, but no cosa build found")
}
rebase_arg := Options.OSContainer
// if it looks like a path to an OCI archive, then copy it into the system
if strings.HasSuffix(Options.OSContainer, ".ociarchive") {
if err := cluster.DropFile(tcluster.Machines(), Options.OSContainer); err != nil {
h.Fatalf("dropping oscontainer file: %v", err)
}
// put it someplace rpm-ostree can access it; ideally we'd generalize DropFile
// to take a destination path instead
remote_file := filepath.Base(Options.OSContainer)
for _, m := range tcluster.Machines() {
tcluster.RunCmdSyncf(m, "mv -Z /home/core/%s /var/tmp/", remote_file)
}
rebase_arg = fmt.Sprintf("ostree-unverified-image:oci-archive:/var/tmp/%s", remote_file)
}
for _, m := range tcluster.Machines() {
tcluster.RunCmdSyncf(m, "sudo rpm-ostree rebase --experimental %s", Options.OSContainer)
m.Reboot()
tcluster.RunCmdSyncf(m, "sudo rpm-ostree rebase --experimental %s", rebase_arg)
err = m.Reboot()
if err != nil {
h.Fatalf("failed to reboot machine: %v", err)
}
}
}

Expand Down

0 comments on commit 7ae5dcd

Please sign in to comment.