From 135314fdc2ede0cfcc42d62a40fd9edee934a531 Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Date: Thu, 27 Oct 2022 09:46:28 -0300 Subject: [PATCH 01/11] docs: scaffolder inputs examples Signed-off-by: Gabriel Dantas --- .../software-templates/inputs-examples.md | 198 ++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 199 insertions(+) create mode 100644 docs/features/software-templates/inputs-examples.md diff --git a/docs/features/software-templates/inputs-examples.md b/docs/features/software-templates/inputs-examples.md new file mode 100644 index 0000000000..dbaab6b144 --- /dev/null +++ b/docs/features/software-templates/inputs-examples.md @@ -0,0 +1,198 @@ +--- +id: inputs-examples +title: Built-in examples inputs +description: Some examples to use in your template +--- + +All the examples on this page you can test using _create/edit_ from your Backstage installation. + +It is important to remember that all examples are based on [react-jsonschema-form](https://rjsf-team.github.io/react-jsonschema-form/). + +# Simple text input + +## Simple input with basic validations + +```yaml +parameters: + - title: Fill in some steps + properties: + name: + title: Simple text input + type: string + description: Description about input + maxLength: 8 + pattern: '^([a-zA-Z][a-zA-Z0-9]*)(-[a-zA-Z0-9]+)*$' + ui:autofocus: true + ui:help: "Hint: additional description..." +``` + +## Simple secret input + +```yaml +parameters: + - title: Fill in some steps + properties: + secretInput: + title: Input secret + type: string + description: Super secret description hint + minLength: 6 + ui:widget: "password" +``` + +## Multi line text input + +```yaml +parameters: + - title: Fill in some steps + properties: + multiline: + title: Text area input + type: string + description: Insira o valor do input que gostraia + ui:widget: "textarea" + ui:options: + rows: 10 + ui:help: "Hint: Make it strong!" + ui:placeholder: | + apiVersion: backstage.io/v1alpha1 + kind: Component + metadata: + name: backstage + spec: + type: library + owner: CNCF + lifecycle: experimental +``` + +# Arrays options + +## Enum with custom titles + +```yaml +parameters: + - title: Fill in some steps + properties: + volume_type: + title: Volume Type + type: string + description: The volume type to be used. + enum: ['gp2', 'gp3', 'io1', 'io2', 'sc1', 'st1', 'standard'] + default: 'gp2' + enumNames: + [ + 'General Purpose SSD (gp2)', + 'General Purpose SSD (gp3)', + 'Provisioned IOPS (io1)', + 'Provisioned IOPS (io2)', + 'Cold HDD (sc1)', + 'Throughput Optimized HDD (st1)', + 'Magnetic (standard)', + ] +``` + +## A multiple choices list + +```yaml +parameters: + - title: Fill in some steps + properties: + name: + title: Select environments + type: array + items: + type: string + enum: ["production", "staging", "development"] + uniqueItems: true + ui:widget: checkboxes +``` + +## Array with another types + +```yaml +parameters: + - title: Fill in some steps + properties: + arrayObjects: + title: Array with custom objects + type: array + ui:options: + addable: false + orderable: false + removable: false + items: + type: object + properties: + array: + title: Array string with default value + type: string + default: value3 + enum: + - value1 + - value2 + - value3 + flag: + title: Boolean flag + type: boolean + ui:widget: radio + someInput: + title: Simple text input + type: string +``` + +# Boolean options + +## Boolean + +```yaml +parameters: + - title: Fill in some steps + properties: + name: + title: Checkbox boolean + type: boolean +``` + +## Boolean Yes or No options + +```yaml +parameters: + - title: Fill in some steps + properties: + name: + title: Yes or No options + type: boolean + ui:widget: radio +``` + +## Boolean multiple options + +```yaml +parameters: + - title: Fill in some steps + properties: + name: + title: Select features + type: array + items: + type: boolean + enum: ["Enable scraping", "Enable HPA", "Enable cache"] + uniqueItems: true + ui:widget: checkboxes +``` + +## Use parameters as condition in steps + +```yaml +- name: Only development environments + if: ${{ parameters.environment === "staging" and parameters.environment === "development" }} + action: debug:log + input: + message: "development step" + +- name: Only production environments + if: ${{ parameters.environment === "prod" or parameters.environment === "production" }} + action: debug:log + input: + message: "production step" +``` diff --git a/mkdocs.yml b/mkdocs.yml index 43efc32f8e..d7f303649c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -61,6 +61,7 @@ nav: - Overview: 'features/software-templates/index.md' - Configuration: 'features/software-templates/configuration.md' - Adding your own Templates: 'features/software-templates/adding-templates.md' + - Inputs examples: 'features/software-templates/inputs-examples.md' - Writing Templates: 'features/software-templates/writing-templates.md' - Builtin Actions: 'features/software-templates/builtin-actions.md' - Writing Custom Actions: 'features/software-templates/writing-custom-actions.md' From 8b0d1e72dcf61f2bb793f5460531ae87931ec45b Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Date: Thu, 27 Oct 2022 09:59:19 -0300 Subject: [PATCH 02/11] fix docs quality error Signed-off-by: Gabriel Dantas --- docs/features/software-templates/inputs-examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features/software-templates/inputs-examples.md b/docs/features/software-templates/inputs-examples.md index dbaab6b144..b6cccb6053 100644 --- a/docs/features/software-templates/inputs-examples.md +++ b/docs/features/software-templates/inputs-examples.md @@ -67,7 +67,7 @@ parameters: # Arrays options -## Enum with custom titles +## Array with custom titles ```yaml parameters: From 0913ace69a9f1278d1fbe0a835b411db360548db Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Date: Thu, 27 Oct 2022 10:31:32 -0300 Subject: [PATCH 03/11] style: fix markdown errors Signed-off-by: Gabriel Dantas --- .../software-templates/inputs-examples.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/features/software-templates/inputs-examples.md b/docs/features/software-templates/inputs-examples.md index b6cccb6053..13bd383215 100644 --- a/docs/features/software-templates/inputs-examples.md +++ b/docs/features/software-templates/inputs-examples.md @@ -8,9 +8,9 @@ All the examples on this page you can test using _create/edit_ from your Backsta It is important to remember that all examples are based on [react-jsonschema-form](https://rjsf-team.github.io/react-jsonschema-form/). -# Simple text input +## Simple text input -## Simple input with basic validations +### Simple input with basic validations ```yaml parameters: @@ -26,7 +26,7 @@ parameters: ui:help: "Hint: additional description..." ``` -## Simple secret input +### Simple secret input ```yaml parameters: @@ -40,7 +40,7 @@ parameters: ui:widget: "password" ``` -## Multi line text input +### Multi line text input ```yaml parameters: @@ -65,9 +65,9 @@ parameters: lifecycle: experimental ``` -# Arrays options +## Arrays options -## Array with custom titles +### Array with custom titles ```yaml parameters: @@ -91,7 +91,7 @@ parameters: ] ``` -## A multiple choices list +### A multiple choices list ```yaml parameters: @@ -107,7 +107,7 @@ parameters: ui:widget: checkboxes ``` -## Array with another types +### Array with another types ```yaml parameters: @@ -140,9 +140,9 @@ parameters: type: string ``` -# Boolean options +## Boolean options -## Boolean +### Boolean ```yaml parameters: @@ -153,7 +153,7 @@ parameters: type: boolean ``` -## Boolean Yes or No options +### Boolean Yes or No options ```yaml parameters: @@ -165,7 +165,7 @@ parameters: ui:widget: radio ``` -## Boolean multiple options +### Boolean multiple options ```yaml parameters: From 2815e378951e7799ccf39c3845dedca2b4f1a6f4 Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Date: Thu, 27 Oct 2022 11:47:28 -0300 Subject: [PATCH 04/11] fix: run prettier -w Signed-off-by: Gabriel Dantas --- .../software-templates/inputs-examples.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/features/software-templates/inputs-examples.md b/docs/features/software-templates/inputs-examples.md index 13bd383215..3e39c21d63 100644 --- a/docs/features/software-templates/inputs-examples.md +++ b/docs/features/software-templates/inputs-examples.md @@ -23,7 +23,7 @@ parameters: maxLength: 8 pattern: '^([a-zA-Z][a-zA-Z0-9]*)(-[a-zA-Z0-9]+)*$' ui:autofocus: true - ui:help: "Hint: additional description..." + ui:help: 'Hint: additional description...' ``` ### Simple secret input @@ -37,7 +37,7 @@ parameters: type: string description: Super secret description hint minLength: 6 - ui:widget: "password" + ui:widget: 'password' ``` ### Multi line text input @@ -50,10 +50,10 @@ parameters: title: Text area input type: string description: Insira o valor do input que gostraia - ui:widget: "textarea" - ui:options: + ui:widget: 'textarea' + ui:options: rows: 10 - ui:help: "Hint: Make it strong!" + ui:help: 'Hint: Make it strong!' ui:placeholder: | apiVersion: backstage.io/v1alpha1 kind: Component @@ -102,7 +102,7 @@ parameters: type: array items: type: string - enum: ["production", "staging", "development"] + enum: ['production', 'staging', 'development'] uniqueItems: true ui:widget: checkboxes ``` @@ -176,7 +176,7 @@ parameters: type: array items: type: boolean - enum: ["Enable scraping", "Enable HPA", "Enable cache"] + enum: ['Enable scraping', 'Enable HPA', 'Enable cache'] uniqueItems: true ui:widget: checkboxes ``` @@ -188,11 +188,11 @@ parameters: if: ${{ parameters.environment === "staging" and parameters.environment === "development" }} action: debug:log input: - message: "development step" + message: 'development step' - name: Only production environments if: ${{ parameters.environment === "prod" or parameters.environment === "production" }} action: debug:log input: - message: "production step" + message: 'production step' ``` From 87f1b7e515879178e9f30df8e99c467a22d8475e Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Date: Fri, 28 Oct 2022 15:37:43 -0300 Subject: [PATCH 05/11] fix: review comments Signed-off-by: Gabriel Dantas --- .../{inputs-examples.md => input-examples.md} | 35 ++++++++++++------- mkdocs.yml | 2 +- 2 files changed, 24 insertions(+), 13 deletions(-) rename docs/features/software-templates/{inputs-examples.md => input-examples.md} (86%) diff --git a/docs/features/software-templates/inputs-examples.md b/docs/features/software-templates/input-examples.md similarity index 86% rename from docs/features/software-templates/inputs-examples.md rename to docs/features/software-templates/input-examples.md index 3e39c21d63..68a6fefc0e 100644 --- a/docs/features/software-templates/inputs-examples.md +++ b/docs/features/software-templates/input-examples.md @@ -77,18 +77,23 @@ parameters: title: Volume Type type: string description: The volume type to be used. - enum: ['gp2', 'gp3', 'io1', 'io2', 'sc1', 'st1', 'standard'] default: 'gp2' + enum: + - 'gp2' + - 'gp3' + - 'io1' + - 'io2' + - 'sc1' + - 'st1' + - 'standard' enumNames: - [ - 'General Purpose SSD (gp2)', - 'General Purpose SSD (gp3)', - 'Provisioned IOPS (io1)', - 'Provisioned IOPS (io2)', - 'Cold HDD (sc1)', - 'Throughput Optimized HDD (st1)', - 'Magnetic (standard)', - ] + - 'General Purpose SSD (gp2)' + - 'General Purpose SSD (gp3)' + - 'Provisioned IOPS (io1)' + - 'Provisioned IOPS (io2)' + - 'Cold HDD (sc1)' + - 'Throughput Optimized HDD (st1)' + - 'Magnetic (standard)' ``` ### A multiple choices list @@ -102,7 +107,10 @@ parameters: type: array items: type: string - enum: ['production', 'staging', 'development'] + enum: + - 'production' + - 'staging' + - 'development' uniqueItems: true ui:widget: checkboxes ``` @@ -176,7 +184,10 @@ parameters: type: array items: type: boolean - enum: ['Enable scraping', 'Enable HPA', 'Enable cache'] + enum: + - 'Enable scraping' + - 'Enable HPA' + - 'Enable cache' uniqueItems: true ui:widget: checkboxes ``` diff --git a/mkdocs.yml b/mkdocs.yml index d7f303649c..06906fe3f0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -61,7 +61,7 @@ nav: - Overview: 'features/software-templates/index.md' - Configuration: 'features/software-templates/configuration.md' - Adding your own Templates: 'features/software-templates/adding-templates.md' - - Inputs examples: 'features/software-templates/inputs-examples.md' + - Input examples: 'features/software-templates/inputs-examples.md' - Writing Templates: 'features/software-templates/writing-templates.md' - Builtin Actions: 'features/software-templates/builtin-actions.md' - Writing Custom Actions: 'features/software-templates/writing-custom-actions.md' From d7d8e00a5274bc37ecd6c8f6305d864d599bd89a Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Date: Fri, 28 Oct 2022 16:36:27 -0300 Subject: [PATCH 06/11] fix: prettier Signed-off-by: Gabriel Dantas --- .../software-templates/input-examples.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/features/software-templates/input-examples.md b/docs/features/software-templates/input-examples.md index 68a6fefc0e..3d76f3e0ab 100644 --- a/docs/features/software-templates/input-examples.md +++ b/docs/features/software-templates/input-examples.md @@ -1,5 +1,5 @@ --- -id: inputs-examples +id: input-examples title: Built-in examples inputs description: Some examples to use in your template --- @@ -78,13 +78,13 @@ parameters: type: string description: The volume type to be used. default: 'gp2' - enum: + enum: - 'gp2' - - 'gp3' - - 'io1' - - 'io2' - - 'sc1' - - 'st1' + - 'gp3' + - 'io1' + - 'io2' + - 'sc1' + - 'st1' - 'standard' enumNames: - 'General Purpose SSD (gp2)' @@ -107,10 +107,10 @@ parameters: type: array items: type: string - enum: - - 'production' - - 'staging' - - 'development' + enum: + - 'production' + - 'staging' + - 'development' uniqueItems: true ui:widget: checkboxes ``` @@ -184,7 +184,7 @@ parameters: type: array items: type: boolean - enum: + enum: - 'Enable scraping' - 'Enable HPA' - 'Enable cache' From 014fbef35703d7689f1f95264eea4074bc091873 Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Gomes Date: Sun, 30 Oct 2022 23:52:37 -0300 Subject: [PATCH 07/11] Update mkdocs.yml Co-authored-by: Ben Lambert Signed-off-by: Gabriel Dantas Gomes Signed-off-by: Gabriel Dantas --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 06906fe3f0..38070252f5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -61,7 +61,7 @@ nav: - Overview: 'features/software-templates/index.md' - Configuration: 'features/software-templates/configuration.md' - Adding your own Templates: 'features/software-templates/adding-templates.md' - - Input examples: 'features/software-templates/inputs-examples.md' + - Input Examples: 'features/software-templates/input-examples.md' - Writing Templates: 'features/software-templates/writing-templates.md' - Builtin Actions: 'features/software-templates/builtin-actions.md' - Writing Custom Actions: 'features/software-templates/writing-custom-actions.md' From 75cbec788aba951d37ea4225f3596b2cffa2a2d3 Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Gomes Date: Mon, 31 Oct 2022 01:22:05 -0300 Subject: [PATCH 08/11] fix quotes Signed-off-by: Gabriel Dantas --- .../software-templates/input-examples.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/features/software-templates/input-examples.md b/docs/features/software-templates/input-examples.md index 3d76f3e0ab..cd0a55aa0e 100644 --- a/docs/features/software-templates/input-examples.md +++ b/docs/features/software-templates/input-examples.md @@ -37,7 +37,7 @@ parameters: type: string description: Super secret description hint minLength: 6 - ui:widget: 'password' + ui:widget: password ``` ### Multi line text input @@ -49,8 +49,8 @@ parameters: multiline: title: Text area input type: string - description: Insira o valor do input que gostraia - ui:widget: 'textarea' + description: Insert your multi line string + ui:widget: textarea ui:options: rows: 10 ui:help: 'Hint: Make it strong!' @@ -76,16 +76,16 @@ parameters: volume_type: title: Volume Type type: string - description: The volume type to be used. - default: 'gp2' + description: The volume type to be used + default: gp2 enum: - - 'gp2' - - 'gp3' - - 'io1' - - 'io2' - - 'sc1' - - 'st1' - - 'standard' + - gp2 + - gp3 + - io1 + - io2 + - sc1 + - st1 + - standard enumNames: - 'General Purpose SSD (gp2)' - 'General Purpose SSD (gp3)' @@ -108,9 +108,9 @@ parameters: items: type: string enum: - - 'production' - - 'staging' - - 'development' + - production + - staging + - development uniqueItems: true ui:widget: checkboxes ``` From 26f9b90dd11474500d6722c853fb44e215b522f7 Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Date: Thu, 3 Nov 2022 12:24:48 -0300 Subject: [PATCH 09/11] update sidebars.json Signed-off-by: Gabriel Dantas --- microsite/sidebars.json | 1 + 1 file changed, 1 insertion(+) diff --git a/microsite/sidebars.json b/microsite/sidebars.json index e758fe9100..f9fdb9ee9a 100644 --- a/microsite/sidebars.json +++ b/microsite/sidebars.json @@ -95,6 +95,7 @@ "features/software-templates/configuration", "features/software-templates/adding-templates", "features/software-templates/writing-templates", + "features/software-templates/input-examples", "features/software-templates/builtin-actions", "features/software-templates/writing-custom-actions", "features/software-templates/writing-custom-field-extensions", From 83c77f12d6f34db8c927118759f9a704f510a591 Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Gomes Date: Thu, 3 Nov 2022 19:05:04 -0300 Subject: [PATCH 10/11] Update docs/features/software-templates/input-examples.md Co-authored-by: Patrik Oldsberg Signed-off-by: Gabriel Dantas Gomes --- docs/features/software-templates/input-examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features/software-templates/input-examples.md b/docs/features/software-templates/input-examples.md index cd0a55aa0e..77b29f33e3 100644 --- a/docs/features/software-templates/input-examples.md +++ b/docs/features/software-templates/input-examples.md @@ -1,6 +1,6 @@ --- id: input-examples -title: Built-in examples inputs +title: Input Examples description: Some examples to use in your template --- From d1547a654789bfca4052a9e69efb9d968def416c Mon Sep 17 00:00:00 2001 From: Gabriel Dantas Date: Thu, 3 Nov 2022 22:29:27 -0300 Subject: [PATCH 11/11] fix: change secret input and sidebar order Signed-off-by: Gabriel Dantas --- docs/features/software-templates/input-examples.md | 14 -------------- mkdocs.yml | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/docs/features/software-templates/input-examples.md b/docs/features/software-templates/input-examples.md index 77b29f33e3..c44ee39269 100644 --- a/docs/features/software-templates/input-examples.md +++ b/docs/features/software-templates/input-examples.md @@ -26,20 +26,6 @@ parameters: ui:help: 'Hint: additional description...' ``` -### Simple secret input - -```yaml -parameters: - - title: Fill in some steps - properties: - secretInput: - title: Input secret - type: string - description: Super secret description hint - minLength: 6 - ui:widget: password -``` - ### Multi line text input ```yaml diff --git a/mkdocs.yml b/mkdocs.yml index 38070252f5..ea2031dac6 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -61,8 +61,8 @@ nav: - Overview: 'features/software-templates/index.md' - Configuration: 'features/software-templates/configuration.md' - Adding your own Templates: 'features/software-templates/adding-templates.md' - - Input Examples: 'features/software-templates/input-examples.md' - Writing Templates: 'features/software-templates/writing-templates.md' + - Input Examples: 'features/software-templates/input-examples.md' - Builtin Actions: 'features/software-templates/builtin-actions.md' - Writing Custom Actions: 'features/software-templates/writing-custom-actions.md' - Writing Custom Step Layouts: 'features/software-templates/writing-custom-step-layouts.md'