Git Integration¶
MIKE Workbench supports Git integration so that scripts (.py files) and spreadsheets (.xlsx and .xls files) can be imported into the script manager and the spreadsheet manager of MIKE Workbench.
Two types of Git repositories are supported:
GitHub¶
GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.
To create a GitHub account, create repositories and upload scripts and spreadsheets to GitHub, please refer to the GitHub tutorial here: https://guides.github.com/activities/hello-world/
Visual Studio Team Services¶
Visual Studio Team Services (VSTS) provide an integrated, collaborative environment that supports Git, continuous integration, and Agile tools for planning and tracking work.
In order to use the integration, Team Services must be configured, so that public access to the service is available e.g. https://contoso.visualstudio.com
Please refer to Microsoft online documentation on how to configure VSTS (https://www.visualstudio.com/en-us/docs/about-vsts-tfs).
Configuring MIKE Workbench for using Git Repositories¶
MIKE OPERATIONS requires information about the Uri of the Git Repository and a personal access token.
GitHub¶
The following settings must be specified in order to access GitHub repositories:
- SC Uri
The GitHub API Uri (https://api.github.com).
- GitHub Organization
The organization managing the repositories in GitHub.
- GitHub Repository (optional)
Repository name to restrict access to. If this setting is not specified, all
repositories of the organization is shown.
- SC Personal Access Token
Personal Access Token giving access to the GitHub repositories.
Please refer to the GitHub help for more information about creating Personal
Access Tokens.
https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
Visual Studio Team Services¶
This information must be added to the Global Settings of the System Manager in MIKE WORKBENCH.
Add the following two settings (case sensitive): - SC Uri - SC Personal Access Token
The personal token can be extracted from VSTS going to the User Security Settings.
Using Git¶
The integration to Git is available in the Script Explorer from the Script Scripts perspective.
Right click a group or the root node, and select “Import from Git”.
A dialog with a tree view containing the projects (Git Repositories) available will be shown.
Import Folder¶
From the context menu of a Tree node, it is possible to import all Python scripts (.py) and spreadsheets (.xlsx and .xls) into the script manager and spreadsheet manager.
If a script group has been selected, the scripts and spreadsheets of the source control folder, will be imported into the selected group path in the both the script- and spreadsheet explorers. If the root node of the script explorer is selected, scripts and spreadsheets are imported into the same relative group in the explorers, as the folder selected in the Git repository.
In the below case, the destination group is “/Alerting/DataImport/Timeseries/YR Forecast”.
Note that the import folder functionality is not able to overwrite existing entities. This means that the import will fail if a script or spreadsheet with the same name is already present in the group.
File Options¶
Using the context menu of a file, it is possible to view the file, get a script or see the history of a file.
View File¶
Select view file to open the file using the associated application.
Get Script¶
For .py files, it is possible to import the script into the script manager.
Script functions will be placed in the selected script group of the script manager.
History¶
“View history” will show the check-in history of the file.