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

[SCons] Add info on git hash to SCons output #1176

Merged
merged 1 commit into from
Jan 18, 2022

Conversation

ischoegl
Copy link
Member

@ischoegl ischoegl commented Jan 18, 2022

Changes proposed in this pull request

Add git hash at the beginning of the SCons build log:

$ scons build
scons: Reading SConscript files ...
INFO: SCons is using the following Python interpreter: /usr/bin/python3
INFO: Building Cantera based on git commit 'fcff59292'
[...]

Replaces #1175

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

SConstruct Outdated Show resolved Hide resolved
@ischoegl
Copy link
Member Author

@bryanwweber ... thanks for the suggestion!

@bryanwweber
Copy link
Member

Interestingly, the hash in the build logs is not the same as the commit shown in the PR here:

INFO: Building Cantera from git commit '4fd09b3'

From https://github.com/Cantera/cantera/runs/4859330648?check_suite_focus=true#step:7:9

@ischoegl
Copy link
Member Author

ischoegl commented Jan 18, 2022

Interestingly, the hash in the build logs is not the same as the commit shown in the PR here:

This is truly odd, as I’m just displaying a value that had existed before. No idea why the build creates a different hash (4fd09b3).

@ischoegl
Copy link
Member Author

PS: Pasting the hash actually resolved the riddle - the commit is a fix-up that was merged into what is now ae316de. I believe this is due to running git commit --amend --no-edit. Funny that git discovers a different hash.

@ischoegl
Copy link
Member Author

ischoegl commented Jan 18, 2022

The approach followed in SConstruct to get the git hash (git rev-parse --short HEAD) is the recommended solution on SO. On my machine this works as expected (and is consistent with the output of all other alternatives). So while the build currently displays a different hash, I do not believe that there is an actual issue here.

@ischoegl ischoegl merged commit a0b62a4 into Cantera:main Jan 18, 2022
@ischoegl
Copy link
Member Author

ischoegl commented Jan 18, 2022

🎉 FWIW, the merged build displays the correct hash, i.e.

INFO: Building Cantera from git commit 'a0b62a4'

so my interpretation is that the hash mismatch observed above is likely due to some GH internals.

@ischoegl ischoegl deleted the display-git-commit branch January 18, 2022 23:56
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.

2 participants