Versions Compared

Key

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

Table of Contents

Introduction

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

  • Git access includes

...

  • authentication with

...

  • a Git Server and

...

  • accessing remote repositories.
  • The

...

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

A 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 can may look like this:

Code Block
titleExample for Git config file
linenumberstrue
Host github.com
    Hostname github.com
    IdentityFile C:\Users\me\.ssh\github_rsa
    IdentitiesOnly yes

Explanation:

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

Git Configuration Items

...

Code Block
titleExample for Git config file
linenumberstrue
# 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 whish wish to automate the steps to set for setting up Git access can use the following resources:

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

Display feature availability
StartingFromRelease2.3.0
The Add-JS7GitCredentials cmdlet allows to store Git credentials with JOC Cockpit like this

Code Block
languagepowershell
titleExample for use of PowerShell cmdlets
linenumberstrue
# parameterizationParameterization
$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

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

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

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


# removeRemove Git credentials
Remove-JS7GitCredentials -Server $gitServer

# Connection
Disconnect-JS7


Explanation: