taskcat icon indicating copy to clipboard operation
taskcat copied to clipboard

Supporting custom stack name - prefix, suffix, fixed

Open sshvans opened this issue 6 years ago • 4 comments

Feature request

Ability to customize the stack name for stacks created by taskcat test run. It will especially be useful when user is using an external system to generate a name which they want to use to associate with the stack, such as Jenkins job id or CodeBuild run id.

Proposal: Add following 3 flags:

  • --custom-stackname-prefix 'stackprefix'
  • --custom-stackname-suffix 'stacksuffix'
  • --custom-stackname 'hardcoded-name'

sshvans avatar Apr 23 '20 21:04 sshvans

I feel that instead of creating additional flags, it will be a better fit for taskcat config file. User can provide following 3 attribute values either at the project level or at per test level. Only 1 of the following attributes are allowed.

  • stackname
  • stackname-suffix
  • stackname-prefix

Example:

project:
    stackname: "mystack"

project:
    stackname-prefix: "myprefix"

project:
    stackname-suffix: "suffix"

OR

tests:
    test1:
        stackname: "my-test1-stackname"
    
    test2:
        stackname-prefix: "my-test2-prefix"
    
    test3:
        stackname-suffix: "my-test3-suffix"

sshvans avatar Jun 03 '20 23:06 sshvans

@jaymccon @andrew-glenn what do you guys think?

sshvans avatar Jun 03 '20 23:06 sshvans

Edit:

Clarifying a bit, we currently have a design goal that any CLI arguments are 1:1 to config options. I didn’t make that clear in my original comments.

However, the config is an area that scales better as we aren’t maintaining the same CLI arguments across multiple sub-commands. In this case, it’s a compelling argument.

The logic to invalidate a combination of arguments is something I think we should dial-in after we have the config options present in a PR.

If anyone wants to take a stab at this, pull requests are welcome.

andrew-glenn avatar Jun 03 '20 23:06 andrew-glenn

seeing as this is niche, I'd vote for it being config only, and users wanting to can set with env vars at runtime similar to:

TASKCAT_PROJECT_STACKNAME_SUFFIX=${JOB_ID} taskcat test run

jaymccon avatar Jun 22 '20 18:06 jaymccon