Introduction
JS7 offers JS7 - Inventory Git Integration for JS7 - Rollout of Scheduling Objects.
- The setup of a local repository is explained in the following sections.
- Git access includes authentication with a Git Server and accessing remote repositories as described in JS7 - How to set up Git Access.
The steps to set up a local Git repository can be applied manually from the JOC Cockpit or from a Git Client and they can be applied by use of the JS7 REST Web Service API.
Location
Sub-directories for Git repositories are located in the JOC Cockpit configuration directory:
- for Unix:
/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:
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.
The JOC Cockpit configuration directory can be different from the above examples as it is specified during installation of JOC Cockpit.
Setup using JOC Cockpit
The steps for setting up a local Git repository are explained in 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 in the file system with the same name,
- this folder is created when setting up the repository otherwise it will be created by the JOC Cockpit the first time that objects are to be stored to the repository.
There are a number of ways of achieving this with a Git Client:
# Navigate to 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 wish to automate the steps required to set up a local Git repository can use the following resources:
- The JS7 - REST Web Service API allows to perform the same operations for Git integration as offered from the JOC Cockpit GUI.
- The JS7 - PowerShell Module offers simplified access to the REST Web Service API for scripting purposes.
- Execution of the PowerShell examples with the
-debug
option might prove to be instructive for logging REST API calls.
- Execution of the PowerShell examples with the
The documentation for the relevant cmdlets is available in the PowerShell CLI 2.0 - Cmdlets - Git Repository Integration article.
FEATURE AVAILABILITY STARTING FROM RELEASE 2.3.0
The example below assumes that:
- a top-level
Accounting
folder 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,
# Connection Import-Module JS7 Connect-JS7 -Url http://root:root@localhost:4446 -Id 'Controller' | Out-Null # Clone Git repository Invoke-JS7GitRepositoryClone -Folder '/Accounting' -Url 'git@github.com:sos-berlin/js7-demo-inventory-rollout-test.git' # Connection Disconnect-JS7
Explanation:
- Line 2-3: The JS7 PowerShell Module is loaded and the connection to the JOC Cockpit is established, see JS7 - How to connect to JOC Cockpit using the PowerShell Module.
- Line 6: The Invoke-JS7GitRepositoryClone cmdlet is used. The Git repository URL is explained in the JS7 - Inventory Git Integration, chapter: Clone Git Repository article.
- Line 9: The connection to JOC Cockpit is closed.