Page History
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
Import-Module JS7 Connect-JS7 -Url http://root:root@test_host:4446 -Id 'Controller' | Out-Null # Add, commit and push changes to the remote Git repository Invoke-JS7GitRepositoryAdd -Folder '/Accounting' | Out-Null # Commit changes $reponse = Invoke-JS7GitRepositoryCommit -Folder '/Accounting' -Message 'changes for release v1.13' Invoke-JS7GitRepositoryPush -Folder '/Accounting' |
Example of a CI/CD Pipeline Script for TEST Environment
The below example includes use of the above cmdlets in a pipeline script.
Download PowerShell Script: Rollout-JS7FromTest.ps1
# Parse commit hash from response
if ( $matchInfo = ( $response.stdout | Select-String '^\[.* +([0-9a-z]+)\]' ) )
{
$commitHash = $matchInfo.Matches.Groups[1].Value
}
# Push changes
Invoke-JS7GitRepositoryPush -Folder '/Accounting' | Out-Null
|
Example of a CI/CD Pipeline Script for TEST Environment
The below example includes use of the above cmdlets in a pipeline script.
Download PowerShell Script: Rollout-JS7FromTest.ps1
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
# --- Parameterization ---
$url = 'http://root:root@test_host:4446'
$controllerId = 'Controller'
$folder = '/Accounting'
# --- Connection ---
Import-Module JS7
Connect-JS7 -Url $url -Id $controllerId | Out-Null
# --- Step 1: Check status of releasable and deployable objects ---
$items = Get-JS7ReleasableItem -Folder $folder -NoReleased
if ( $items.count )
{
Write-Warning "CI/CD pipeline stopped: unreleased objects found:"
foreach( $item in $items )
{
Write-Warning "unreleased object: type=$($item.objectType), valid=$($item.valid), folder=$($item.folder), name=$($item.objectName)"
}
# optionally release items
$items | Publish-JS7ReleasableItem
} | ||||||||
Code Block | ||||||||
| ||||||||
# --- Parameterization --- $url = 'http://root:root@test_host:4446' $controllerId = 'Controller' $folder = '/Accounting' # --- Connection --- Import-Module JS7 Connect-JS7 -Url $url -Id $controllerId | Out-Null # --- Step 1: Check status of releasable and deployable objects --- $items = Get-JS7ReleasableItemJS7DeployableItem -Folder $folder -NoReleasedNoDeployed if ( $items.count ) { Write-Warning "CI/CD pipeline stopped: unreleased objects found:" foreach( $item in $items ) { Write-Warning "unreleased object: type=$($item.objectType), valid=$($item.valid), folder=$($item.folder), name=$($item.objectName)" } CD pipeline stopped: undeployed objects found:" foreach( $item in $items ) #{ optionally release items $items | Publish-JS7ReleasableItem } $items = Get-JS7DeployableItem -Folder $folder -NoDeployed if ( $items.count ) { Write-Warning "CI/CD pipeline stopped: undeployed objects found:" foreach( $item in $items ) { Write-Warning "undeployed object: type=$($item.objectType), valid=$($item.valid), folder=$($item.folder), name=$($item.objectName)" } # optionally deploy items $items | Publish-JS7DeployableItem -ControllerId $controllerId } Write-Warning "undeployed object: type=$($item.objectType), valid=$($item.valid), folder=$($item.folder), name=$($item.objectName)" } # optionally deploy items $items | Publish-JS7DeployableItem -ControllerId $controllerId } # --- Step 2: Cleanup repository and store scheduling objects to repository --- # Cleanup local repository by removing existing objects Remove-JS7RepositoryItem -Folder $folder # Store scheduling objects of the given folder and exclude draft versions to be used Set-JS7RepositoryItem -Folder $folder -Recursive -NoDraft # --- Step 23: add Cleanupobjects, repositorycommit and storepush schedulingto objects toremote repository --- # Add changes Cleanupto local repository by removing existing objects Remove-JS7RepositoryItem -Folder $folder # Store scheduling objects of the given folder and exclude draft versions to be used Set-JS7RepositoryItem -Folder $folder -Recursive -NoDraft # --- Step 3: add objects, commit and push to remote repository --- Invoke-JS7GitRepositoryAdd -Folder $folder Invoke-JS7GitRepositoryCommit -Folder $folder -Message 'changes to accounting jobs for v12.3'staging area Invoke-JS7GitRepositoryAdd -Folder $folder | Out-Null # Commit changes $response = Invoke-JS7GitRepositoryCommit -Folder $folder -Message 'changes to accounting jobs for v12.3' # Parse commit hash from response if ( $matchInfo = ( $response.stdout | Select-String '^\[.* +([0-9a-z]+)\]' ) ) { $commitHash = $matchInfo.Matches.Groups[1].Value } # Push changes to remote repository Invoke-JS7GitRepositoryPush -Folder $folder | Out-Null # --- Connection --- Disconnect-JS7 |
...
Overview
Content Tools