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

gitconfig credential.helper error: Resource busy #222

Closed
kpettijohn opened this issue Dec 2, 2022 · 7 comments · Fixed by #384 or #407
Closed

gitconfig credential.helper error: Resource busy #222

kpettijohn opened this issue Dec 2, 2022 · 7 comments · Fixed by #384 or #407
Assignees

Comments

@kpettijohn
Copy link

It seems with the changes made in #203 Atlantis now throws an error when attempting to modify the git config.

https://github.com/runatlantis/helm-charts/pull/203/files#diff-a3b675e5633e3d9602003c23ede42b91c32bc10f4aed39235b204cff10c11bbdL131

{"level":"error","ts":"2022-12-02T16:15:07.444Z","caller":"events/command_runner.go:169","msg":"Error running pre-workflow hooks There was an error running git config --global credential.helper store: error: could not write config file /home/atlantis/.gitconfig: Resource busy\n: exit status 4. Proceeding with plan command."}

Overall I believe this is due to changing the mount path to be /home/atlantis/.gitconfig instead of mounting the file to /etc/secret-gitconfig and copying the file to /home/atlantis/.gitconfig. This causes the /home/atlantis/.gitconfig file to be read only so when Atlantis attempts to run git config --global credential.helper store it results in the error Resource busy.

It seems due to this error it causes all additional pre workflow hooks to be skipped which causes additional issues. I'm not totally sure what the best path forward is here. In our setup we include the git credential configuration as part of the gitconfig.

            gitconfig: |
              [credential]
                helper = store
              [url "https://[email protected]"]
                insteadOf = ssh://[email protected]
              [url "https://[email protected]/"]
                insteadOf = [email protected]:

Any ideas to fix or work around the issue would be appreciated!

@nitrocode
Copy link
Member

Thanks @kpettijohn for bringing this to our attention.

@kpettijohn @nxf5025 could you see if there is a small change to fix this?

@GMartinez-Sisti
Copy link
Member

Possible fix on #384. Please review.

@bdellegrazie
Copy link
Contributor

Just FYI, this isn't fixed as the volume mount is still mounted read-only.

@GMartinez-Sisti
Copy link
Member

Just FYI, this isn't fixed as the volume mount is still mounted read-only.

Yes! We are aware of that 😓 Recent discussions were here. Re-opening !

@GMartinez-Sisti
Copy link
Member

Hi! Please take a look at #407, to confirm this fixes the issue. 🙏

@qdm12
Copy link

qdm12 commented Oct 10, 2024

Hello there,
I am facing the same issue but on another project (bind mounting .gitconfig in a dev container).
@kpettijohn you mention

This causes the /home/atlantis/.gitconfig file to be read only

Why is that? Why is mounting directly to ~/.gitconfig making this read-only for git?? In my case I bind mount without forcing read-only in a container with -v /home/user/.gitconfig:/home/user/.gitconfig and get that resource busy error as well. Is bind mounting making git unable to modify the file? On top of this, manually editing the file (i.e. with vi) works fine...

@mubarak-j
Copy link
Contributor

@qdm12 I'm not sure why read-only is the default but you can override it using gitconfigReadOnly: true in the helm values which was added in v5.4.1 of this chart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment