Migrating Starters to Workflows
On this page, you will find a tutorial that guides you on how to leverage already published Starters in your Studio to create Starter and Create type Workflows, streamlining the creation of Applications and Infrastructures.
Before You Begin
Prerequisites
- You must have a StackSpot account;
- Be in a Studio with creation permissions;
- Have Starters already published in your Studio;
- STK CLI installed and logged in;
- Permission to create content.
Check available Starters
The following command lists all Stacks in your Studio with at least one Starter. In the command, you must provide:
- Your Studio;
- A Stack;
After selecting the Stack that contains the Starters you will use, save the "Studio/Stack" information displayed in the terminal to use later in your Starter type Workflow.
stk list starter
Example:
$ stk list starter
> Fetching information from the studios in account 'contadev'.
? Select the studio: dev-applications
> Fetching stacks from studio 'dev-applications'
? Select the stack: microservice-core
Studio/Stack: dev-applications/microservice-core@1.2.0
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Starter โ Type โ Description โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ app-microservice-module โ APP โ Starter with microservice Plugins โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Step 1. After listing in the terminal, click the Starter name while holding the Ctrl key to open the Starter's page;
Step 2. Then, click the Plugins menu;
Step 3. For each Plugin in the Starter, click the 'Open plugin details' button.
1. Create a Starter-type Workflow
With the Starter's Plugin list, you must create the Workflow that will replace your Starter when creating Applications. Follow the steps below:
Step 1. Create the Workflow Structure
Run the following command:
stk create workflow
Answer the prompts:
? Name your workflow: microservice-starter-workflow
? Workflow description: Starter-type workflow to create microservices
? Version: 1.0.0
? Select the workflow type: starter
? Do you want to initialize a git repository? No
Step 2. Configure the workflow.yaml File
Edit the generated workflow.yaml file:
Step 1. If necessary, add the Workflow inputs under the 'spec:' field;
Step 2. Create the Job that will apply the Plugins previously included in your Starter;
Step 3. For each Plugin, create a Step of type plugin and fill it out as shown in the following example:
type: Use 'plugin';
name: Name of the Plugin to be applied by the Step. Use the format: studio-name/plugin-name@1.0.0 (semantic versioning);
id: Provide an identifier name for the Step;
label: Name displayed in the Activity log screen of the Workflow;
when: (Optional) parameter to use a boolean value as a condition for Job or Step execution;
inputs: Fill in all Plugin inputs. The syntax is:
input_name: "input_value"
For more details on configuring a plugin Step, refer to the Workflow Steps documentation.
schema-version: v1
kind: workflow
metadata:
name: microservice-starter-workflow
display-name: Create Microservice with Starter
description: Workflow that uses a pre-configured starter for microservices
version: 1.0.0
spec:
type: starter
label: Microservice Starter Workflow
targets:
- app
docs:
en-us: docs/en_us/docs.md
pt-br: docs/pt_br/docs.md
inputs:
- label: Application Name
name: app_name
type: text
required: true
help: Name of the application to be created
- label: API Port
name: api_port
type: int
default: 8080
required: true
- label: Database Type
name: database_type
type: select
items:
- PostgreSQL
- MySQL
- MongoDB
default: PostgreSQL
required: true
jobs:
- id: create_microservice
label: Create Microservice Application
steps:
- id: apply_starter_plugins
label: Apply Microservice Starter Plugins
name: dev-applications/app-microservice-plugin@1.2.0
type: plugin
inputs:
application_name: "{{inputs.app_name}}"
server_port: "{{inputs.api_port}}"
db_type: "{{inputs.database_type}}"
enable_swagger: true
enable_actuator: true
Step 4. Publish your Workflow in your Studio using the stk publish workflow command.
You can run this Workflow locally only through the STK CLI using the create app command and specifying the
--workflowoption. To use it in production to create Applications and Infrastructures, follow the steps below:
2. Create a create-type Workflow
The create type Workflow will be responsible for executing the creation of your Application or Infrastructure and applying the Plugins from your starter type Workflow created in the previous section.
Step 1. Create the create Workflow structure
stk create workflow
Example:
? Name your workflow: microservice-workflow
? Workflow description: Workflow to execute app creation
? Version: 1.0.0
? Select the workflow type: create
Step 2. Configure the create Workflow
Edit the generated workflow.yaml file:
Step 1. If necessary, add the Workflow inputs under the 'spec:' field;
Step 2. Create the Job that will execute the workflow type Step;
Step 3. Fill in the Step and specify the starter type Workflow that you published in your Studio;
For more details on configuring Steps, see the Workflow Steps page.
schema-version: v1
kind: workflow
metadata:
name: microservice-workflow
display-name: Flexible Application Creator
description: Workflow that allows dynamic starter selection
version: 1.0.0
spec:
type: create
label: Flexible App Creator
docs:
en-us: docs/en_us/docs.md
pt-br: docs/pt_br/docs.md
inputs:
- label: Application Name
name: app_name
type: text
required: true
help: Name of the application to be created
- label: API Port
name: api_port
type: int
default: 8080
required: true
- label: Database Type
name: database_type
type: select
items:
- PostgreSQL
- MySQL
- MongoDB
default: PostgreSQL
required: true
jobs:
- id: job_create_app
label: "Application code creation"
steps:
- id: step_create_code
name: dev-applications/microservice-starter-workflow@1.0.0
type: workflow
inputs:
application_name: "{{inputs.project_name}}"
server_port: "{{inputs.api_port}}"
db_type: "{{inputs.database_type}}"
Step 4. Publish your Workflow in your Studio using the stk publish workflow command;
Step 5. Use your Workflow to create an Application in StackSpot.