fix(mcp): queue MCP deployments behind a deployment in progress

The MCP deploy tool and control start skipped the deployment queue, so
two rolling updates of one application could run at once and remove the
new container of each other. A rolling update now also removes only the
containers that ran before it started.

Closes #12442

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-11-03 18:12:58 +01:00
co-authored by Claude Opus 5.5
parent 777362cd97
commit bb6dfd147e
6 changed files with 170 additions and 11 deletions
@@ -83,3 +83,35 @@ it('uses the container name prefix for generated container names only', function
->and(generateApplicationContainerName(applicationWithContainerNamePrefix(consistent: true)))->toBe('application-uuid')
->and(generateApplicationContainerName(applicationWithContainerNamePrefix(), 42))->toBe('application-uuid-pr-42');
});
it('removes all old generated containers but not the new one', function () {
$application = applicationWithContainerNaming();
$application->settings->is_consistent_container_name_enabled = false;
[$job, $reflection] = containerNamingJob($application);
$reflection->getProperty('container_name')->setValue($job, 'application-uuid-20260908T141530');
$containers = new Collection([
['Names' => 'application-uuid-20260101T000000'],
['Names' => 'application-uuid-20260908T141530'],
]);
expect($reflection->getMethod('oldGeneratedContainerNames')->invoke($job, $containers)->all())
->toBe(['application-uuid-20260101T000000']);
});
it('keeps a container that another deployment started during the rolling update', function () {
$application = applicationWithContainerNaming();
$application->settings->is_consistent_container_name_enabled = false;
[$job, $reflection] = containerNamingJob($application);
$reflection->getProperty('container_name')->setValue($job, 'application-uuid-20260908T141530');
$reflection->getProperty('containerNamesBeforeRollingUpdate')->setValue($job, ['application-uuid-20260101T000000']);
$containers = new Collection([
['Names' => 'application-uuid-20260101T000000'],
['Names' => 'application-uuid-20260908T141530'],
['Names' => 'application-uuid-20260908T141548'],
]);
expect($reflection->getMethod('oldGeneratedContainerNames')->invoke($job, $containers)->all())
->toBe(['application-uuid-20260101T000000']);
});