Created
August 11, 2019 22:11
-
-
Save BenGGolden/dccbfe09c6e85f902b96c474ad9392a6 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