Skip to content

osbuild/util/ostree: optimize deployment_path()#1527

Closed
dustymabe wants to merge 4 commits intoosbuild:mainfrom
dustymabe:dusty-optimize-deployment-path
Closed

osbuild/util/ostree: optimize deployment_path()#1527
dustymabe wants to merge 4 commits intoosbuild:mainfrom
dustymabe:dusty-optimize-deployment-path

Conversation

@dustymabe
Copy link
Contributor

When provisioning disk images there should really not be more than
one deployment on a system. We don't really need any of the parameters
here so let's make them optional and just find the deployment anyway.

Co-authored-by: Luke Yang luyang@redhat.com

ravanelli and others added 4 commits January 3, 2024 14:49
Add the bootupd stage to install GRUB on both BIOS and UEFI systems,
ensuring that your bootloader stays up-to-date.

Signed-off-by: Renata Ravanelli <rravanel@redhat.com>
We'll need to update the CI image to be a newer one after the
next round of FCOS releases.
When provisioning disk images there should really not be more than
one deployment on a system. We don't really need any of the parameters
here so let's make them optional and just find the deployment anyway.

Co-authored-by: Luke Yang <luyang@redhat.com>
This is much more simplified if we can just autodetect and
do the right thing.
@dustymabe
Copy link
Contributor Author

This includes the two commits from #1519 so just review the last two commits here. I'll rebase once 1519 merges.

@achilleas-k
Copy link
Member

achilleas-k commented Jan 4, 2024

I think we should make the detection action explicit. Having automatic behaviour that fills in the blanks when an option is omitted is generally avoided as a design decision in osbuild. I expanded a bit on this here: #1475 (comment)

What this means practically is that whenever possible we assume that the tool that is generating the manifest has all the information about the sources it's going to use. So, as an example, osbuild-composer or osbuild-mpp resolve packages, find the version of the kernel that's going to be installed, and that is used as an option for bootloader configurations etc.

In this case, I understand the convenience of reading the tree to get the info from the source ostree commit/container that's already been deployed. But even in that case, I think the behaviour of the stage should be a set on the stage options. It makes it much easier to predict what a stage will do without needing to trace the pipeline before it and it puts the decision on the manifest generator to say "there is only one deployment and I know this wont fail".
Removing the options completely makes it impossible to run the bootupd stage in a situation where there are multiple deployments. I wont try to predict valid (or even invalid) situations where that might happen, but in my experience these are the kinds of decisions that end up coming around and making things "impossible" in new situations.

So all that said, my solution would be: keep the deployment options in the stage but also add an option that tells the stage to read/sniff the deployment from the tree. So the stage options for bootupd for example would be a oneOf of the following two objects:

"deployment": {
  "osname": ...,
  "ref": ...
  "serial": ... (default 0)
}

or

"detect-deployment": true (default false)

Pinging others for thoughts: @thozza @ondrejbudai @mvo5 @supakeen

@cgwalters
Copy link
Contributor

I'd call it default-deployment: true or so. There is actually work on using multiple stateroots ("osname") in OCP today; but not in disk images generated by default.

I think if there are multiple, we would operate on the default, not that we'd error out.

@thozza
Copy link
Member

thozza commented Jan 7, 2024

💯 to what @achilleas-k wrote, specifically that the we try to not make osbuild stages too smart and expect the tool that generates the osbuild manifest to make all choices explicit by specifying them in the osbuild stage options.

On top of what @achilleas-k wrote, I would mention a probably rare situation when the smartness of a stage may hide a subtle bug in the tool generating the manifest by producing a manifest which will successfully build the image, but with unexpected result.

@dustymabe
Copy link
Contributor Author

So the concensus is something like OneOf:

"deployment": {
  "osname": ...,
  "ref": ...
  "serial": ... (default 0)
}

or

"default-deployment": true (default false)

If we have agreement I can look into updating things here.

@achilleas-k
Copy link
Member

So the concensus is something like OneOf:

"deployment": {
  "osname": ...,
  "ref": ...
  "serial": ... (default 0)
}

or

"default-deployment": true (default false)

If we have agreement I can look into updating things here.

Yes. I think we can all agree on that.

@dustymabe
Copy link
Contributor Author

obsoleted by #1553

@dustymabe dustymabe closed this Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants