From 41f51ad5d5507966df28440a4e82842460704b77 Mon Sep 17 00:00:00 2001 From: djamaile Date: Mon, 14 Mar 2022 19:06:32 +0100 Subject: [PATCH] docs: write on how to use feature flags within templates Signed-off-by: djamaile --- .../software-templates/writing-templates.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/features/software-templates/writing-templates.md b/docs/features/software-templates/writing-templates.md index 41061d45a3..e7ed18cf8e 100644 --- a/docs/features/software-templates/writing-templates.md +++ b/docs/features/software-templates/writing-templates.md @@ -254,6 +254,43 @@ use `ui:widget: password` or set some properties of `ui:backstage`: show: false # wont print any info about 'hidden' property on Review Step ``` +### Remove sections or fields based on feature flags + +Based on feature flags you can hide sections or even only fields of your +template. This is a good use case if you want to test experimental parameters in +a production environment. To use it let's look at the following template: + +```yaml +spec: + type: website + owner: team-a + parameters: + - name: Enter some stuff + description: Enter some stuff + backstage:featureFlag: experimental-feature + properties: + inputString: + type: string + title: string input test + inputObject: + type: object + title: object input test + description: a little nested thing never hurt anyone right? + properties: + first: + type: string + title: first + backstage:featureFlag: nested-experimental-feature + second: + type: number + title: second +``` + +If you have a feature flag `experimental-feature` active then +your first step would be shown. The same goes for the nested properties in the +spec. Make sure to use the key `backstage:featureFlag` in your templates if +you want to use this functionality. + ### The Repository Picker In order to make working with repository providers easier, we've built a custom