Skip to content

Commit

Permalink
kola: teach upgrades about oci-archive
Browse files Browse the repository at this point in the history
Part of coreos/fedora-coreos-tracker#812

The code here is unfortunately actually *more* complicated,
but that's due to an ostree/ostree-ext bug.

It was easier to use `sudo` for everything instead of doing the
  • Loading branch information
cgwalters committed Jul 21, 2021
1 parent a86c488 commit d3264f5
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions mantle/kola/tests/upgrade/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import (
mantleUtil "github.com/coreos/mantle/util"
)

const ostreeRepo = "/srv/ostree"
const workdir = "/var/srv/upgrade"
const ostreeRepo = workdir + "/repo"
const zincatiMetricsSocket = "/run/zincati/public/metrics.promsock"

var plog = capnslog.NewPackageLogger("github.com/coreos/mantle", "kola/tests/upgrade")
Expand Down Expand Up @@ -114,15 +115,15 @@ func init() {
],
"directories": [
{
"path": "OSTREE_REPO",
"path": "WORKDIR",
"mode": 493,
"user": {
"name": "core"
}
}
]
}
}`, "OSTREE_REPO", ostreeRepo, -1)),
}`, "WORKDIR", workdir, -1)),
})
}

Expand All @@ -133,20 +134,34 @@ func fcosUpgradeBasic(c cluster.TestCluster) {
graph := new(Graph)

c.Run("setup", func(c cluster.TestCluster) {
ostreeblob := kola.CosaBuild.Meta.BuildArtifacts.Ostree.Path
ostreeref := kola.CosaBuild.Meta.BuildRef
// this is the only heavy-weight part, though remember this test is
// optimized for qemu testing locally where this won't leave localhost at
// all. cloud testing should mostly be a pipeline thing, where the infra
// connection should be much faster
ostreeTarPath := filepath.Join(kola.CosaBuild.Dir, kola.CosaBuild.Meta.BuildArtifacts.Ostree.Path)
ostreeTarPath := filepath.Join(kola.CosaBuild.Dir, ostreeblob)
if err := cluster.DropFile(c.Machines(), ostreeTarPath); err != nil {
c.Fatal(err)
}

// XXX: Note the '&& sync' here; this is to work around sysroot
// See https://github.com/coreos/fedora-coreos-tracker/issues/812
if strings.HasSuffix(ostreeblob, ".ociarchive") {
tmprepo := workdir + "/repo-bare"
// TODO: https://github.com/ostreedev/ostree-rs-ext/issues/34
c.RunCmdSyncf(m, "ostree --repo=%s init --mode=bare-user", tmprepo)
c.RunCmdSyncf(m, "rpm-ostree ex-container import --repo=%s --write-ref %s oci-archive:%s", tmprepo, ostreeref, ostreeblob)
c.RunCmdSyncf(m, "ostree --repo=%s init --mode=archive", ostreeRepo)
c.RunCmdSyncf(m, "ostree --repo=%s pull-local %s %s", ostreeRepo, tmprepo, ostreeref)
} else {
c.RunCmdSyncf(m, "tar -xf %s -C %s", ostreeblob, ostreeRepo)
}

// XXX: This is to work around sysroot
// remounting in libostree forcing a cache flush and blocking D-Bus.
// Should drop this once we fix it more properly in {rpm-,}ostree.
// https://github.com/coreos/coreos-assembler/issues/1301
c.RunCmdSyncf(m, "tar -xf %s -C %s && sync", kola.CosaBuild.Meta.BuildArtifacts.Ostree.Path, ostreeRepo)
c.RunCmdSync(m, "time sudo sync")

// disable zincati; from now on, we'll start it manually whenenever we
// want to upgrade via Zincati
Expand Down

0 comments on commit d3264f5

Please sign in to comment.