Scaffold a new service with custom data based on user input
Developers often need to spin up new services for use cases like feature development and architecture processes. Doing this manually can be error-prone and inconsistent across teams. The Workflow in this example streamlines the service creation process by guiding you through a form to input service information then automatically handling the rest: creating a new repository based on your input, creating an entity in Cortex that includes custom data and a linked repository, and automatically opening a Jira ticket to ensure visibility and tracking.
This ensures that every new service is created in a consistent, auditable, and operationally ready way.
This Workflow contains the following blocks:
- A User input block to collect the service name and service tag, and a toggle to select whether or not the incident process was documented. 
- A Scaffolder block to create a new repository 
- An "Add custom data for entity" Cortex block that adds a key to the entity called - incident-process-documentedand uses the "Incident process documented" information that was collected during the User input block as the value of the key.
- An HTTP request block that creates a Jira ticket for the security team to review 

Using a Workflow to Scaffold a new service, add custom data, and create a Jira ticket
Prerequisites
Before getting started:
- Create a Jira API token with the - write:issue:jirapermission.
- Your Cortex role must have the permissions - Edit Workflows,- Execute Workflow runs,- Configure Scaffolder templates, and- Execute Scaffolder.
- You should have already configured your version control provider integration with - writeaccess.
- Make sure you have already registered your Scaffolder template. - In this example, we use the cookiecutter-spring-boot repository. 
 
Step 1: Start creating the Workflow
Follow the steps in the documentation to create a Workflow and configure its basic settings.
Step 2: Add blocks to the Workflow
Add the following blocks to the Workflow:
When you are finished adding blocks, click Save Workflow at the top of the page.
Run the Workflow
- At the top of the Workflow, click Run. - You will be redirected to a page showing the Workflow's steps. 
 
The following chain of events occur during the run:
1. The User input block runs
The User Input block runs, which pauses the Workflow until you enter responses.
Action required
Enter a response for the service name, service tag, and incident process toggle. When you're done, click Submit.
- In this example, we enter - Docs testas the Service Name,- docs-testas a Service Tag, and toggle on the option for Incident Process Documented. 
2. The Scaffolder block runs
The Scaffolder block runs, which prompts you to configure and run the Spring Boot Template that was selected while configuring the Scaffolder step.
- Because of the overrides that were configured in the Scaffolder step, the Project Name, App Name, Creator, and Repository fields are pre-filled:  - The overridden fields cannot be edited unless you select the option to make override fields editable while configuring the Scaffolder block. 
 
Action required
During this step, you must also select the organization to create the repository in, include the branch name and a commit message, and choose the visibility of your repo. When you are finished, click Submit.
- After submitting the configuration, a repository is created in the organization you selected:  
3. The Add Custom Data block runs 
The newly-created entity for the repository now contains the incident-process-documented key and value. You can see this in the Output tab of the block during the Workflow run:

You will also see custom data appear on the entity details page. When we view the newly-created Docs test entity details page, the incident-process-documented data appears in the entity's Custom data & metrics sidebar link:

There is no action required during this step.
4. The HTTP request block runs
A ticket is created in Jira requesting a review from the security team. The title and description were set automatically based on the payload provided while configuring the HTTP request step:

There is no action required during this step.
Last updated
Was this helpful?
