Integrate with Git
By default, the source code for a persistent query in the "Script Editor" tab is stored by the Persistent Query Controller as part of the query's configuration. However, with Git integration, a persistent query's source code isn't stored in Deephaven, but loaded directly from its associated Git repository.
Note
Configuring Git Integration
To enable Git integration, several properties must be set in the Deephaven controller's configuration. One global property must be set, followed by several properties for each repository.
The global property is:
iris.scripts.repos
— a comma-separated list of git repositories that Deephaven should use.
The additional properties for each repository are listed below:
-
iris.scripts.repo.<repo_name>.groups
— a comma-separated list of the Deephaven groups who may access the repository. -
iris.scripts.repo.<repo_name>.updateEnabled
— Set totrue
to automatically update the repository (i.e., run a git pull) once per minute. This helps ensure that when a query runs, it uses the most recent version of the script available in the repository's remote origin. -
iris.scripts.repo.<repo_name>.branch
— the Git branch to check out; if this is not set, the controller'sPersistentQueryController.defaultBranch
property value is used. -
iris.scripts.repo.<repo_name>.prefixDisplayPathsWithRepoName
— Iftrue
, the "Choose Script" dialog of the Persistent Query Configuration Editor will include the repository's name next to each script path. This helps disambiguate scripts for users who have access to multiple repositories. -
iris.scripts.repo.<repo_name>.root
— the directory on the filesystem into which Deephaven will clone the git repository. Each repository must have a distinct root directory. If a relative path is used, the path will be relative to the workspace directory of the Controller process. On Deephaven servers, this will normally be/db/TempFiles/irisadmin/iris_controller
. -
iris.scripts.repo.<repo_name>.paths=IrisQueries/groovy,IrisUtils/groovy
— the paths, relative to the repository's root directory, to include. Files in all other paths will not be available to Deephaven queries. -
iris.scripts.repo.<repo_name>.uri
— the SSH URI used to access the git repository, such asgit@git.illumon.com:illumon/iris.git
.Note: The fingerprint of the RSA key for the server specified in this URI must be in the ssh known hosts file for the user the controller runs as. In a typical installation, the controller runs as the
irisadmin
user, and the appropriate known hosts file is~irisadmin/.ssh/known_hosts
. For example, if the git URI is"git@gitlab.mycompany.net:mycompany/iris.git"
, the Git server can be added to the to the known hosts file with the following command:sudo -u irisadmin /bin/sh -c 'ssh-keyscan -t rsa gitlab.mycompany.net >> ~irisadmin/.ssh/known_hosts'
It is prudent to print the received key and verify that it matches the server. The key that was added can be viewed with this command:
sudo -u irisadmin tail ~irisadmin/.ssh/known_hosts
Also, for repository updates (i.e., git pull) to be enabled, the Persistent Query Controller must not be configured to use a local git repository.
-
PersistentQueryController.useLocalGit
— Optional — Set totrue
to use a local repository as the script source. This disables repository updates globally, regardless of each repository's updateEnabled setting. The default value is false, causing Deephaven to check out the configured branch from the remote.
Example Configuration
The example configuration below configures Deephaven to read scripts from three repositories: team1, team2, and shared. All users can access scripts in the shared repository, but the team1 and team2 repositories are restricted to specific users. All three repositories will use a branch called master.
iris.scripts.repos=shared,team1,team2
iris.scripts.repo.shared.groups=*
iris.scripts.repo.shared.updateEnabled=true
iris.scripts.repo.shared.branch=master
iris.scripts.repo.shared.prefixDisplayPathsWithRepoName=false
iris.scripts.repo.shared.root=../git/shared
iris.scripts.repo.shared.paths=IrisQueries/groovy,IrisUtils/groovy
iris.scripts.repo.shared.uri=git@git.mycompany.net:common-libs/shared.git
iris.scripts.repo.team1.groups=user1,user2,user3
iris.scripts.repo.team1.updateEnabled=true
iris.scripts.repo.team1.branch=master
iris.scripts.repo.team1.prefixDisplayPathsWithRepoName=false
iris.scripts.repo.team1.root=../git/team1
iris.scripts.repo.team1.paths=IrisQueries/groovy
iris.scripts.repo.team1.uri=git@gitlab.mycompany.net:team1/team1.git
iris.scripts.repo.team2.groups=user1,user4,user5
iris.scripts.repo.team2.updateEnabled=true
iris.scripts.repo.team2.branch=master
iris.scripts.repo.team2.prefixDisplayPathsWithRepoName=false
iris.scripts.repo.team2.root=../git/team2
iris.scripts.repo.team2.paths=IrisQueries/groovy
iris.scripts.repo.team2.uri=git@gitlab.mycompany.net:team2/team2.git