Skip to content

Commit

Permalink
kola: Change --oscontainer to use new ostree native containers
Browse files Browse the repository at this point in the history
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:
coreos#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.
  • Loading branch information
cgwalters committed Jul 21, 2022
1 parent 710fabf commit 814c442
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
4 changes: 0 additions & 4 deletions mantle/cmd/kola/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,6 @@ func syncOptionsImpl(useCosa bool) error {
})
}

if kola.Options.OSContainer != "" && kola.Options.Distribution != "rhcos" {
return fmt.Errorf("oscontainer is only supported on rhcos")
}

if kola.Options.Distribution == "" {
kola.Options.Distribution = kolaDistros[0]
} else if kola.Options.Distribution == "scos" {
Expand Down
23 changes: 10 additions & 13 deletions mantle/platform/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,25 +221,22 @@ enabled = false`, 0644)
}

if bc.bf.baseopts.OSContainer != "" {
if bc.Distribution() != "rhcos" {
return nil, fmt.Errorf("oscontainer is only supported on the rhcos distribution")
}
conf.AddSystemdUnitDropin("pivot.service", "00-before-sshd.conf", `[Unit]
Before=sshd.service`)
conf.AddSystemdUnit("pivot.service", "", platformConf.Enable)
conf.AddSystemdUnit("pivot-write-reboot-needed.service", `[Unit]
Description=Touch /run/pivot/reboot-needed
ConditionFirstBoot=true
conf.AddSystemdUnit("kola-container-rebase.service", fmt.Sprintf(`[Unit]
Description=Rebase to target container
ConditionPathExists=!/etc/kola-rebase-done
Before=sshd.service
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/bin/mkdir -p /run/pivot
ExecStart=/usr/bin/touch /run/pivot/reboot-needed
ExecStart=rpm-ostree rebase --experimental %s
ExecStart=touch /etc/kola-rebase-done
ExecStart=systemctl reboot
[Install]
WantedBy=multi-user.target
`, platformConf.Enable)
conf.AddFile("/etc/pivot/image-pullspec", bc.bf.baseopts.OSContainer, 0644)
`, bc.bf.baseopts.OSContainer), platformConf.Enable)
}

if conf.IsIgnition() {
Expand Down

0 comments on commit 814c442

Please sign in to comment.