Skip to content

vergen: idempotent builds from CI only, I guess? - #1225

Merged
iximeow merged 5 commits into
masterfrom
better-vergen
Oct 3, 2026
Merged

iximeow merged 5 commits into
masterfrom
better-vergen

Conversation

@iximeow

@iximeow iximeow commented Oct 2, 2026

Copy link
Copy Markdown
Member

see the diff; it turns out that setting .idempotent() omits setting rerun-if-changed=.git/HEAD. then if you:

  • building Propolis at A (fresh or otherwise with no cached builds),
  • check out a different commit B,
  • build again without cargo clean or causing propolis to rebuild

you end up with propolis-server and propolis-standalone binaries reporting they were built at commit A while containing code that quite definitely is from B.

this should fix getting accurate commit data when you're making development builds from moving around in git, but keep things more determinsitic in CI.

see the diff; it turns out that setting .idempotent() omits setting
`rerun-if-changed=.git/HEAD`. then if you:

* building Propolis at A (fresh or otherwise with no cached builds),
* check out a different commit B,
* build again without `cargo clean` or causing `propolis` to rebuild

you end up with propolis-server and propolis-standalone binaries
reporting they were built at commit A while containing code that quite
definitely is from B.

this should fix getting accurate commit data when you're making
development builds from moving around in git, but keep things more
determinsitic in CI.
@iximeow iximeow added the development Relating to engineering experience and development of propolis, not guest or product interfaces label Oct 2, 2026
@iximeow

iximeow commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

there's another bug that I'm going to push another commit here for in a second: if your working tree was clean and became dirty without touching propolis-lib (or was dirty and became clean in a similar way), the version string will become incorrect with respect to the state of the tree. an easy way to see this is add eprintln("hi :)"); to main() anywhere and rebuild; -V will say the build is from the corresponding commit when it just printed hi :) that we certainly won't ever have in-tree!

the fix for that will be moving the vergen instructions around a bit so that git-tree-is-dirty comes from the bin crates where the rest comes from propolis-lib. since they're all built out of the same directory, at least centralizing the git commit state works reasonably..

@iximeow
iximeow force-pushed the better-vergen branch 2 times, most recently from 3e92efa to 7d27ecc Compare October 2, 2026 21:02

@hawkw hawkw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this all makes sense to me; the rerun-if-changed sucks but there is really no good solution for it, so I think this is the least bad solution!

Comment thread lib/propolis/build.rs
// *much* faster to build than any of the bins being linked afterwards!
//
// This also means we can keep all of the versioning fiddliness here instead
// of subjecting every (e.g. both) user to thinking about this stuff.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

every (e.g. both)

okay, this bit got me, good show!

@iximeow
iximeow merged commit cef309a into master Oct 3, 2026
14 checks passed
@iximeow
iximeow deleted the better-vergen branch October 3, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development Relating to engineering experience and development of propolis, not guest or product interfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants