Recently I’ve been using the
charmcraft snap in a GitHub Workflow as part of testing my charms which use the new operator framework, and I ran into a permission denied error against
/etc/gitconfig. This only happened when the charm had a
git+ line in its
requirements.txt, of course. It seems GitHub automatically creates that file to help with repos which include large files, and the confinement of the
charmcraft snap means that it can see the file but not read it, even though its permissions are open.
I was able to work around this by adding a step to the workflow to move that file to the user git config instead of the system location, but I was wondering if anyone else had run into this and whether there was a better solution to this issue? For reference, this is the step I added:
- name: Fix global gitconfig for confined snap run: | cat /etc/gitconfig >> $HOME/.gitconfig sudo rm /etc/gitconfig