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

Automerge happens on an apply of 0 projects #1674

Open
grimm26 opened this issue Jun 29, 2021 · 8 comments
Open

Automerge happens on an apply of 0 projects #1674

grimm26 opened this issue Jun 29, 2021 · 8 comments
Labels
bug Something isn't working help wanted Good feature for contributors

Comments

@grimm26
Copy link
Contributor

grimm26 commented Jun 29, 2021

I just upgraded to atlantis 0.17.1 from 0.17.0 and I'm using it with a GitHub Enterprise instance. When I did the atlantis upgrade, there were a couple of pull requests that were planned and approved but had not yet been applied. Someone ran an atlantis apply on them and they applied and automerged. The apply was for 0 projects because there was no plan in play, but it still called that apply successful and then automerged. The log showed:

{
    "level": "info",
    "ts": "2021-06-29T14:31:03.359Z",
    "caller": "events/apply_command_runner.go:110",
    "msg": "pull request mergeable status: true",
    "json": {
        "repo": "terraforms/production",
        "pull": "6111"
    }
}
{
    "level": "info",
    "ts": "2021-06-29T14:31:04.623Z",
    "caller": "events/automerger.go:31",
    "msg": "automerging pull request",
    "json": {
        "repo": "terraforms/production",
        "pull": "6111"
    }
}

I tried to reproduce this by creating a new PR, planning and approving it, then unlocking it from the atlantis UI and then trying an apply. It still did the 0 projects apply, but it did not automerge.
When I looked at the log, it shows "

{
    "level": "info",
    "ts": "2021-06-29T17:09:23.608Z",
    "caller": "events/apply_command_runner.go:110",
    "msg": "pull request mergeable status: false",
    "json": {
        "repo": "terraforms/production",
        "pull": "6128"
    }
}

{
    "level": "info",
    "ts": "2021-06-29T17:09:24.335Z",
    "caller": "events/automerger.go:19",
    "msg": "not automerging because project at dir \"infrastructure/staging/junk\", workspace \"default\" has status \"plan_discarded\"",
    "json": {
        "repo": "terraforms/production",
        "pull": "6128"
    }
}

So I assume there must be a saved state in the second case to show that the plan was discarded. Why does the first one go ahead with applying a merging when it applied 0 projects and there was obviously no plan to begin with?

@msarvar
Copy link
Contributor

msarvar commented Jul 13, 2021

Is it possible that when you upgraded, atlantis' boltdb instance got deleted? Atlantis stores pull request specific states inside its boltdb instance, so one explanation could be that the db was wiped during upgrade.

@msarvar msarvar added the waiting-on-response Waiting for a response from the user label Jul 13, 2021
@grimm26
Copy link
Contributor Author

grimm26 commented Jul 13, 2021

Is it possible that when you upgraded, atlantis' boltdb instance got deleted? Atlantis stores pull request specific states inside its boltdb instance, so one explanation could be that the db was wiped during upgrade.

@msarvar Absolutely. I run atlantis as an AWS fargate task, so the new task had a new container. I'm fully aware of that. I just wonder why atlantis would allow an apply to be run on a Pull Request that did not have a valid plan and had changes.

@grimm26
Copy link
Contributor Author

grimm26 commented Jul 13, 2021

FYI, my only workaround for this is that whenever I refresh atlantis is to run a script that comments atlantis plan on all open PRs. That does also help with the annoying error from #1067

@grimm26
Copy link
Contributor Author

grimm26 commented Jul 14, 2021

looks to be related to #1264 and #1575

@grimm26
Copy link
Contributor Author

grimm26 commented Jul 26, 2021

@msarvar if only I could add a waiting-on-response-response tag

@msarvar
Copy link
Contributor

msarvar commented Jul 27, 2021

@grimm26 Sorry for the wait, but looks like other similar issues were marked already. So I will update the tags accordingly.

@msarvar msarvar added bug Something isn't working help wanted Good feature for contributors and removed waiting-on-response Waiting for a response from the user labels Jul 27, 2021
@jamengual
Copy link
Contributor

is this still an issue with v0.19.8?

@jamengual jamengual added the waiting-on-response Waiting for a response from the user label Aug 26, 2022
@Dilergore
Copy link

Sometimes I see this even on the latest version, but I have no idea how to repro, it seems totally ittermitent.

@jamengual jamengual removed the waiting-on-response Waiting for a response from the user label Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Good feature for contributors
Projects
None yet
Development

No branches or pull requests

4 participants