fix(deployment): avoid shared preview tags for HEAD commits

Use the deployment UUID when preview deployments are built from HEAD so each deployment gets distinct production and build image tags.
This commit is contained in:
Andras Bacsai
2026-05-11 22:11:08 +02:00
parent 2253c40e01
commit 9bb40f3ccb
4 changed files with 53 additions and 34 deletions
+5 -1
View File
@@ -1184,7 +1184,11 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$prefix = "pr-{$this->pull_request_id}-";
$suffix = $build ? '-build' : '';
$maxCommitLength = max(1, 128 - strlen($prefix) - strlen($suffix));
$commit = Str::of($this->commit ?: 'HEAD')
$commitSource = ($this->commit === 'HEAD' || blank($this->commit))
? $this->deployment_uuid
: $this->commit;
$commit = Str::of($commitSource)
->replaceMatches('/[^A-Za-z0-9_.-]/', '-')
->substr(0, $maxCommitLength)
->toString();