Skip to content

Add a repository dirtiness indicator to the auto-generated version information #3899

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

Merged
merged 4 commits into from
Jul 21, 2025

Conversation

ianbrault
Copy link
Contributor

@ianbrault ianbrault commented Jul 18, 2025

Related Issue(s) N/A
Has Unit Tests (y/n) n
Documentation Included (y/n) n

Change Description

This change makes a small modification to the version auto-coder script generate_version_info.py to include the --dirty flag when calling git describe. This will show whether a build has any un-committed changes in its repository or any of its dependencies.

for example:

# before:
$ git describe --tags --always
v4.0.0a1-104-gb217fc79a
# after:
$ git describe --tags --always --dirty
v4.0.0a1-104-gb217fc79a-dirty

Rationale

This change is useful for an operator to see whether or not the binary that is running was built from a dirty repository or with dirty dependencies, and creates useful breadcrumbs in the version telemetry.

Testing/Review Recommendations

Should hopefully be straightforward to test, create a build from a clean repository and compare to a build created from a dirty repository.

Future Work

One thing to consider might be this note from the git describe manual:

If a repository is corrupt and Git cannot determine if there is local modification, Git will error out, unless ‘--broken’ is given, which appends the suffix "-broken" instead.

Is it worth supporting this functionality for a corrupt repository? If so, it might be useful to include the --broken flag in this command as well.

LeStarch
LeStarch previously approved these changes Jul 18, 2025
@LeStarch
Copy link
Collaborator

I would happily include a --broken flag, but that could also be a separate PR.

@ianbrault
Copy link
Contributor Author

@LeStarch I can push a commit to add the --broken flag under this, not a problem

LeStarch
LeStarch previously approved these changes Jul 20, 2025
@LeStarch LeStarch merged commit 25bb3b3 into nasa:devel Jul 21, 2025
51 checks passed
ianbrault added a commit to ianbrault/fprime that referenced this pull request Jul 22, 2025
…formation (nasa#3899)

* Add --dirty flag to the git command used in the version autocoder

* Additionally add --broken flag to the git command used in the version autocoder

* format

---------

Co-authored-by: Ian Brault <[email protected]>
Co-authored-by: M Starch <[email protected]>
@ianbrault ianbrault deleted the ibrault-version-dirty-flag branch August 6, 2025 19:50
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