Skip to content

Commit

Permalink
Merge pull request #52 from RoadieHQ/sc-22889-better-validation
Browse files Browse the repository at this point in the history
Add validation to input fields
  • Loading branch information
Ian-Link-Roadie authored Dec 2, 2024
2 parents e45e286 + bd85294 commit 00a9272
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions scaffolder-templates/create-tenant/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ metadata:
description: Send an API call to the tenant manager to create a tenant.

spec:
owner: user:ianlink
type: none
owner: group:roadiehq/solutions
type: service
parameters:
- title: Provide some simple information
required:
Expand All @@ -19,21 +19,36 @@ spec:
tenant_name:
title: Name
type: string
description: No special chars, numbers as the first char, or dashes as the first or last char.
description: The name of the tenant, used for the tenant slug.
ui:autofocus: true
maxLength: 30
pattern: '^[a-z][a-z1-9-]*[a-z1-9]+$'
ui:help: Lowercase characters, dash (-), and underscore (_) only.
tenant_email_domain:
title: Email domain
type: string
description: The email domain of users who will be allowed to access the tenant.
pattern: '^[a-zA-Z0-9-]+.[a-zA-Z0-9-]+'
admin_email:
title: Admin email
type: string
description: The email of the person who will drive the evaluation.
pattern: '^[a-zA-Z0-9-_.]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-]+$'
tenant_environment:
title: Environment
type: string
default: dev
enum: ['dev', 'prod']
createSlack:
title: Create Slack Channel?
type: boolean
default: false
ui:widget: radio
pov:
title: PoV Tenant?
type: boolean
default: true
ui:widget: radio

steps:
- id: createDevTenant
Expand Down Expand Up @@ -68,5 +83,26 @@ spec:
"skipFailures": false
}
- id: addPovTag
name: Is it a PoV Tenant?
if: ${{parameters.pov === true}}
action: http:backstage:request
input:
method: 'POST'
path: proxy/fragments
body: |
{
"decorator": {
"entityRef": "resource:default/${{ parameters.tenant_name }}",
"fragment": {
"metadata": {
"tags": [
"pov"
]
}
}
}
}
output:
resp: ${{ steps.createDevTenant.output.body }} ${{ steps.createProdTenant.output.body }}

0 comments on commit 00a9272

Please sign in to comment.