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 11, 2024
1 parent d501281 commit dd109aa
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -1843,8 +1843,22 @@ 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)
tcluster.RunCmdSyncf(m, "sudo rpm-ostree rebase --experimental %s", rebase_arg)
m.Reboot()
}
}
Expand Down

0 comments on commit dd109aa

Please sign in to comment.