Skip to content

Commit 2eda20f

Browse files
committed
FEATURE: Allow additional variables when starting a release
1 parent c63d249 commit 2eda20f

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

Classes/ContentReleaseManager.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ContentReleaseManager
4646
const REDIS_CURRENT_RELEASE_KEY = 'contentStore:current';
4747
const NO_PREVIOUS_RELEASE = 'NO_PREVIOUS_RELEASE';
4848

49-
public function startIncrementalContentRelease(string $currentContentReleaseId = null): ContentReleaseIdentifier
49+
public function startIncrementalContentRelease(string $currentContentReleaseId = null, Workspace $workspace = null, array $additionalVariables = []): ContentReleaseIdentifier
5050
{
5151
$redis = $this->redisClientManager->getPrimaryRedis();
5252
if ($currentContentReleaseId) {
@@ -56,12 +56,17 @@ public function startIncrementalContentRelease(string $currentContentReleaseId =
5656
$contentReleaseId = ContentReleaseIdentifier::create();
5757
// the currentContentReleaseId is not used in any pipeline step in this package, but is a common need in other
5858
// use cases in extensions, e.g. calculating the differences between current and new release
59-
$this->prunnerApiService->schedulePipeline(PipelineName::create('do_content_release'), ['contentReleaseId' => $contentReleaseId, 'currentContentReleaseId' => $currentContentReleaseId ?: self::NO_PREVIOUS_RELEASE, 'validate' => true]);
59+
$this->prunnerApiService->schedulePipeline(PipelineName::create('do_content_release'), array_merge([
60+
'contentReleaseId' => $contentReleaseId,
61+
'currentContentReleaseId' => $currentContentReleaseId ?: self::NO_PREVIOUS_RELEASE,
62+
'validate' => true,
63+
'workspaceName' => $workspace ? $workspace->getName() : 'live',
64+
], $additionalVariables));
6065
return $contentReleaseId;
6166
}
6267

6368
// the validate parameter can be used to intentionally skip the validation step for this release
64-
public function startFullContentRelease(bool $validate = true, string $currentContentReleaseId = null, Workspace $workspace = null): ContentReleaseIdentifier
69+
public function startFullContentRelease(bool $validate = true, string $currentContentReleaseId = null, Workspace $workspace = null, array $additionalVariables = []): ContentReleaseIdentifier
6570
{
6671
$redis = $this->redisClientManager->getPrimaryRedis();
6772
if ($currentContentReleaseId) {
@@ -70,12 +75,12 @@ public function startFullContentRelease(bool $validate = true, string $currentCo
7075

7176
$contentReleaseId = ContentReleaseIdentifier::create();
7277
$this->contentCache->flush();
73-
$this->prunnerApiService->schedulePipeline(PipelineName::create('do_content_release'), [
78+
$this->prunnerApiService->schedulePipeline(PipelineName::create('do_content_release'), array_merge([
7479
'contentReleaseId' => $contentReleaseId,
7580
'currentContentReleaseId' => $currentContentReleaseId ?: self::NO_PREVIOUS_RELEASE,
7681
'validate' => $validate,
77-
'workspaceName' => $workspace ? $workspace->getName() : 'live'
78-
]);
82+
'workspaceName' => $workspace ? $workspace->getName() : 'live',
83+
], $additionalVariables));
7984
return $contentReleaseId;
8085
}
8186

0 commit comments

Comments
 (0)