-
Notifications
You must be signed in to change notification settings - Fork 0
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
132: Add version and git hash/status to agent CLI #80
base: main
Are you sure you want to change the base?
Conversation
let output = Command::new("git") | ||
.args(&["rev-parse", "HEAD"]) |
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.
.git
is not part of the source directory in nix flakes so this will not work as intended. which explains the error on CI: https://buildbot-nix-0.infra.holochain.org/#/builders/416/builds/370
nix itself knows about the revision and there's a way to pass it through, maybe via an environment variable. if you rewrite this in a way that first tries to read the environment and only falls back to calling git
we can make it work. i also suggest graceful handling of the inexistence of either.
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.
If you can tell me which environment variable(s) are present during the build, I can definitely change the above to use those instead.
.unwrap(); | ||
if status.success() { | ||
println!("cargo:rustc-env=GIT_STATUS=clean"); | ||
} else { |
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.
this will consider a failed attempt at merely calling git
to be in a dirty state. which is far from the truth for when git
isn't even in PATH and .git
is not present.
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.
i suggest to differentiate between a failed execution of git
and git reporting that the tree is dirty. for deployment in production via any of nix' tooling this is not relevant as per the discussion above.
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.
If it reports it as dirty and there's no hash in a controlled environment, it's pretty clear that it was a failure to run git. Let me know the environment variables and how to execute the build under that environment and I'll make some changes to the code.
Closes #issue-number