-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat: improve --version
for non-releases
#495
Conversation
--version
for non-releases
Can also consider creating a status page for the node. Something to monitor the status of the node and the metadata like block height, node version etc. Right now we can only "monitor" via the client or submitting a note via the faucet webpage. |
I'm not fully understanding this yet - but a couple of questions/comments: The effect of this is that we add more info to the Generally, I think it is good to add more details to the version like you have with the
I also probably won't publish a separate crate just for this. Given that we have only 2 binaries, I'm wondering if putting this just in
Yes, that would be great. This is probably somewhat related to #145 and maybe #83 and #95. But maybe it is worth creating a separate issue (or maybe something to superseded some of these mentioned issues). |
Correct, more specifically it uses the output of # If at a tagged commit, only the tag is output
version=TAG # e.g. v0.5.0
# At commit with <SHA> hash, N commits after the last tag
version=TAG-N-SHA. # e.g. v0.5.0-12-ABCDEFG
# In addition if the repo contains uncommitted changes then a `-dirty` suffix is added.
version=TAG-dirty. # e.g. v0.5.0-dirty if directly on a tagged commit, or
version=TAG-N-SHA-dirty # e.g. v0.5.0-12-ABCDEFG-dirty.
This is based entirely on And for the binaries in which this was wrong, we would still have access to the correct commit
This should always be the case unless we screw up the tags. Basing it on the manifest won't work for non-releases as the manifest is always bumped immediately after the previous release, meaning this would be "incorrect" for the duration of If the potential error between manifest and git tag is an issue, then we can leave things as is and instead add this information as extended metadata for the long version output. Non-releases will have the top level version output, but the correct data will still be present for long version. Though I would argue that it's confusing :)
I think that's probably the correct call. Will update first thing next week. |
I should also add a tag filter so that only version related tags are considered. e.g. if we ever use tags for other things then those will be ignored. |
Currently, my process is a bit different - though, it can of course be changes. Specifically, I usually first publish crates to crates.io and then tag the release. Also, sometimes I publish patches of individual crates without creating tags. For example, if there was a bug fixed in say the block producer crate, I would publish it under
To clarify, would the short version show something like:
But the long version would show something like:
If so, I don't think this is too confusing. But would it satisfy the original goal of this PR? |
ec86b78
to
1bf44bf
Compare
Tagging afterwards is fine -
This version output only applies to the executables. So long as the tags match the intended versions of the node/faucet we would be okay. There are other options - one can also override these env variables during the build process if required. I've reverted this change for now; I've only added additional metadata to the long version. The actual version used is now the crate/manifest version. The metadata will give us the additional data we need to accurately debug. We just need to be aware that a user claiming
I've updated the PR so that the short version output is:
and the long
Feel free to suggest a better formatting; I tried with prefixes like I've only implemented this for the Something else I was hoping to determine that it was built with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The format looks great! Thank you! I left one small comment inline, and I think once we propagate this to the faucet as well, we are good to merge.
I guess one thing to confirm: how would it work when the crate is pulled from crates.io? For example, how would |
I checked using
which isn't ideal but I believe this should let us determine whether its a formal release/install at least? There are of course hacks around this if people want to abuse it but that is what it is. |
Should we detect this and not include the missing fields in the output? Would still make it clear if this is a release/install, but also would avoid exposing implementation details (i.e., that we use |
We can get at least the SHA from a published crate. {
"git": {
"sha1": "9d48046e9654d93a86212e77d6c92f14c95de44b"
},
"path_in_vcs": "bin/node"
} I'm also taking a quick look into alternatives like |
df6c23d
to
66fbeb8
Compare
I've added a check for the published state (so we still get sha data) and also override the default vergen output in case it somehow slips through. I've copy pasted this to the faucet instead of the utils crate for the reason given in this comment. I've tested that it works for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you! I left a few more comments inline.
I've moved everything into the
-- edit -- Okay this doesn't work because -- 2nd edit -- Using your suggestion of a struct + Display implementation so the end caller can inject the variables. |
bde10fa
to
1ce9918
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you! I left just one optional nit inline.
crates/utils/Cargo.toml
Outdated
[features] | ||
# Enables depedencies intended for build script generation of version metadata. | ||
vergen = ["dep:vergen", "dep:vergen-gitcl"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we usually put features
section above the dependencies
section.
This PR improves
--version
outputs for the node and faucet by including extra information for non-release builds.--version
is now set togit describe --tags --dirty
which is no change for formal releases (sincetag == package version
), but for non-releases indicates the previous tag, commit count since that tag, commit SHA and appends-dirty
if it was built with uncommitted changes.Motivation is given in #493.
Some points of contention:
miden-node-utils
crate. However, since this is abuild.rs
that depends ongit
data, this means the utils crate will be rebuilt after everygit
change i.e. this will cause a rebuild of utils and all of its dependents. It is probably better if this became its own top level crate - I decided not to do this because I didn't want to publish such a minor crate. But it might make sense to just do it. Alternatively, we can add thisbuild.rs
to every binary we create instead.git describe --tags
on thenext
branch currently returnsv0.4.0
because thev0.5.0
tag onmain
has not been merged back yet. Just something to consider for our release "process" :). This differs significantly to the current output which isv0.6.0
(the in-progress package version).The
--dirty
flag currently doesn't work unfortunately. I've opened an issue for this invergen
.We can also consider additional build descriptions.
vergen
has an illustrative example for verbose version info, which provides information that could be useful for debugging/reproduction purposes:Closes #493