From 388981afbda5e4bccdd95c7e3858d6532cf9e3df Mon Sep 17 00:00:00 2001 From: Ruud Senden <8635138+rsenden@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:42:43 +0200 Subject: [PATCH] chore: setup-appversion action improvements --- .../cli/ssc/actions/zip/setup-appversion.yaml | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/fcli-core/fcli-ssc/src/main/resources/com/fortify/cli/ssc/actions/zip/setup-appversion.yaml b/fcli-core/fcli-ssc/src/main/resources/com/fortify/cli/ssc/actions/zip/setup-appversion.yaml index e47b8385f9..7974a3b362 100644 --- a/fcli-core/fcli-ssc/src/main/resources/com/fortify/cli/ssc/actions/zip/setup-appversion.yaml +++ b/fcli-core/fcli-ssc/src/main/resources/com/fortify/cli/ssc/actions/zip/setup-appversion.yaml @@ -6,11 +6,19 @@ usage: description: | This action is primarily meant for use in CI/CD integrations, allowing users to provide a custom action with a customized application version setup process. For - example, such a custom action could predefine some standard users, attributes or - issue template to be set on newly created application versions. This built-in - action just invokes the `fcli ssc appversion create` command, always passing - `--skip-if-exists` and the required application version name, together with any - other creation options if specified. + example, such a custom action could define standard profiles (based on team, + business unit, application type/risk, ...) with predefined users, attributes or + issue template to be set on newly created application versions. Of course, instead + of having a single custom action that defines profiles, you could also provide + multiple custom actions that users can select from, or you can use a combination; + each business unit or team providing their own custom action, with each of these + custom actions defining profiles for different application types/risk. This + built-in action only provides a 'default' profile that simply invokes the + `fcli ssc appversion create` command, passing the following options by default: + `--skip-if-exists`, `--auto-required-attrs`, `--refresh`, `--refresh-timeout 300s`. + Additional creation options can be passed through the various action options, which + includes the ability to override the default refresh timeout (only applicable when + copying an existing application version). defaults: requestTarget: ssc @@ -20,12 +28,11 @@ parameters: cliAliases: av required: true description: "Required application version name as :" - - group: av_create_opts - required: false - name: active - defaultValue: true - description: "See 'fcli ssc av create'" - type: boolean + - name: profile + cliAliases: p + required: true + defaultValue: default + description: "This built-in action only supports the 'default' profile, which is selected by default" - group: av_create_opts required: false name: add-users @@ -35,12 +42,6 @@ parameters: name: attrs cliAliases: attributes description: "See 'fcli ssc av create'" - - group: av_create_opts - required: false - name: auto-required-attrs - defaultValue: true - description: "See 'fcli ssc av create'" - type: boolean - group: av_create_opts required: false name: copy @@ -61,16 +62,24 @@ parameters: description: "See 'fcli ssc av create'" - group: av_create_opts required: false - name: refresh - defaultValue: true - description: "See 'fcli ssc av create'" + name: refresh-timeout + defaultValue: "300s" + description: "See 'fcli ssc av create'. Default value: 300s" steps: - - progress: Creating SSC application version if non-existing + - progress: "Creating SSC application version if non-existing (profile: ${parameters.profile})" + - if: ${parameters.profile=="default"} + set: + - name: avCreateArgs + value: --skip-if-exists --auto-required-attrs --refresh ${#action.copyParametersFromGroup("av_create_opts")} + # Custom actions can replace/repeat the above to define custom profiles. + - if: ${avCreateArgs==null} + throw: "Invalid profile: ${parameters.profile}" - fcli: - name: createAppVersion - args: ssc av create ${parameters.appversion} --skip-if-exists ${#action.copyParametersFromGroup("av_create_opts")} + args: ssc av create ${parameters.appversion} ${avCreateArgs} - write: - to: stdout - value: "Create application version ${parameters.appversion} (id ${createAppVersion[0].id}): ${createAppVersion[0].__action__}" + value: | + Create application version ${parameters.appversion} (id ${createAppVersion[0].id}): ${createAppVersion[0].__action__}