Skip to content

chore: Add /.git/ to the container build context#203

Open
apljungquist wants to merge 3 commits intoAxisCommunications:mainfrom
apljungquist:unknown-commit-id
Open

chore: Add /.git/ to the container build context#203
apljungquist wants to merge 3 commits intoAxisCommunications:mainfrom
apljungquist:unknown-commit-id

Conversation

@apljungquist
Copy link
Collaborator

Without it the version_with_commit_id macro cannot infer what commit the developer tools are installed from. The purpose of having this information is "to make it possible for users to communicate what version of the programs they are using when they experience issues" (#137).

Drawback of adding the git directory to the container build context include:

  • Worse cache performance (if memory serves any file changes to the mounted tree will invalidate that step in the dockerfile). But since this is the last step and I don't usually rebuild the dev container unless I expect something to be different, I don't think this will be an issue.
  • The resulting environment could in theory be the function of information not in the current commit or one of its ancestors. The likelihood and impact of this are both low and I think the benefit of the improved troubleshooting far outweighs the risk.

Without it the `version_with_commit_id` macro cannot infer what commit the developer tools are installed from. The purpose of having this information is "to make it possible for users to communicate what version of the programs they are using when they experience issues" (AxisCommunications#137).

Drawback of adding the git directory to the container build context include:
- Worse cache performance (if memory serves any file changes to the mounted tree will invalidate that step in the dockerfile). But since this is the last step and I don't usually rebuild the dev container unless I expect something to be different, I don't think this will be an issue.
- The resulting environment could in theory be the function of information not in the current commit or one of its ancestors. The likelihood and impact of this are both low and I think the benefit of the improved troubleshooting far outweighs the risk.
apljungquist added a commit that referenced this pull request Jul 17, 2025
This is needed to use the run and test commands from `cargo-acap-sdk`
with the Virtual Loan Tool, which uses port mapping to make multiple
cameras available at one (or possibly a small number) of IP addresses.

Ideally, we would only bump them when we do a release, but we don't do
proper releases, and I still want to be able to ask users what version
they are on when helping them to troubleshoot. The need for aggressive
version bumping will hopefully be eliminated with the merging of #203.
@apljungquist apljungquist marked this pull request as ready for review July 17, 2025 17:10
@apljungquist apljungquist requested a review from a team as a code owner July 17, 2025 17:10
@apljungquist apljungquist requested a review from kjughx September 1, 2025 09:01
@@ -1,5 +1,6 @@
*
!/.devhost/
!/.git/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would bind mounting this be an option?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting that if we bind mount ./.git/ explicitly in addition to ./, then we would not need to add it to the .dockerignore?

If it works, then it's an option. Curious what you see as benefits though?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context: this is where the existing bind mount, which excludes .git/, happens: https://github.com/AxisCommunications/acap-rs/blob/main/.devcontainer/Dockerfile#L57

@apljungquist apljungquist requested a review from guoxe September 15, 2025 16:48
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

Comments