Skip to content

Instantly share code, notes, and snippets.

@dgreen15
Forked from enbashi/Main.json
Last active June 17, 2024 21:50
Show Gist options
  • Save dgreen15/b130a8cea13536884f33667ddb956ee3 to your computer and use it in GitHub Desktop.
Save dgreen15/b130a8cea13536884f33667ddb956ee3 to your computer and use it in GitHub Desktop.
Project Scaffolding/Templating using Cookiecutter

Installation Instructions:

  1. Create a new worflow using the JSON spec in step 1 and update the connection in each step with your GitHub API token. Publish the workflow.
  2. Create a new AWS Lmabda function following these steps in your AWS Console:
  • click "Create Function"
  • Select "Author from scratch"
  • Fill in Function name "cookiecutter" (if you pick another name, make sure to change the function name in Step 4)
  • For "Runtime", select Python 3.12
  • Click "Create Function" at the bottom of the page
  • in "Code" tab replace "lambda_function.py" file with the attached one in Step 2.
  • in "Configuration" tab select "Environment variables", and add new variable with name COOKIECUTTER_CONFIG and value /tmp/cookiecutter/custom-config.yaml.
  • Back to "Code" tab, and "Deploy" the function
  1. Create a new worflow using the JSON spec in step 3 and update the connection in each step with your GitHub API token. Publish the workflow.
  2. Create a new workflow using the JSON spec in Main. You should have a workflow with three steps like the one shown below. Manually update steps 1 & 3 in this worflow to select the new workflows you just created in above steps. If needed, update the Region and Function name fields in step 2 to point to your Lambda function. You can now run this workflow directly or trigger it from other apps/worflows.
  3. Create a new app in app builder using JSON spec in step 4. Manually update the trigger workflow query in the app to call your main workflow created above and pass in the parameters from your form

Checkout the docs for additional information on App Builder, Workflows, and Templates.

