Integrate Myst CLI with Studio
Last updated
Last updated
The MyST CLI is used by MyST Studio behind-the-scenes to execute operations against target environments. However, the MyST CLI can also be used to trigger operations against data from MyST Studio. This can be useful in some cases such as:
When you require the execution of MyST to be performed from a third party tool such as Jenkins, Puppet or Chef but wish to maintain the change audit history and platform configuration details within MyST Studio
When you are already using MyST CLI with Jenkins (or another CI server / configuration management tool) and want to phase the migration to MyST Studio. For instance, you may wish to continue to use Jenkins as the frontend in the short term while the configuration data is migrated to Studio.
When you have a complex deployment process and require ultimate control over the artifact deployment ordering sequence and how it interoperates with other deployment steps that sit outside MyST.
Login to MyST Studio with an administrator account
Click on "Administration" then select "Users"
Under the MySTAdministrator (API User) click on drop-down and select "Show API Key"
Copy the key, we will use this later in our MyST workspace. If you want, you can generate a new key at any time.
MyST CLI has the concept of a MyST workspace which is a metadata directory that can be version controlled. In this example we will use Git.
For non-Studio customers, the MyST workspace is used for storing Platform Blueprint and Models in XML or Properties format. For Studio customers, the Platform Blueprints and Models are version-controlled in the MyST Studio repository. Platform Blueprints and Models can be retrieved from MyST Studio by defining MyST Studio connectivity details within the MyST workspace. Common use cases for this approach are:
Creating CI server jobs that perform operations using configuration data from MyST Studio
Using a hybrid of configuration and deployment data from a version control system like Git and MyST Studio (e.g. Secure platform connectivity details are stored in MyST Studio but the deployment data is stored on the file system in the MyST workspace)
Creating MyST custom action extensions which use configuration data from MyST Studio.
If you don't have an existing MyST workspace, you can create and version control one as follows:
1 . Create a new folder for our MyST workspace.
2 . Navigate to the myst-workspace and initialize it using MyST
This will provide an output similar to the following:
3 . Create a file relative to the myst-workspace at resources/myst.properties
Add the details for your MyST Studio instance and include the API key that you copied before:
4 . Run the following command to display the myst usage
This should retrieve all of the available Platform Models from MyST Studio. These platform models are named in the following convention:
env.<environment type>.<platform model>.platform
For example:
Take note of the Platform Model which you want to use.
5 . You can execute the MyST properties action on your platform model of choice by performing the following:
This will display all of the properties of the given Platform Model.
6 . Lastly, version control your MyST workspace using your Version Control System of choice. In this example, we are using Git
NOTE: From the previous execution there will be a logs directory created under myst-workspace. You should avoid version controlling this file by following the steps above to only version control the conf and resources directories.
To see a full list of MyST actions, you can execute myst usage
from the MyST workspace.
MyST actions executed from the MyST CLI with MyST Studio data follow the standard below: