Git Integration
  • 04 Jan 2024
  • Dark
    Light
  • PDF

Git Integration

  • Dark
    Light
  • PDF

Article summary

For scripts saved in Git repositories, IAG has a process to import those scripts from those various repositories.

"Git" refers to the use of GitHub, GitLab, Bitbucket, and other Git-based code integration/management tools.

Git in Automation Gateway

The primary Git tab is located in the left navigation menu of Automation Gateway. Alternatively, it is also listed under the Configuration tab.

Figure 1: Git Configuration
01_Git_23_2

Configuring Git Integration

From the Configuration tab, you can click Git to display the Git Integration Configuration modal, with configuration fields for Git Exec, Git Key Path, and Git Repo Path (Figure 2).

Strict Host Key Checking is an available option that will automatically check for a known host with an SSH key. If this option is checked, further manual action is required. You will need to check the server terminal to select "Yes" if the SSH Key is a trusted key.

Figure 2: Git Integration Configuration
02_Git_path_23_2

How to Create an SSH Key

When you click the Git tab in the left navigation menu of Automation Gateway, a dropdown list for SSH Keys, Integrations, and Repositories displays.

Figure 3: Git Menu List
03_Git_Nav_Options_23_2

To add a SSH key, click the "+" in the top toolbar to open the Create dialog box. Scroll down and select Git SSH Keys.

Figure 4: Create an SSH Key_
04_Git_add_SSH_23_2

Enter a name for the key under Generate SSH Key. Then click the Generate button.

Figure 5: Name the SSH Key
05_Git_add_SSHKey_23_2

An SSH Key will be generated and a message banner displays in the upper right corner to indicate the SSH key pair was successfully generated. Next, click on SSH Keys in the left navigation bar. The newly generated key will display in the Public Key box with the name it was given. Users will be able to view the SSH Key as well as use it to copy/paste into Git.

Figure 6: View the SSH Key
06_Git_Test_Key_23_2

How to Add an SSH Key

After creating the key, go to your Git CI/CD platform (e.g., GitLab) and access the appropriate section to setup your SSH Keys.

In GitLab, click Add an SSH Key and paste the generated key into the Key box provided.

Figure 7: Paste the SSH Key
07_Git_Add_SSH_23_2

Enter a key Title (name). Click Add Key. Both IAG and Git now have the same SSH Key.

Making the key title the same name as the SSH Key created in Automation Gateway will help identify what the key was created for.

Figure 8: Adding the SSH Key
08_Git_Title_23_2

How to Create a Git Integration

From Automation Gateway, click Integrations in the left navigation. A list of any created Integrations will also be shown here. To create a new integration, click the "+" in the top toolbar to open a Create dialog box and then select Git Integration from the dropdown list.

Figure 9: Creating an Integration
09_Git_integration_23_2

Type in a name for the integration. Then select the name of the SSH Key that was created from above. Click Create.

Figure 10: Naming the Integration
10_Git_Int_Create_23_2

Click the name of the Git Integration in the sidenav menu to display information pertaining to the integration and the SSH Key being used. Click the search bar under SSH Key Name to display a dropdown list of names of any SSH Keys that are stored. This will allow users to change the integration to another key that has been created. Click Save at the bottom of the page to keep any changes that were made.

Figure 11: Git Integration Information
11_Git_Int_23_2

How to Create a Git Repository

Click the "+" in the top toolbar to open the Create dialog. Scroll down the list and select Git Repository and then click Create.

Figure 12: Creating a Git Repository
12-Git_Repo_23_2

Select the integration (name) that was created above and enter a name for this Repository. Copy the SSH Key from Git (i.e., use the Clone button in GitLab) and paste it into the Repository field. Next, choose the necessary code branch (in this case it is called "master"). This will be the location on the server where the Repository is stored. In the example below, /opt/automation-gateway/repos/iag-repo/ is the location where the integration can be found. To clone and download the repository, click Create.

Figure 13: Naming the Repository
13_Git%20Repo_info_23_2

Next, click on the Repository tab in the left navigation menu and the repository name will be displayed. Click on the repository name to view information related to the repository and the Remote Fingerprint will display a unique identifier for the Host Key Check In. In the example below multiple Host Keys have been added and are shown for the Host Key Check In.

Figure 14: Viewing the Host Key
14_Git_Repo_Host_Key_23_2

Repository Controls

In the footer (under the Remote Fingerprint), there are repository controls (buttons) where users can Pull repo data, Reset repo data (if making any changes locally on the server. Resetting will go back to the last commit.), Delete data, or Reset the Fingerprint (this will remove the data shown under the Remote Fingerprint).

Figure 15: Repository Controls
15_Git_Repo_Options_23_2

How to Import Script Configurations

If users are importing scripts (as shown in Figure 16), copy the File Path from the repository that was created. For example: /opt/automation-gateway/repos/iag-repo/. Open the tab for Scripts in the left side navigation. Paste the file path under Scripts Paths. Click the Save icon at the top. IAG will now be able to find all of the scripts in that directory.

Figure 16: Scripts Path
16_Scripts_23_2

How to Import Decorations

Importing Decoration scripts into the repo is an efficient way to save time without having to make edits to the Decorations.

Go to Configurations in the left hand navigation and click Scripts. Under the Parameters tab, various Decorations will be shown. Select a Decoration and click the pencil icon to edit it. The Decoration is a script built from a JSON object with type, item, and arguments that will get passed on when the Decoration is used.

Figure 17: Decorations
17_Decorations_23_2

When a Git Pull is done, the Decoration pattern will be found using the file name (example: C_demo.scripts.iag.json). The parameters will be imported into IAG and saved to the database. Anytime there is a Git Pull from the repo, the decorations are saved into the Database and can be located by their unique name attached to scripts.iag.json.

if the script, playbook, or module is not named with this exact suffix (e.g., name.type.iag.json), it will not be imported on a Git Pull.

Figure 18: File Name
18_file_name_23_2

⚠ Warning:

Collection modules are not supported and cannot be decorated automatically for a Git Pull.


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.