-
Notifications
You must be signed in to change notification settings - Fork 2
Capture and publish commit hash in Docker image and ROS topic #96
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: rgov <[email protected]>
Co-authored-by: rgov <[email protected]>
|
@copilot This will invalidate the Docker cache on every commit—no bueno. Please move this to the very end of the Dockerfile. Why are you kinda bad? |
Co-authored-by: rgov <[email protected]>
Moved COMMIT_HASH ARG and ENV to the end of the Dockerfile to preserve Docker cache. (commit: 1e8a6d5) |
figuernd
left a comment
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 think moving commit publication to web node (or utilizing the environment variable publishing mechanism there) would make more sense for code related to header files/provenance.
| # Publish commit hash to /config/commit once at startup | ||
| rospy.Publisher('/config/commit', String, queue_size=1, latch=True)\ | ||
| .publish(String(data=os.environ.get('COMMIT_HASH', 'unknown'))) | ||
|
|
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 wonder if there's somewhere more appropriate than arm_base.py. If the purpose of this is primarily to put it in the web_node for provenance, it does already support pulling environment variables (though I'm not sure how well it works):
PhytO-ARM/src/phyto_arm/src/web_node.py
Line 53 in edb93e3
| response_values[name] = os.environ[var_name] |
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 think this is only captured in the bin files but not the ROS bags.
I agree there's no obvious place to put this. We could just run rostopic echo once at startup or something, but currently when the node finishes it will tear down everything.
Implementation Summary
The commit hash is now captured at Docker build time and published to
/config/commitas a ROS String topic at startup.How it works:
COMMIT_HASHas a build argument (defaults to "unknown")/config/committopic (latched) at startup in a single linerostopic echo /config/commitChanges:
All tests pass successfully!
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.