Managing shared configurations
The analyze-deployment-tooling repository enables you to share a configuration or deploy a configuration that has been shared with you.
The shared configurations are recommended to be stored in a source control system such as Git. When you clone the shared configurations to your machine, they are cloned to a directory outside of the analyze-deployment-tooling project and then referenced.
To use a shared configuration in your environment, you provide the file path to the directory outside of the analyze-deployment-tooling project. Then, you choose which configs or assets to link to your environment.
When you use a source control system to manage the shared configurations, use VS Code to manage the repositories that they are contained in.
Prerequisites
Before you create or use a shared configuration, you must configure the analyze-deployment-tooling repository and create the dev environment:
- Getting started with the analyze-deployment-tooling repository
- Configuration development environment
- You do not need to create a config.
Configuring your shared repositories location
Open a terminal on your host machine.
- On Windows, use a WSL terminal. Press Start -> wsl
Navigate to the
analyze-deployment-tooling/scripts
directory.Run the
configure-paths
script with theshared
task.
For example:configure-paths -t shared
By default the script creates a folder named
my-configurations
in your home directory For example/home/<user>/my-configurations
. To specify a different path, use-p <path>
with your path when you run the command.Reopen the analyze-deployment-tooling folder in a dev container.
Press F1 (or Cmd+Shift+P in MacOS), typeDev Containers: Rebuild Container
and select it.
After you have run the script, you can open the shared configurations folder in VS Code. In the same terminal as step 1, navigate to your shared configuration folder and open VS Code.
For example, navigate to the directory:
cd ~/my-configurations
Open VS Code:
code .
This VS Code window is now referred to as the
shared configurations VS Code window
.
Sharing a configuration
You can share a configuration that you have already developed locally, or you can start developing a shared configuration from a new template.
- From the analyze-deployment-tooling VS Code window right-click the
shared-repository
template and copy it to the shared configurations VS Code window. Rename the folder to provide a name for your shared configuration.- On MacOS copy the template using the Finder app.
- You can share an existing config or asset, or create a new one to share.
- If you have local configs or assets that you want to start sharing, move the configs or assets from the analyze-deployment-tooling window into the new shared configurations window in the new
shared-repository
folder. - If you are creating a new config, complete the instructions in Configuration development environment to create your config. When you copy the
config-development
template, copy it to theshared-repository
your shared configurations VS Code window.
- If you have local configs or assets that you want to start sharing, move the configs or assets from the analyze-deployment-tooling window into the new shared configurations window in the new
- To link your shared configuration into your analyze-deployment-tooling project, complete the steps in link configurations.
Note: We recommend to share your configurations through Git and the template configuration contains the files required to work with Git. To initialize the Git repository, run git init
from the terminal the shared configuration folder. For example /home/<user>/my-configurations/shared-repository
. For more information about how to use Git, see Git Reference Documentation.
Linking shared configurations
Link a shared configuration to your local environment.
The configurations that can be linked must be contained within the path specified in
rootDirectory
. If your configuration is located in a git repository, you can clone it to the shared configurations path.
For example,/home/<user>/my-configurations/shared-connectors
.
For information on how to clone a repository in VSCode, see Setting up a repository.Update the
path-configuration.json
file to reference the configuration to link:Add the paths for your repositories in the
repositories
array. The value forpath
is relative to therootDirectory
path.For example, to add the repository
/home/<user>/my-configurations/shared-connectors
thepath-configuration.json
file contains the following:{ "sharedConfigurations": { "rootDirectory": "/home/<user>/my-configurations", "repositories": [ { "path": "shared-connectors" } ] } }
In the terminal, run:
manage-environment -t link
Important: The repositories in the path-configuration.json
are updated after you run the manage-environment -t link
or the deploy
commands.
Linking specific configs or assets
You can link to specific configs or assets from a shared configuration.
- Use the
configs
key to specify an array of config names. Note: The backups associated with the config are also linked. - Use the
connectors
key to specify an array of connector names. - Use the
additionalResources
key to specify a list of additional resources. - Use the
gatewaySchemas
key to specify an array of gateway schema short names. - Use the
extensions
key to specify an array of extension names. - Use the
plugins
key to specify an array of i2 Notebook plugin names. - Use the
dataSets
key to specify an array of data set names.
For example to add the following:
law-enforcement
config and backup from theshared-config
repositoryexample-connector
andexample-connector2
connectors from theshared-connectors
repository
The path-configuration.json
file contains the following:
{
"sharedConfigurations": {
"rootDirectory": "/home/<user>/my-configurations",
"repositories": [{
"path": "shared-configuration",
"configs": [
"law-enforcement"
]
},
{
"path": "shared-connectors",
"connectors": [
"example-connector",
"example-connector2"
]
}]
}
}