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

[Bug]: Quickly opening and merging a PR crashes deploys and leaves ghosts #2610

Open
ity-alex opened this issue Jun 20, 2024 · 1 comment
Open

Comments

@ity-alex
Copy link

ity-alex commented Jun 20, 2024

Description

When connecting a resource via Github App and opening a PR, a preview deployment gets queued. If the PR is merged right after it is created (few seconds) the deployment stalls (I assume because there is nothing to pull from?), blocks the queue and the new docker container will not get cleaned up.

We are using the hosted interface at app.coolify.com, love this project so far! This is only a minor issue, not urgent for us at all!

All the best!

Minimal Reproduction (if possible, example repository)

Connect source as Github App, open Pull Request, wait only 2-3 seconds, close/merge the PR.

Exception or Error

No response

Version

v4.0.0-beta.297

@ity-alex ity-alex changed the title [Bug]: Quickly opening and mergin a PR crashes deploys and leaves ghosts [Bug]: Quickly opening and merging a PR crashes deploys and leaves ghosts Jun 20, 2024
@ity-alex
Copy link
Author

I found these two possibly relevant code sections:

  • Deleting a PR container by webhook when the PR closes (here something seems to be missing):

    $found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
    if ($found) {
    $container_name = generateApplicationContainerName($application, $pull_request_id);
    instant_remote_process(["docker rm -f $container_name"], $application->destination->server);
    ApplicationPullRequestUpdateJob::dispatchSync(application: $application, preview: $found, status: ProcessStatus::CLOSED);
    $found->delete();

  • Cancelling a running deploy, which seems to remove the container correctly:

    $kill_command = "docker rm -f {$this->application_deployment_queue->deployment_uuid}";

Maybe the deletion by webhook only removes the final container, while the cancelling of the deploy removes the currently building container. Possible solution would be to check for currently active deploys in the webhook handler?

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

No branches or pull requests

1 participant