Forked from BenGGolden/(Sitecore Commerce 8.2.1 Staging with SPE)
Created
July 5, 2022 13:57
-
-
Save nehemiahj/31d50673d171c7146b6f0bd57261a7bf to your computer and use it in GitHub Desktop.
Sitecore Commerce 8.2.1 Staging with SPE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A SPE module that provides a dialog to stage (publish) Sitecore Commerce 8.2.1 catalog data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Function Get-StagingProjects | |
Get-StagingProjects | | |
Show-ListView -Property Name, Status | |
Close-Window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-StagingProjects { | |
param() | |
$getProjectsArgs = [Sitecore.Commerce.Connect.CommerceServer.Staging.Pipelines.GetAllCommerceStagingProjectsArgs]::new() | |
[Sitecore.Pipelines.CorePipeline]::Run("GetAllCommerceStagingProjects", $getProjectsArgs) | |
$getProjectsArgs.OutputParameters.ProjectNames | | |
Foreach { | |
[StagingProject]@{ | |
Name = $_ | |
Status = (Get-StagingProjectStatus $_) | |
} | |
} | |
} | |
function Get-StagingProjectStatus { | |
param( | |
[string] $projectName | |
) | |
$getStatusArgs = [Sitecore.Commerce.Connect.CommerceServer.Staging.Pipelines.GetCommerceStagingProjectLocalStatusArgs]::new() | |
$getStatusArgs.InputParameters.ProjectName = $projectName; | |
[Sitecore.Pipelines.CorePipeline]::Run("GetCommerceStagingLocalProjectStatus", $getStatusArgs) | |
$getStatusArgs.OutputParameters.Status | |
} | |
class StagingProject { | |
[ValidateNotNullOrEmpty()][string]$Name | |
[ValidateNotNullOrEmpty()][string]$Status | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Function Get-StagingProjects | |
Get-StagingProjects | Update-ListView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Function Get-StagingProjects | |
$projects = if ($selectedData) { $selectedData } else { $allData } | |
for ($i = 0; $i -lt $projects.Length; $i++) { | |
$projectName = $projects[$i].Name | |
Write-Progress -Activity "Running Staging Projects" -Status "$($i + 1) of $($projects.Length) Projects" -PercentComplete (($i/$projects.Length) * 100) -CurrentOperation $projectName | |
$startStagingArgs = [Sitecore.Commerce.Connect.CommerceServer.Staging.Pipelines.StartCommerceStagingProjectArgs]::new() | |
$startStagingArgs.InputParameters.ProjectName = $projectName; | |
[Sitecore.Pipelines.CorePipeline]::Run("StartCommerceStagingProject", $startStagingArgs) | |
} | |
Get-StagingProjects | Update-ListView | |
Write-Progress -Activity "Running Staging Projects" -Completed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment