Introduction

JS7 offers JS7 - Inventory Git Integration for JS7 - Rollout of Scheduling Objects.

The steps for setting up access to a Git Server can be applied manually and can also be applied by using the JS7 REST Web Service API.

Manual Setup

Git Configuration File

JOC Cockpit uses a Git client which reads configuration items from the following file (assuming a user account me is in place)

  • for Unix environments:
    • /home/me/.ssh/config
  • for Windows environments:
    • C:\Users\me\.ssh\config

The Git config file may look like this:

Example for Git config file
Host github.com
    Hostname github.com
    IdentityFile C:\Users\me\.ssh\github_rsa
    IdentitiesOnly yes

Explanation:

  • The settings map the use of a private key file to authentication with a Git Server.

Git Configuration Items

A typical configuration step performed with a Git client looks like this:

Example for Git config file
# Specify user name
git config --global user.name "My Account"

# Specify e-mail address
git config --global user.email "myAccount@example.com"

# Use simple merge strategy
git config --global push.default simple

Automation with the JS7 REST Web Service API

Users who wish to automate the steps for setting up Git access can use the following resources:

The documentation for related cmdlets can be found in PowerShell CLI 2.0 - Cmdlets - Git Repository Integration.

FEATURE AVAILABILITY STARTING FROM RELEASE 2.3.0

Example for use of PowerShell cmdlets
# Parameterization
$gitServer   = 'github.com'
$gitAccount  = 'myAccount'
$gitUserName = 'My Account'
$gitUserMail = 'myAccount@example.com'
$gitKeyFile  = 'myKey.rsa'

# Connection
Import-Module JS7
Connect-JS7 -Url http://root:root@localhost:4446 -Id 'Controller' | Out-Null

# Use of private key file
Add-JS7GitCredentials -Server $gitServer -Account $gitAccount -KeyFile $gitKeyFile -UserName $gitUserName -UserMail $gitUserMail

# Use of access token (similarly insecure as use of passwords)
# Add-JS7GitCredentials -Server $gitServer -Account $gitAccount -AccessToken 'a1b2c3d4e5f6g7h8' -UserName $gitUserName -UserMail $gitUserMail

# Use of password (denied by a larger number of Git Servers)
# Add-JS7GitCredentials -Server $gitServer -Account $gitAccount -Password (ConvertTo-SecureString 'secret' -AsPlainText -Force) -UserName $gitUserName -UserMail $gitUserMail

# Remove Git credentials
Remove-JS7GitCredentials -Server $gitServer

# Connection
Disconnect-JS7


Explanation: