-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
git rev-parse HEAD^2 unknown revision or path not in the working tree #2952
Comments
Why would |
Sorry, I investigate it and found that generally it doesn't have a problem. This issue is raised by following steps.
I think it's ok to close this issue for a edge case. (I'm trying
In this case |
Running into same errors on our configuration. Running multiple instances of Atlantis using Redis locking with a shared data directory. Seems to also happen when creating a pull request and quickly pushing a commit to the pull request. I think its caused by a race condition where mutliple instances are trying to clone the repository into the same directory, before the PR has been locked. |
@renescheepers the redis locking feature is a brand new feature and has limited documentation. Could you expand on your setup? Version, repo config, server config, reproducible steps, do you use workspaces? Perhaps the lock isn't checked until after the clone? |
@nitrocode we are currently using Atlantis 0.21.0. Everything is in workspace default. I haven't been able to consistently reproduce this yet in our testing environment. It does seem to happen on production environment when the GitHub hooks don't seem to be responding very fast. What I think happens is that a PR is opened and is quickly followed up by another commit, firing two events both arriving at different instances where the PR hasn't been locked yet. Causing a race condition on the directory containing the repository. Atlantis deployed as 3 instances running. Server config port: 18000
gh-org: X
gh-app-id: X
gh-app-slug: X
gh-app-key-file: /var/run/atlantis/gh-app-key/atlantis-app-key.pem
gh-allow-mergeable-bypass-apply: true
write-git-creds: true
repo-allowlist: github.com/X
atlantis-url: https://atlantis.X.com
repo-config: /var/run/atlantis-repo-config/repos.yaml
data-dir: /mnt/atlantis # Shared between instances
enable-regexp-cmd: true
disable-apply-all: true
default-tf-version: v0.15.4
hide-prev-plan-comments: true
skip-clone-no-changes: true
checkout-strategy: merge
enable-policy-checks: true
quiet-policy-checks: true
locking-db-type: redis
markdown-template-overrides-dir: /templates Repo config Removed about 1500 projects but it mostly looks like the one below. ---
version: 3
projects:
... # 4000 lines of projects here
- dir: terraform/gcp/projects/...REMOVED
terraform_version: v1.3.7 Exception 1
Exception 2
Exception 3
|
Sounds like the root issue is pushing 1 commit and then the next one too quickly and Atlantis not checking if there is an already an existing run. There is a related issue here |
@nitrocode yes, I think thats the case. When trying to reproduce in a testing environment I was also able to get a Terraform locking error. Which also shouldn't happen if the locking works correctly. I'm still trying to setup an environment in which I can consistently reproduce this and hopefully fix it. |
yes, if you can reproduce this, it would be great to have a fix and a test for this! Please feel free to propose a fix. |
Ok, did a little bit more digging into this. I think the code below is causing this, the sync map is of course not across multiple instances. We are also running into some other performance issues when using an NFS server. When using the merge checkout strategy it won't do a shallow clone of the repository this in combination with the size of our repository results in the clone taking quite a while. This problem is even worsened quite a bit by the use of an NFS server, which has absolutely terrible performance when there are a lot of small files. atlantis/server/events/working_dir.go Lines 205 to 212 in 27b9897
|
@renescheepers do you think this pr would resolve it? Besides shallow clones for the merge strategy, what else could be proposed to speed up your performance? |
I ran into the original error in a situation where the I had a look at the code and I think the issue is that when Atlantis does a |
Community Note
Overview of the Issue
When enable
--checkout-strategy=merge
,will re-clone repo, could not determine if was at correct commit: git rev-parse HEAD^2: exit status 128: HEAD^2\nfatal: ambiguous argument 'HEAD^2': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command>
error raised.Reproduction Steps
--checkout-strategy=merge
Logs
Provide log files from Atlantis server
Logs
Environment details
If not already included, please provide the following:
--checkout-strategy=merge
Additional Context
HEAD^^
might be helpful.atlantis/server/events/working_dir.go
Lines 100 to 103 in e4473ce
The text was updated successfully, but these errors were encountered: