Execute a Script in a Git Repository

Overview

Scripts can be executed from a file that is located in a Git Repository. You may have a Git workflow used to import multiple files from a Git source that you would like to execute in Loome Integrate.

You can select a file available in your Git Repository to execute in one of the following scripting task types: SQL Statement, Python, Powershell and OS Command. The following is a guide on creating a scripting task using a script in a Git Repository as a source.

How do I source a script from my Git Repository?

First, please configure your Git Repository Connection so that this task will have access to your script file, as shown in the next section below. We recommend that you use a Personal Access Token for your Git Repository Connection, and we have a guide on how to create one here.

How do you create a Git Repository Connection?

On the Connections page, please click on Add Connection.

Type in the name of your connection in Connection Name.

Select Git Repository as your connection type.

Select 'Git Repository'

On the next page, please complete the details of the Git Connection as the table below.

The required fields to source a script from a Git connection

Field Value
Username Your Username
Password Your Personal Access Token (this is recommended, you can learn how to create one here) or your password
Branch Type in the name of the branch where the script is located.
Git Repository URL The URL of your Git Repository. (This is the URL you use to clone the repository, demonstrated in the note below)

In Azure DevOps, you can retrieve the URL of your Git Repository by clicking the “Clone” button in the top right of the Repos page. azure devops clone

Please click Submit to create the connection.

Next, please validate this connection with an agent.

Please also follow the next guide to configure a file definition that points to the path of the folder in your Git Repository, containing the scripts that you want to execute.

Configure a File Definition for your Script

To create a File Definition for a script task, please click File Definitions in the top right menu dropdown, and then click Add a file definition.

Please select the Script Directory type from the dropdown.

Then please provide the file path for your script, and then the extension you want to use.

For example, if you want to run all SQL scripts in the /scripts directory you would use the following definition.

Add a Script File Definition

We currently only support executing all scripts in a directory, we’ll be providing the ability to pick a specific script soon.

Once you click on Submit, please validate this file definition with an agent.

Configure a task to use your script as source

In a new or existing job, please add a task and select its name and agent.

Then choose a scripting task of SQL Statement, Python, PowerShell or OS Command.

For this example, I have selected PowerShell Core.

Selecting a file to execute a script

In order to select a file from Git, for Script Source please select File Connection.

For the Git Repository Connection field, please select your Git Repository.

The Script Folder Path field will display your File Definitions. Select the folder that your file is located in from the dropdown. This is where you will use the file definition we created earlier, which points to the path of the folder that contains the scripts that you want to execute.

Submit your task and when you run this job, the task should execute the script in your Git Repository file.