Sandbox TeamCity Plugin
The CloudShell Sandbox TeamCity Plugin provides an easy way to consume CloudShell sandboxes through TeamCity for a variety of use cases. The plugin allows you to create build configurations that create on demand sandboxes in CloudShell based on pre-defined blueprints.
This plugin requires CloudShell 8.0 or later and TeamCity 10 or later. Depending on the plugin version, some features may require a specific version of CloudShell.
- Download the CloudShell Sandbox TeamCity Plugin from this repository's releases page.
- Upload the qsSandbox.zip file to the TeamCity data/plugins/ folder (restart is needed).
The CloudShell Sandbox TeamCity Plugin leverages CloudShell Sandbox API to perform operations in CloudShell. CloudShell Sandbox API comes out of the box with the CloudShell Suite installation and should be fully installed and configured for the plugin functionality. Note that the TeamCity plugin only interacts with public blueprints.
When configuring the CloudShell Sandbox API, you will need to set the API port (82 by default). To see the port, open the CloudShell Configuration application and click CloudShell Sandbox API.
After installing the plugin, perform the following steps:
- Navigate to the TeamCity Administration page and open the CloudShell Sandbox tab.
- Enable the CloudShell Sandbox plugin.
- Set the CloudShell Sandbox API Host Address to the machine where CloudShell Sandbox API is installed. Note that this may be a different machine than the Quali Server.
Specify the credentials (user, password, domain) of the CloudShell user you would like to use for CloudShell operations. We recommend creating a new CloudShell admin user for TeamCity.
To verify your configurations, click the Test Connection. TeamCity will interact with CloudShell to validate connectivity and credentials.
CloudShell Build Steps
The plugin adds several new build steps to TeamCity to streamline interactions with CloudShell sandboxes.
CloudShell Sandbox is a generic build step that contains CloudShell Actions you can execute. Each action contains several inputs. Currently, the Start sandbox and the Stop Sandbox actions are provided and we plan to support others in the future.
The Start Sandbox action creates a new CloudShell sandbox based on the selected public blueprint and restricts interaction with the sandbox while it is running Setup. This ensures the sandbox Setup process completes successfully without any outside interference. When the sandbox is active, the sandbox’s Id and additional information become available in %SANDBOX_ID%. This environment variable can be used in other steps in the build configuration.
Note that the Sandbox duration in minutes field specifies the maximum duration of the sandbox. If the build does not end before the specified duration, CloudShell will tear down the sandbox.
The Blueprint parameters field allows you to specify user inputs, which can be used for resource selection (if the blueprint contains abstract resource requirements), as additional information to drive the provisioning, or as general information. For more information, see CloudShell Help.
CloudShell Build feature
CloudShell sandboxes can also be consumed as a TeamCity build feature. Using sandboxes as a build feature enables easy interaction with the sandbox and suites a use case where only one sandbox is needed for this build configuration.
To use the CloudShell bulid feature:
- Add The CloudShell Sandbox build feature from the build features list.
- Fill in all required fields.
- Click Save.
When the sandbox is active, the sandbox’s Id and additional information become available in %SANDBOX_ID%.