Skip to content

Commit 3d66487

Browse files
committed
kola: teach upgrades about oci-archive
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
1 parent a86c488 commit 3d66487

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

mantle/kola/tests/upgrade/basic.go

+21-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ import (
3535
mantleUtil "github.com/coreos/mantle/util"
3636
)
3737

38-
const ostreeRepo = "/srv/ostree"
38+
const workdir = "/var/srv/upgrade"
39+
const ostreeRepo = workdir + "/repo"
3940
const zincatiMetricsSocket = "/run/zincati/public/metrics.promsock"
4041

4142
var plog = capnslog.NewPackageLogger("github.com/coreos/mantle", "kola/tests/upgrade")
@@ -114,15 +115,15 @@ func init() {
114115
],
115116
"directories": [
116117
{
117-
"path": "OSTREE_REPO",
118+
"path": "WORKDIR",
118119
"mode": 493,
119120
"user": {
120121
"name": "core"
121122
}
122123
}
123124
]
124125
}
125-
}`, "OSTREE_REPO", ostreeRepo, -1)),
126+
}`, "WORKDIR", workdir, -1)),
126127
})
127128
}
128129

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

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

145-
// XXX: Note the '&& sync' here; this is to work around sysroot
148+
// See https://github.com/coreos/fedora-coreos-tracker/issues/812
149+
if strings.HasSuffix(ostreeblob, ".ociarchive") {
150+
tmprepo := workdir + "/repo-bare"
151+
// TODO: https://github.com/ostreedev/ostree-rs-ext/issues/34
152+
c.RunCmdSyncf(m, "ostree --repo=%s init --mode=bare-user", tmprepo)
153+
c.RunCmdSyncf(m, "rpm-ostree ex-container import --repo=%s --write-ref %s oci-archive:%s", tmprepo, ostreeref, ostreeblob)
154+
c.RunCmdSyncf(m, "ostree --repo=%s init --mode=archive", ostreeRepo)
155+
c.RunCmdSyncf(m, "ostree --repo=%s pull-local %s %s", ostreeRepo, tmprepo, ostreeref)
156+
} else {
157+
c.RunCmdSyncf(m, "mkdir -p %s && tar -xf %s -C %s", ostreeRepo, ostreeblob, ostreeRepo)
158+
}
159+
160+
// XXX: This is to work around sysroot
146161
// remounting in libostree forcing a cache flush and blocking D-Bus.
147162
// Should drop this once we fix it more properly in {rpm-,}ostree.
148163
// https://github.com/coreos/coreos-assembler/issues/1301
149-
c.RunCmdSyncf(m, "tar -xf %s -C %s && sync", kola.CosaBuild.Meta.BuildArtifacts.Ostree.Path, ostreeRepo)
164+
c.RunCmdSync(m, "time sudo sync")
150165

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

0 commit comments

Comments
 (0)