Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following examples assume that a local Git repository is set up in the test and prod environments, see PowerShell CLI 2.0 - Set up local Git Repository.

Steps to perform

...

for the TEST Environment

The below example assumes that 

...

Code Block
languagepowershell
titleExample how to commit and push changes to a remote repository
linenumberstrue
# Find the repository sub-directory managed by JOC Cockpit
cd /var/sos-berlin.com/js7/joc/jetty_base/resources/joc/repositories/rollout/Accounting

# Commit and push changes to the remote Git repository
git add .
git commit -m "changes to accounting jobs for v12.3"
git push

Example for a CI/CD Pipeline Script

The below example

Download: Rollout-JS7FromTest.ps1

...

Code Block
languagepowershell
titleExample CI/CD pipeline script for test environment
linenumberstrue
collapsetrue
# --- Parameterization ---

$url = 'http://root:root@localhost:4446'
$controllerId = 'Controller'

$folder = '/TestRepo/testMyFolder'
$directory = 'C:\ProgramData\sos-berlin.com\js7\joc\jetty_base\resources\joc\repositories\rollout\TestRepo'


# --- 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
}

# $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
}


# --- 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 3: add objects, commit and push to remote repository

cd $directory

git add .
git commit -m "changes to accounting jobs for v12.3"
git push


# --- Connection ---

Disconnect-JS7



Steps to perform for the PROD Environment

Copy Changes from TEST to PROD Git Repository

...