Workpace configuration is not applicable when using non-systemd enabled Windows with WSL 2 currently.
As described in local repository creation, support is provided for:
- A local cap-xml repository to be placed in a location other than /opt/workspaces/ when using macOS and native Linux/systemd enabled WSL 2 with native Docker.
- Running/debugging code in a development container created by cloning the remote cap-xml repository into a container volume when using native Linux.
In these scenarios an, environment variable configured shell script is provided to create a symbolic link from /opt/workspaces/cap-xml/ to the local repository root.
Local cap-xml repository placement somewhere other than /opt/workspaces/ results in the following path being used for code location when running debugging:
- /opt/workspaces/cap-xml (symbolic link) -> /path/to/local/cap-xml/repository.
Remote repository cloning into a container volume results in one of the following paths being used for code location when running/debugging (depending on the local cap-xml repository location):
- /workspaces/cap-xml (symbolic link) -> /opt/workspaces/cap-xml (local repository)
- /workspaces/cap-xml (symbolic link) -> /opt/workspaces/cap-xml (symbolic link) -> /path/to/local/cap-xml/repository.
| name | description |
|---|---|
| LOCAL_CAP_XML_DIR | The absolute path to the root of a local cap-xml repository. |
link-workspace-folder-on-host-to-local-repository.sh must be run as root before attempting to create a development container. This script validates the mandatory environment variables and exits if configuration issues are detected. If no configuration issues are detected, the following actions are performed to allow a development container to be created from either a local cap-xml repository or by cloning the remote cap-xml repository into a container volume:
- Ensure the directory /workspaces exists on the host.
- This is required to locate code for running/debugging when cloning the remote cap-xml repository into a container volume.
- Ensure a symbolic link from /workspaces/cap-xml/ to /opt/workspaces/cap-xml/ exists.
- This is required to locate code for running/debugging when cloning the remote cap-xml repository into a container volume.
- Ensure a symbolic link from /opt/workspaces/cap-xml to LOCAL_CAP_XML_DIR exists if the two locations differ.
- This is required to locate code for running/debugging regardless of how a development container is created:
IMPORTANT - If link-workspace-folder-on-host-to-local-repository.sh is run using the sudo command, the user session from which the sudo command is run must ensure that the mandatory environment variable is available to the script. This is because user session environment variables are not available to a sudo command by default. For example, if the environment variable is available to the user session running the sudo command, it can be preserved for availability to link-workspace-folder-on-host-to-local-repository.sh using the following sudo command:
sudo --preserve-env=LOCAL_CAP_XML_DIR "$LOCAL_CAP_XML_DIR"/docker/scripts/link-workspace-folder-on-host-to-local-repository.sh