@@ -56,6 +56,10 @@ public function __construct(
56
56
57
57
public function asNodeTasks (Deployment $ deployment , Process $ process , bool $ pullImage = true , ?int $ desiredReplicas = null , ?Backup $ backup = null ): array
58
58
{
59
+ if (! $ this ->dockerName ) {
60
+ $ this ->dockerName = $ process ->makeResourceName ('wkr_ ' .$ this ->name );
61
+ }
62
+
59
63
$ launchNow = is_null ($ desiredReplicas ) ? $ this ->replicas > 0 : $ desiredReplicas > 0 ;
60
64
61
65
if ($ launchNow ) {
@@ -76,10 +80,6 @@ public function asNodeTasks(Deployment $deployment, Process $process, bool $pull
76
80
77
81
$ tasks = [];
78
82
79
- if (! $ this ->dockerName ) {
80
- $ this ->dockerName = $ process ->makeResourceName ('wkr_ ' .$ this ->name );
81
- }
82
-
83
83
if ($ this ->launchMode ->value === LaunchMode::BackupCreate->value && ! $ this ->backupCreate ->backupVolume ) {
84
84
$ dockerName = dockerize_name ($ this ->dockerName .'_vol_ptah_backup ' );
85
85
@@ -136,7 +136,7 @@ public function asNodeTasks(Deployment $deployment, Process $process, bool $pull
136
136
'workerName ' => $ this ->name ,
137
137
]),
138
138
'payload ' => [
139
- 'ReleaseCommand ' => $ this ->getReleaseCommandPayload ($ process , $ labels ),
139
+ 'ReleaseCommand ' => $ this ->getReleaseCommandPayload ($ deployment , $ labels ),
140
140
'SecretVars ' => $ this ->getSecretVars ($ process ),
141
141
'SwarmServiceSpec ' => [
142
142
'Name ' => $ this ->dockerName ,
@@ -283,7 +283,7 @@ private function getCommandAndArgs(): array
283
283
return [['sh ' ], ['-c ' , $ this ->command ]];
284
284
}
285
285
286
- private function getReleaseCommandPayload (Process $ process , array $ labels ): array
286
+ private function getReleaseCommandPayload (Deployment $ deployment , array $ labels ): array
287
287
{
288
288
if (! $ this ->releaseCommand ->command ) {
289
289
return [
@@ -294,7 +294,7 @@ private function getReleaseCommandPayload(Process $process, array $labels): arra
294
294
}
295
295
296
296
// Always create a new config, as the command may be the same, but the image/entrypoint may be different.
297
- $ this ->releaseCommand ->dockerName = $ process ->makeResourceName ('rel_cmd ' );
297
+ $ this ->releaseCommand ->dockerName = $ this ->makeResourceName ('dpl_ ' . $ deployment -> id . ' _rel_cmd ' );
298
298
299
299
return [
300
300
'ConfigName ' => $ this ->releaseCommand ->dockerName ,
@@ -468,6 +468,11 @@ private function getBackupRestoreTask(Backup $backup, array $labels): array
468
468
];
469
469
}
470
470
471
+ private function makeResourceName (string $ name ): string
472
+ {
473
+ return dockerize_name ($ this ->dockerName .'_ ' .$ name );
474
+ }
475
+
471
476
public static function make (array $ attributes ): static
472
477
{
473
478
$ defaults = [
0 commit comments