image
{
"steps": [
{
"actionId": "com.datadoghq.dd.workflow_automation.triggerWorkflow",
"display": {
"bounds": {
"y": 186
}
},
"name": "Download_project_template",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Scaffold_project_template"
}
],
"parameters": [
{
"name": "workflowInputs",
"value": {
"owner": "{{ Trigger.owner }}",
"path": "{{ Trigger.path }}",
"repo": "{{ Trigger.repo }}"
}
}
]
},
{
"actionId": "com.datadoghq.aws.lambda.invoke_lambda",
"display": {
"bounds": {
"y": 416
}
},
"name": "Scaffold_project_template",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Upload_project_template"
}
],
"parameters": [
{
"name": "region",
"value": "us-east-1"
},
{
"name": "functionName",
"value": "cookiecutter"
},
{
"name": "invocationType",
"value": "RequestResponse"
},
{
"name": "inputPayload",
"value": {
"template": "{{ Steps.Download_project_template.workflowOutputs.output }}",
"variables": "{{ Trigger.variables }}"
}
}
]
},
{
"actionId": "com.datadoghq.dd.workflow_automation.triggerWorkflow",
"display": {
"bounds": {
"y": 661.1012351792293
}
},
"name": "Upload_project_template",
"parameters": [
{
"name": "workflowInputs",
"value": {
"owner": "{{ Trigger.owner }}",
"path": "{{ Trigger.generatedProjectPath }}",
"projectContents": "{{ Steps.Scaffold_project_template.payload }}",
"repo": "{{ Trigger.repo }}"
}
}
]
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "DataDog",
"name": "owner",
"type": "STRING"
},
{
"defaultValue": "apps-templates",
"name": "repo",
"type": "STRING"
},
{
"defaultValue": "templates/cookiecutter-lambda-function",
"name": "path",
"type": "STRING"
},
{
"defaultValue": {
"email": "",
"endpoint": "y",
"full_name": "Your name",
"github_username": "Your github username",
"project_name": "Name of the project",
"project_short_description": "A short description of the project",
"project_slug": "",
"release_date": "",
"schedule": "y",
"timeout": "60",
"version": "0.1.0"
},
"name": "variables",
"type": "OBJECT"
},
{
"defaultValue": "generated-projects/MyNewProject",
"name": "generatedProjectPath",
"type": "STRING"
}
]
},
"startStepName": "Download_project_template",
"triggers": [
{
"manualTrigger": {},
"startStepNames": [
"Download_project_template"
]
}
]
}
{
"steps": [
{
"actionId": "com.datadoghq.http.request",
"display": {
"bounds": {
"y": 372
}
},
"name": "FindTreeSHA",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "TreeSHA"
}
],
"parameters": [
{
"name": "url",
"value": "https://api.github.com/repos/{{ Trigger.owner }}/{{ Trigger.repo }}/contents/{{ Steps.Constants.data.rootPath }}"
},
{
"name": "verb",
"value": "GET"
},
{
"name": "urlParams",
"value": [
{
"key": "recursive",
"value": "true"
}
]
}
]
},
{
"actionId": "com.datadoghq.datatransformation.func",
"display": {
"bounds": {
"y": 186
}
},
"name": "Constants",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "FindTreeSHA"
}
],
"parameters": [
{
"name": "script",
"value": "const pathArray = $.Trigger.path.split('/');\nconst projectFolder = pathArray.pop();\nreturn {\n projectFolder,\n rootPath: pathArray.join('/')\n}"
}
]
},
{
"actionId": "com.datadoghq.http.request",
"display": {
"bounds": {
"y": 766
}
},
"name": "GetTrees",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "FlatContentPaths"
}
],
"parameters": [
{
"name": "url",
"value": "https://api.github.com/repos/{{ Trigger.owner }}/{{ Trigger.repo }}/git/trees/{{ Steps.TreeSHA.data }}"
},
{
"name": "verb",
"value": "GET"
},
{
"name": "urlParams",
"value": [
{
"key": "recursive",
"value": "true"
}
]
}
]
},
{
"actionId": "com.datadoghq.datatransformation.func",
"display": {
"bounds": {
"y": 580
}
},
"name": "TreeSHA",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "GetTrees"
}
],
"parameters": [
{
"name": "script",
"value": "return ($.Steps.FindTreeSHA.body.find(item => item.path === $.Trigger.path))?.sha"
}
]
},
{
"actionId": "com.datadoghq.http.request",
"display": {
"bounds": {
"y": 1160
}
},
"iterator": {
"forEach": {
"inputList": "{{ Steps.FlatContentPaths.data.files }}"
}
},
"name": "GetFileContent",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "ProjectContent"
}
],
"parameters": [
{
"name": "url",
"value": "https://api.github.com/repos/{{ Trigger.owner }}/{{ Trigger.repo }}/contents/{{ Trigger.path }}/{{ Current.Value }}"
},
{
"name": "verb",
"value": "GET"
},
{
"name": "urlParams",
"value": [
{
"key": "recursive",
"value": "true"
}
]
}
]
},
{
"actionId": "com.datadoghq.datatransformation.func",
"display": {
"bounds": {
"y": 1390
}
},
"name": "ProjectContent",
"parameters": [
{
"name": "script",
"value": "//$.Steps.GetFileContent[1].body.content\n\nreturn $.Steps.FlatContentPaths.data.files.reduce((accumulator, _, i)=> {\n const currentValue = $.Steps.GetFileContent[i].body;\n const { type, path: originalPath, content} = currentValue;\n const path = originalPath.replace(`${$.Trigger.path}/`, \"\");\n accumulator.push({type, path, content});\n return accumulator;\n}, []).concat(\n $.Steps.FlatContentPaths.data.folders.map(folder => ({\n type: 'folder',\n path:folder\n }))\n)"
}
]
},
{
"actionId": "com.datadoghq.datatransformation.func",
"display": {
"bounds": {
"y": 974
}
},
"name": "FlatContentPaths",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "GetFileContent"
}
],
"parameters": [
{
"name": "script",
"value": "return $.Steps.GetTrees.body.tree.reduce((acc, currentItem) => {\n if(currentItem.type === 'blob'){\n acc.files.push(currentItem.path)\n } else {\n acc.folders.push(currentItem.path)\n }\n return acc\n}, {files:[], folders: []})"
}
]
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "DataDog",
"name": "owner",
"type": "STRING"
},
{
"defaultValue": "apps-templates",
"name": "repo",
"type": "STRING"
},
{
"defaultValue": "templates/cookiecutter-lambda-function",
"name": "path",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "{{ Steps.ProjectContent.data }}"
}
]
},
"startStepName": "Constants",
"triggers": [
{
"manualTrigger": {},
"startStepNames": [
"Constants"
]
}
]
}
import json
import sys
import subprocess
import base64
import os
import shutil
# pip install custom package to /tmp/ and add to path
subprocess.call('pip install cookiecutter jinja2-time -t /tmp/ --no-cache-dir'.split(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
sys.path.insert(1, '/tmp/')
from cookiecutter.main import cookiecutter
def lambda_handler(event, context):
# serialized array of template contents. Files are encoded as base64
template_json = event['template']
# key/value map of template variables
template_vars = event['variables']
# use request_id in the folder name to prevent leaking across requests (just in case)
rid = context.aws_request_id
basePath = os.path.join('/tmp/', rid)
# deserialize template contents
template_dir = recreate_template_directory(template_json, basePath)
# config reply directory
replay_dir = os.path.join(basePath, 'cookiecutter_reply')
os.makedirs(replay_dir, exist_ok=True)
# custom config file
configPath = os.path.join(basePath, 'cookiecutter')
os.makedirs(configPath, exist_ok=True)
configFile = os.path.join(configPath, 'custom-config.yaml')
with open(configFile, 'w') as f:
f.write('replay_dir: "{}"\ncookiecutters_dir: "{}"'.format(replay_dir,basePath))
os.environ['COOKIECUTTER_CONFIG'] = configFile
# generate project using cookiecutter
output_dir = cookiecutter(template_dir, extra_context=template_vars, no_input=True, output_dir=basePath)
# serialize the generated project
generated_project_json = serialize_project_directory(output_dir)
# cleanup
shutil.rmtree(template_dir)
shutil.rmtree(output_dir)
return generated_project_json
def recreate_template_directory(template_json, basePath):
tmp_dir = os.path.join(basePath, 'cookiecutter_template')
os.makedirs(tmp_dir, exist_ok=True)
for file_data in template_json:
file_path = os.path.join(tmp_dir, file_data['path'])
os.makedirs(os.path.dirname(file_path), exist_ok=True)
if 'content' in file_data:
with open(file_path, 'wb') as f:
f.write(base64.b64decode(file_data['content']))
return tmp_dir
def serialize_project_directory(directory):
result = []
for root, dirs, files in os.walk(directory):
for file in files:
file_path = os.path.join(root, file)
with open(file_path, 'rb') as f:
result.append({
'path': os.path.relpath(file_path, directory),
'content': base64.b64encode(f.read()).decode(),
'type': 'file'
})
for dir in dirs:
dir_path = os.path.join(root, dir)
result.append({
'path': os.path.relpath(dir_path, directory),
'type': 'folder'
})
return result
{
"steps": [
{
"actionId": "com.datadoghq.datatransformation.func",
"display": {
"bounds": {
"y": 186
}
},
"name": "Constants",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Create_branch"
}
],
"parameters": [
{
"name": "script",
"value": "const pathArray = $.Trigger.path.split('/');\nconst projectFolder = pathArray.pop();\nreturn {\n projectFolder,\n rootPath: pathArray.join('/'),\n files: $.Trigger.projectContents.filter(item => item.type === 'file'),\n timestamp: Date.now()\n}"
}
]
},
{
"actionId": "com.datadoghq.http.request",
"display": {
"bounds": {
"y": 580
}
},
"iterator": {
"continueOnError": true,
"forEach": {
"inputList": "{{ Steps.Constants.data.files }}"
}
},
"name": "UploadFile",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "PR_Description"
}
],
"parameters": [
{
"name": "url",
"value": "https://api.github.com/repos/{{ Trigger.owner }}/{{ Trigger.repo }}/contents/{{ Trigger.path }}/{{ Current.Value.path }}"
},
{
"name": "verb",
"value": "PUT"
},
{
"name": "requestHeaders",
"value": [
{
"key": "Content-Type",
"value": [
"application/json"
]
}
]
},
{
"name": "body",
"value": {
"branch": "{{ Steps.Create_branch.branch }}",
"content": "{{ Current.Value.content }}",
"message": "commit message"
}
}
]
},
{
"actionId": "com.datadoghq.github.createBranch",
"display": {
"bounds": {
"y": 372
}
},
"name": "Create_branch",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "UploadFile"
}
],
"parameters": [
{
"name": "repository",
"value": "{{ Trigger.owner }}/{{ Trigger.repo }}"
},
{
"name": "baseBranch",
"value": "main"
},
{
"name": "branchToCreate",
"value": "new_project_{{ Trigger.path }}_{{ Steps.Constants.data.timestamp }}"
}
]
},
{
"actionId": "com.datadoghq.github.createPullRequest",
"display": {
"bounds": {
"x": -4.238575837475509,
"y": 962.588694087361
}
},
"name": "Create_pull_request",
"parameters": [
{
"name": "repository",
"value": "{{ Trigger.owner }}/{{ Trigger.repo }}"
},
{
"name": "baseBranch",
"value": "main"
},
{
"name": "branchWithChanges",
"value": "{{ Steps.Create_branch.branch }}"
},
{
"name": "prTitle",
"value": "[Project Template] {{ Steps.Constants.data.projectFolder }}"
},
{
"name": "prDescription",
"value": "{{ Steps.PR_Description.data }}"
}
]
},
{
"actionId": "com.datadoghq.datatransformation.func",
"display": {
"bounds": {
"y": 810
}
},
"name": "PR_Description",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Create_pull_request"
}
],
"parameters": [
{
"name": "script",
"value": "return `**Generated Files:** \\n\\n- ${$.Trigger.projectContents.map(item => item.path).join(\"\\n- \")}`"
}
]
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "DataDog",
"name": "owner",
"type": "STRING"
},
{
"defaultValue": "apps-templates",
"name": "repo",
"type": "STRING"
},
{
"defaultValue": "generated-projects/MyNewProject",
"name": "path",
"type": "STRING"
},
{
"defaultValue": [],
"name": "projectContents",
"type": "ARRAY_OBJECT"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "PR_URL",
"type": "STRING",
"value": "{{ Steps.Create_pull_request.data.url }}"
}
]
},
"startStepName": "Constants",
"triggers": [
{
"manualTrigger": {},
"startStepNames": [
"Constants"
]
}
]
}
{
"rootInstanceName": "grid0",
"components": [
{
"events": [],
"name": "grid0",
"properties": {
"backgroundColor": "blue",
"children": [
{
"events": [],
"name": "gridCell6",
"properties": {
"children": [
{
"events": [],
"name": "container0",
"properties": {
"children": [
{
"events": [],
"name": "grid3",
"properties": {
"children": [
{
"events": [],
"name": "gridCell0",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 91,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell1_copy",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 6,
"y": 270,
"width": 6,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy",
"properties": {
"children": [
{
"events": [],
"name": "owner",
"properties": {
"defaultValue": "${global?.user?.name}",
"isDisabled": false,
"isVisible": "true",
"label": "Owner",
"placeholder": "DataDog"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 10,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell2",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 2,
"y": 190,
"width": 8,
"height": 4
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell5_copy2",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 211,
"width": 9,
"height": 3
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell5_copy3",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 207,
"width": 9,
"height": 3
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy6",
"properties": {
"children": [
{
"events": [],
"name": "github_username",
"properties": {
"defaultValue": "DataDog",
"isDisabled": false,
"isVisible": "true",
"label": "GitHub Username",
"placeholder": "DataDog"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 26,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell4",
"properties": {
"children": [
{
"events": [],
"name": "calloutValue0",
"properties": {
"isDisabled": false,
"isLoading": "false",
"isVisible": "true",
"label": "Part 1/3",
"size": "sm",
"style": "blue",
"unit": "",
"value": "Your Information"
},
"type": "calloutValue"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 0,
"width": 12,
"height": 9
}
}
},
"type": "gridCell"
},
{
"type": "gridCell",
"name": "gridCell1",
"properties": {
"children": [
{
"name": "email",
"type": "textInput",
"properties": {
"defaultValue": "${global?.user?.handle}",
"placeholder": "",
"isDisabled": false,
"isVisible": true,
"label": "Email"
},
"events": []
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 18,
"width": 12,
"height": 7
}
}
},
"events": []
}
]
},
"type": "grid"
}
],
"isVisible": "true"
},
"type": "container"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 10,
"width": 12,
"height": 41
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "modal0",
"properties": {
"children": [
{
"events": [],
"name": "grid1",
"properties": {
"children": [
{
"events": [],
"name": "gridCell1_copy1",
"properties": {
"children": [
{
"events": [],
"name": "variables_copy",
"properties": {
"defaultValue": "{\n \"app_name\": \"DevOpsDash\",\n \"email\":\"\",\n \"endpoint\":\"y\",\n \"full_name\": \"Your name\",\n \"github_username\": \"Your github username\",\n \"project_name\": \"Name of the project\",\n \"project_short_description\": \"A short description of the project\",\n \"project_slug\": \"\",\n \"release_date\": \"\",\n \"schedule\": \"y\",\n \"timeout\": \"60\",\n \"version\": \"0.1.0\"\n}",
"isVisible": false,
"label": "Variables",
"readOnly": "false"
},
"type": "jsonInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"height": 42,
"width": 12,
"x": 0,
"y": 0
}
}
},
"type": "gridCell"
}
]
},
"type": "grid"
}
],
"isVisible": "true",
"size": "sm",
"title": "Title"
},
"type": "modal"
},
{
"events": [],
"name": "gridCell6_copy",
"properties": {
"children": [
{
"events": [],
"name": "container0_copy",
"properties": {
"children": [
{
"events": [],
"name": "grid3_copy",
"properties": {
"children": [
{
"events": [],
"name": "gridCell0_copy15",
"properties": {
"children": [
{
"events": [],
"name": "repo",
"properties": {
"defaultValue": "apps-templates",
"isDisabled": true,
"isVisible": "true",
"label": "Repo",
"placeholder": "apps-templates"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"height": 8,
"width": 12,
"x": 0,
"y": 35
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell1_copy2",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"height": 8,
"width": 6,
"x": 6,
"y": 270
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy17",
"properties": {
"children": [
{
"events": [],
"name": "path",
"properties": {
"defaultValue": "templates/cookiecutter-lambda-function",
"isDisabled": true,
"isVisible": "true",
"label": "Path",
"placeholder": "templates/cookiecutter-lambda-function"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"height": 8,
"width": 12,
"x": 0,
"y": 43
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy18",
"properties": {
"children": [
{
"events": [],
"name": "project_path",
"properties": {
"defaultValue": "generated-project/${Project_Slug.value}",
"isDisabled": false,
"isVisible": "true",
"label": "Generated Project Path",
"placeholder": "generated-project/MyNewProject"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"height": 8,
"width": 12,
"x": 0,
"y": 51
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy19",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"height": 8,
"width": 12,
"x": 0,
"y": 131
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell5_copy4",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"height": 3,
"width": 9,
"x": 0,
"y": 211
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell3_copy3",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"height": 4,
"width": 12,
"x": 0,
"y": 60
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell5_copy5",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"height": 3,
"width": 9,
"x": 0,
"y": 207
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy21",
"properties": {
"children": [
{
"events": [],
"name": "project_name",
"properties": {
"defaultValue": "DevOpsDash",
"isDisabled": false,
"isVisible": "true",
"label": "Project Name",
"placeholder": "DevOpsDash"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"height": 8,
"width": 12,
"x": 0,
"y": 11
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy23",
"properties": {
"children": [
{
"events": [],
"name": "project_description",
"properties": {
"defaultValue": "A short description of the project",
"isDisabled": false,
"isVisible": "true",
"label": "Project Description",
"placeholder": "A short description of the project"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"height": 8,
"width": 12,
"x": 0,
"y": 19
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy25",
"properties": {
"children": [
{
"events": [],
"name": "Project_Slug",
"properties": {
"defaultValue": "${project_name.value.replace(/ /g,\"\").toLowerCase()}",
"isDisabled": false,
"isVisible": "true",
"label": "Project Slug",
"placeholder": ""
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"height": 8,
"width": 12,
"x": 0,
"y": 27
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell4_copy2",
"properties": {
"children": [
{
"events": [],
"name": "calloutValue0_copy2",
"properties": {
"isDisabled": false,
"isLoading": "false",
"isVisible": "true",
"label": "Part 2/3",
"size": "sm",
"style": "blue",
"unit": "",
"value": "Project Information"
},
"type": "calloutValue"
}
],
"isVisible": "true",
"layout": {
"default": {
"height": 9,
"width": 12,
"x": 0,
"y": 0
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell3_copy8",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"height": 5,
"width": 12,
"x": 0,
"y": 190
}
}
},
"type": "gridCell"
}
]
},
"type": "grid"
}
],
"isVisible": "true"
},
"type": "container"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 51,
"width": 12,
"height": 68
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell6_copy1",
"properties": {
"children": [
{
"events": [],
"name": "container0_copy1",
"properties": {
"children": [
{
"events": [],
"name": "grid3_copy1",
"properties": {
"children": [
{
"events": [],
"name": "gridCell1_copy3",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 6,
"y": 270,
"width": 6,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy32",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 103,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell5_copy7",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 71,
"width": 9,
"height": 5
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy33",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 149,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy34",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 157,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell3_copy5",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 165,
"width": 12,
"height": 5
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell5_copy8",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 211,
"width": 9,
"height": 3
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell3_copy6",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 115,
"width": 12,
"height": 4
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell5_copy9",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 207,
"width": 9,
"height": 3
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy37",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 121,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy41",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 132,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy43",
"properties": {
"children": [
{
"events": [],
"name": "Schedule",
"properties": {
"defaultValue": "y",
"isDisabled": false,
"isVisible": "true",
"label": "Schedule",
"placeholder": "y"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 10,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy44",
"properties": {
"children": [
{
"events": [],
"name": "endpoint",
"properties": {
"defaultValue": "y",
"isDisabled": false,
"isVisible": "true",
"label": "Endpoint",
"placeholder": "y"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 18,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy45",
"properties": {
"children": [
{
"events": [],
"name": "timeout",
"properties": {
"defaultValue": "60",
"isDisabled": false,
"isVisible": "true",
"label": "Timeout",
"placeholder": "60"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 26,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell0_copy46",
"properties": {
"children": [
{
"events": [],
"name": "version",
"properties": {
"defaultValue": "0.1.0",
"isDisabled": false,
"isVisible": "true",
"label": "Version",
"placeholder": "0.1.0"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 34,
"width": 12,
"height": 8
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell4_copy3",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 78,
"width": 12,
"height": 9
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell3_copy7",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 87,
"width": 12,
"height": 6
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell4_copy4",
"properties": {
"children": [],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 140,
"width": 12,
"height": 9
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell5_copy10",
"properties": {
"children": [
{
"events": [],
"name": "calloutValue1_copy1",
"properties": {
"isDisabled": false,
"isLoading": "false",
"isVisible": "true",
"label": "Part 3/3",
"size": "sm",
"style": "blue",
"unit": "",
"value": "Template Parameters"
},
"type": "calloutValue"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 0,
"width": 12,
"height": 9
}
}
},
"type": "gridCell"
},
{
"type": "gridCell",
"name": "gridCell0_copy47",
"properties": {
"children": [
{
"events": [],
"name": "Release_Date",
"properties": {
"defaultValue": "08/01/24",
"isDisabled": false,
"isVisible": "true",
"label": "Release Date",
"placeholder": "0.1.0"
},
"type": "textInput"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 42,
"width": 12,
"height": 8
}
}
},
"events": []
}
]
},
"type": "grid"
}
],
"isVisible": "true"
},
"type": "container"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 120,
"width": 12,
"height": 57
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell5_copy",
"properties": {
"children": [
{
"events": [],
"name": "text0_copy1",
"properties": {
"content": "# Generate a new project using Cookie Cutter",
"contentType": "markdown",
"isVisible": "true",
"textAlign": "left",
"verticalAlign": "top"
},
"type": "text"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 0,
"y": 1,
"width": 9,
"height": 5
}
}
},
"type": "gridCell"
},
{
"events": [],
"name": "gridCell2_copy1",
"properties": {
"children": [
{
"events": [
{
"name": "click",
"queryName": "triggerWorkflow0",
"type": "triggerQuery"
}
],
"name": "button0_copy1",
"properties": {
"isBorderless": false,
"isDisabled": false,
"isLoading": "${triggerWorkflow0.isLoading}",
"isPrimary": true,
"isVisible": "true",
"label": "Generate Project",
"level": "default"
},
"type": "button"
}
],
"isVisible": "true",
"layout": {
"default": {
"x": 2,
"y": 177,
"width": 8,
"height": 9
}
}
},
"type": "gridCell"
}
]
},
"type": "grid"
}
],
"queries": [
{
"id": "3b1dd46a-9d25-4061-9c7d-14359a623854",
"name": "triggerWorkflow0",
"type": "action",
"properties": {
"mockedOutputs": {
"enabled": false,
"outputs": "{}"
},
"onlyTriggerManually": true,
"requiresConfirmation": true,
"showToastOnError": true,
"spec": {
"fqn": "com.datadoghq.dd.workflow_automation.triggerWorkflowAsync",
"inputs": {
"workflowId": "7f9837a7-a49b-44c0-a9dd-263cb4758d9d",
"workflowInputs": {
"generatedProjectPath": "${project_path.value}",
"owner": "DataDog",
"path": "${path.value}",
"repo": "${repo.value}",
"variables": {
"email": "${email.value}",
"endpoint": "${endpoint.value}",
"full_name": "${owner.value}",
"github_username": "${github_username.value}",
"project_name": "${project_name.value}",
"project_short_description": "${project_description.value}",
"project_slug": "${Project_Slug.value}",
"release_date": "${Release_Date.value}",
"schedule": "${Schedule.value}",
"timeout": "${timeout.value}",
"version": "${version.value}"
}
}
}
}
},
"events": [
{
"name": "executionFinished",
"type": "setStateVariableValue",
"value": "true",
"variableName": "executiondone"
}
]
},
{
"id": "715f395d-144d-4e0e-aaa9-d4cddd57c027",
"name": "executiondone",
"type": "stateVariable",
"properties": {
"defaultValue": "false"
}
}
],
"name": "Sample Templating App",
"description": "Sample Templating App",
"id": "4f86d002-3487-43c1-aa44-1402fec9c3aa"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment