Skip to content

Commit ab2f64f

Browse files
committed
kola: Change --oscontainer to use new ostree native containers
Quite a while ago we added this special case code to kola which learned how to do in-place updates to the weird bespoke "ostree repo in container" OCP/RHCOS-specific container image. A huge benefit of the change to use ostree-native containers is that this approach can now be shared across FCOS/RHCOS. (Also, rpm-ostree natively understands this, so it's much much more efficient and less awkward than the wrappers we had in `pivot` around rpm-ostree) But the benefits get even larger: this issue: #2685 proposes rethinking of our pipeline to more cleanly split up "build OS update container" from "build disk images". With this, it becomes extra convenient to do a flow of: - build OS update container, push to registry - `kola run -p stable --oscontainer quay.io/fcos-devel/testos@sha256...` IOW we're not generating a disk image to test the OS update - we're using the *stable* disk image and doing an in-place update before we run tests. Now...as of right now nothing in the pipeline passes this flag, so the code won't be used (except for manual testing). Suddenly with this, the number of tests we can run roughly *doubles*. For example, we can run e.g. `kola run rpm-ostree` both with and without `--oscontainer`. In most cases, things should be the same. But, I think it will be interesting to try to explictly use this for at least some tests; it's almost a full generalization of the `kola run-upgrades` bits.
1 parent 70368b2 commit ab2f64f

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

mantle/cmd/kola/options.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,6 @@ func syncOptionsImpl(useCosa bool) error {
289289
})
290290
}
291291

292-
if kola.Options.OSContainer != "" && kola.Options.Distribution != "rhcos" {
293-
return fmt.Errorf("oscontainer is only supported on rhcos")
294-
}
295-
296292
if kola.Options.Distribution == "" {
297293
kola.Options.Distribution = kolaDistros[0]
298294
} else if kola.Options.Distribution == "scos" {

mantle/platform/cluster.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -221,25 +221,22 @@ enabled = false`, 0644)
221221
}
222222

223223
if bc.bf.baseopts.OSContainer != "" {
224-
if bc.Distribution() != "rhcos" {
225-
return nil, fmt.Errorf("oscontainer is only supported on the rhcos distribution")
226-
}
227-
conf.AddSystemdUnitDropin("pivot.service", "00-before-sshd.conf", `[Unit]
228-
Before=sshd.service`)
229-
conf.AddSystemdUnit("pivot.service", "", platformConf.Enable)
230-
conf.AddSystemdUnit("pivot-write-reboot-needed.service", `[Unit]
231-
Description=Touch /run/pivot/reboot-needed
232-
ConditionFirstBoot=true
224+
conf.AddSystemdUnit("kola-container-rebase.service", fmt.Sprintf(`[Unit]
225+
Description=Rebase to target container
226+
ConditionPathExists=!/etc/kola-rebase-done
227+
Before=sshd.service
228+
Wants=network-online.target
229+
After=network-online.target
233230
234231
[Service]
235232
Type=oneshot
236-
ExecStart=/usr/bin/mkdir -p /run/pivot
237-
ExecStart=/usr/bin/touch /run/pivot/reboot-needed
233+
ExecStart=rpm-ostree rebase --experimental %s
234+
ExecStart=touch /etc/kola-rebase-done
235+
ExecStart=systemctl reboot
238236
239237
[Install]
240238
WantedBy=multi-user.target
241-
`, platformConf.Enable)
242-
conf.AddFile("/etc/pivot/image-pullspec", bc.bf.baseopts.OSContainer, 0644)
239+
`, bc.bf.baseopts.OSContainer), platformConf.Enable)
243240
}
244241

245242
if conf.IsIgnition() {

0 commit comments

Comments
 (0)