Create Application via STK CLI
Overview
In StackSpot, an Application is any source code that implements business rules, such as classes, methods, library imports, or the code of a minimally functional Application.
Applications are developed within Workspaces, using tools such as Plugins, Stacks, Starters, or available Workflows, which make the development and delivery of solutions faster and simpler.
It is not possible to create an Application using a Starter that is marked as deprecated.
In StackSpot, you can create Applications in two ways:
- STK CLI
- StackSpot EDP Portal
To create an Application, you must use a Stack and either a Starter or a Workflow.
The following steps show how to create Applications using Workflows through the STK CLI.
Prerequisites
Before you begin, make sure you have:
- STK CLI installed and membership in a Workspace.
- You are logged in to your StackSpot account in the STK CLI.
- Access to a Studio.
- A Stack with a Starter and a Workflow of type
createorstarter, created and ready to be used. - Environments created in your StackSpot account.
- Deployment via Self-Hosted Runtime configured to connect environments to your Cloud Account.
- A Source Code Management (SCM) system configured in your organization, with SCM integration set up.
- A Personal Access Token (PAT) for your SCM, configured under External Connections, according to your account administrator’s guidelines.
If you do not meet any of the prerequisites above, pause this guide and use the corresponding link to complete the pending setup before continuing.
Step-by-Step: Creating an Application via STK CLI with a Workflow
Step 1. In your terminal, select the Workspace you want to use to create the Application. Run:
stk use workspace
The Workspaces in your account will be listed in the terminal. Select the Workspace and press Enter.
To list all available Workspaces in the terminal, run stk list workspace. The Workspace currently in use is marked with an asterisk.
You can also check this in the StackSpot Portal, in the Workspaces section.
Step 2. To create the Application using a Workflow, run:
For Studio, Stack, and Workflow names, always use the slug. The slug is the name registered in the StackSpot EDP Portal. The displayed name may differ from the slug, which can cause errors when creating the Application via STK CLI.
stk create app <APP-NAME> --workflow <STUDIO-SLUG>/<STACK-SLUG>/<WORKFLOW-SLUG>
Example:
stk create app app-with-workflow --workflow studio-name/stack-name/workflow-create-app
- If the
--workflowargument is provided, the CLI will run the specified Workflow of typecreateorstarter. - The Workflow is responsible for all steps, including applying Plugins, configuring inputs, and any additional logic defined in the Workflow.
- If both
--starterand--workflowarguments are provided, the CLI will return an error because they are mutually exclusive.
Answer the Workflow prompts in the terminal. When the process finishes, your Application will be created.
If you want to create the Application folder (directory) in a different location or with a different name, use the --target or -o parameter.
Example:
stk create app app-with-workflow \
--workflow studio-name/stack-name/workflow-create-app \
--target /home/user/Applications/my-app
Step 3. Now register your Application in your StackSpot account. First, go to the Application directory:
cd <application-name>
Then, run the command to register it:
stk register app
Answer the prompts:
- Repository URL: provide the repository that will store your Application code.
- Base branch: provide the branch to be used in the repository.
You can now see your Application details in your Workspace in the StackSpot Portal, under the Applications section, and check the Workflow execution in the Activities section.
Your Application has been created and registered successfully!
- The infrastructure deploy for the Application only happens at this moment if your organization has configured deploy via Self-Hosted Runtime.
- You must deploy the Application itself using your pipeline or a Workflow of type deploy and register the deploy in the StackSpot EDP Platform to monitor logs in the Activities page. See the full process in the Application deploy registration section.