Versions Compared

Key

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

Table of Contents

Introduction

Continuous Integration / Continuous Delivery (CI/CD) is a supported method JS7 offers JS7 - Inventory Git Integration for JS7 - Rollout of Scheduling Objects.

  • The scenario is described with the JS7 - Git Repository Interface.setup of a local repository is explained with the following chapters.
  • Git access includes to authenticate with a Git Server and to access remote repositories, see JS7 - How to set up Git AccessCI/CD includes to perform the following steps
  • in a test environment
    • to set up a local Git repository that is used by JOC Cockpit.
  • in a prod environmentto set up a local Git repository that is used by JOC Cockpit.

The steps to take for setup of set up a local Git repository

  • are not necessarily related to use of PowerShell as any Git client can be used. The following explanations are provided as examples.
  • are performed similarly for test and prod environments.

Set up a local Git Repository

Location

can be manually applied and can be applied by use of the JS7 REST Web Service API.

Location

Sub-directories Directories for Git repositories are created located in the JOC Cockpit configuration directory:

  • for Unix to the directories:
    • /var/sos-berlin.com/js7/joc/jetty_base/resources/joc/repositories/local
    • /var/sos-berlin.com/js7/joc/jetty_base/resources/joc/repositories/rollout
  • for Windows to the directories:
    • C:\ProgramData\sos-berlin.com\js7\joc\jetty_base\resources\joc\repositories\local
    • C:\ProgramData\sos-berlin.com\js7\joc\jetty_base\resources\joc\repositories\rollout

The local and rollout sub-directories are used to hold the respective repository types, see JS7 - Git Repository Interface.

Directories The JOC Cockpit configuration directory can be different from the above examples as they are it is specified during installation of JOC Cockpit.

Setup using JOC Cockpit

The steps to set up a local Git repository are explained with the JS7 - Inventory Git Integration, chapter: Clone Git Repository article.

Setup using a Git Client

The below example assumes that 

  • a top-level folder Accounting is used in the JOC Cockpit inventory,
  • this folder is mapped to a sub-directory with the same name and spelling in the file system,
  • this folder is created when setting up the repository otherwise it will be created by JOC Cockpit the first time that objects should be stored to the repository.

There are a number of ways how to achieve this with a Git Client:

Code Block
languagepowershell
titleExample how to set up a local Git repository
linenumberstrue
# Navigate Findto the repository sub-directory managed by JOC Cockpit
cd /var/sos-berlin.com/js7/joc/jetty_base/resources/joc/repositories/rollout/Accounting

# Run Git commands
git init
git branch -M main
git remote add origin git@github.com:sos-berlin/js7-demo-inventory-rollout-test.git
git push -u origin main

Automation with the JS7 REST Web Service API

Users who whish to automate the steps to set up a local Git repository can use the following resources:

Find the documentation for related cmdlets from PowerShell CLI 2.0 - Cmdlets - Git Repository Integration.

Display feature availability
StartingFromRelease2.3.0

The below example assumes that 

  • a top-level folder Accounting is used in the JOC Cockpit inventory:
    • the folder will be used if it exists,
    • the folder will be created if it doesn't exist.
  • the folder is mapped to a sub-directory with the same name in the file system,


Code Block
languagepowershell
titleExample for use of PowerShell cmdlets
linenumberstrue
# Connection
Import-Module JS7
Connect-JS7 -Url http://root:root@localhost:4446 -Id 'Controller'

# Clone Git repository
Invoke-JS7GitRepositoryClone -Folder '/Accounting' -Url 'git@github.com:sos-berlin/js7-demo-inventory-rollout-test.git'

# Connection
Disconnect-JS7


Explanation: