Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{jenkins-plugin-info:cloudshell-sandbox}

 


Introduction

The CloudShell Sandbox Jenkins Plugin provides an easy way to consume CloudShell sandboxes through Jenkins for a variety of use cases. The plugin allows you to build jobs that create on demand sandboxes in CloudShell based on pre-defined 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.

 

 


The Quali Configuration web interface is displayed, showing the Sandbox API configurations.

 

 

 



Distributed architecture:

 

 


Configuration

After installing the plugin, perform the following steps:

...

CloudShell Build Step is a generic step that contains CloudShell Actions you can execute. Each action contains several inputs. Currently, the action Start sandbox is 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 and $SANDBOX_DETAILS, respectively. These environment variables can be used in other steps in the build.

...

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.

The Domain name field allows you to define a domain from which to create your sandbox in CloudShell. If this field is not populated, the domain defined in the Configuration step is used.

For more information about a field, click that field’s help icon on the right.

 Alt textImage RemovedImage Added

 

We recommend using the “Start Sandbox” action as a pre-run step to ensure the sandbox is created before the actual build steps are executed.

 

Here is an example of how to print the sandbox information for future use:

 Alt text

 


To end the sandboxes that have been created in the build, use the Stop CloudShell sandboxes post-build action. Since this is a post-build action, it can be used only once per build and will end all sandboxes created by that build. This step ensures that the sandbox Teardown process completes successfully and checks the sandbox’s Activity Feed to validate that there are no errors in the sandbox activity log.

 Alt text

 


Pipeline Steps and Syntax

...

Code Block
languageruby
    stage ('Performance Testing'){
        Id = startSandbox duration: 13, name: 'Performance', params: 'os=Win; server=4'
        sh 'python .\Perf2.py --sandbox_id Id'
        stopSandbox  Id
    }

 


Note: The WithSandbox step implements the same logic as in startSandbox and stopSandbox but in a contextual syntax. This step is recommended for demos but not suitable for production.

We recommend using the Jenkins pipeline’s Snippet Generator which allows you to compose pipelines with an easy-to-use UI instead of having to write code. For example:

Alt text

 


Features

This table lists the plugin features that are supported per CloudShell version:

...

The plugin is an open source project under the MIT License. We encourage users to contribute, add pull requests and open issues.