Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track ZFSBootMenu versions in-image with /etc/os-release #521

Closed
wants to merge 6 commits into from

Conversation

ahesford
Copy link
Member

@ahesford ahesford commented Nov 8, 2023

I still need to test this and make sure build containers do the right thing, but here's the concept.

I'm open to suggestions on the template rendering.

@ahesford ahesford marked this pull request as draft November 8, 2023 17:32
@zdykstra
Copy link
Member

zdykstra commented Nov 8, 2023

Detecting if the Makefile is being run from a git checkout and replacing the version in generate-zbm (and subsequently in zbm-release) with a commit SHA would be nice to add in to this as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also add:

  • VERSION_ID
  • BUILD_ID (date of image build and maybe git hash if available?)
  • SUPPORT_URL and BUG_REPORT_URL?
  • ANSI_COLOR (maybe something based on the logo)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added BUILD_ID, SUPPORT_URL and BUG_REPORT_URL. I'm not sure VERSION_ID has any particular meaning, and I don't think we should encourage r/unixporn snapshots by adding ANSI_COLOR.

releng/tag-release.sh Outdated Show resolved Hide resolved
@ahesford ahesford force-pushed the the_lovely_bones branch 2 times, most recently from 8e2597b to b24c58e Compare November 10, 2023 17:13
@ahesford ahesford marked this pull request as ready for review November 20, 2023 17:35
@ahesford
Copy link
Member Author

I guess this mostly captures my vision for version handling in-repo. Comments welcome.

The alternative to committing +dev tags is to drop version handling from bin/generate-zbm and zfsbootmenu/zbm-release altogether, and just require that releng/version.sh write the proper version before the contents are meaningful (e.g., record some template placeholder like @@VERSION@@ in bin/generate-zbm and zfsbootmenu/zbm-release). However, that seems undesirable because:

  1. Attempting to use bin/generate-zbm or zfsbootmenu/zbm-release from a live repo will result in nonsense versioning, whereas comitting something like ${version}+dev ensures that the contents of the files is actually meaningful at all times.
  2. GitHub source archives would be useless, because we wouldn't have a way to read the version outside of a git repository. Instead, we'd have to do something like render some VERSION file (or the contents of bin/generate-zbm and zfsbootmenu/zbm-release) and produce a release tarball as a separate asset. At this point, we might as well just take steps to ensure that the version in these files is always at least somewhat meaningful.

make zbm-release should be idempotent when acting on GitHub release tarballs, so I figure adding it as a dependency of the core target is a reasonable approach to making sure the version on installed packages is always the most informative that we can discern.

@ahesford
Copy link
Member Author

Turns out dracut creates its own /usr/lib/os-release and symlinks /etc/os-release to it, clobbering the one created by the ZBM module. As a workaround, I install /etc/zbm-release and symlink /etc/os-release to that, which will still be clobbered by dracut but will leave /etc/zbm-release for users to see.

I've also added some support in the container image and zbm-builder.sh for using the new versioning script. (Note that build containers do not include git by default. To get a version other than what is already recorded in the repository, it is necessary to do, e.g., zbm-builder.sh -L /path/to/repo -- -p git to install git and ensure that the repository will have a writable overlay.)

@zdykstra
Copy link
Member

To get a version other than what is already recorded in the repository, it is necessary to do, e.g., zbm-builder.sh -L /path/to/repo -- -p git to install git and ensure that the repository will have a writable overlay.)

Are there any downsides to just including git by default in the build container? Anything we can do to reduce the manual steps would be good.

@ahesford
Copy link
Member Author

Adding git to the standard image is probably fine.

@zdykstra
Copy link
Member

Once this is merged, zreport() can be extended to show a few variables from /etc/zbm-release

@ahesford
Copy link
Member Author

9d7eba4

@ahesford ahesford closed this Nov 26, 2023
@ahesford ahesford deleted the the_lovely_bones branch November 26, 2023 20:05
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.

3 participants