Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

greedy pattern matching no longer supported in sceptre==2.4.0 #941

Open
mattthaber opened this issue Oct 5, 2020 · 7 comments
Open

greedy pattern matching no longer supported in sceptre==2.4.0 #941

mattthaber opened this issue Oct 5, 2020 · 7 comments

Comments

@mattthaber
Copy link

mattthaber commented Oct 5, 2020

hey! currently i use sceptre validate by passing it the the stack path directly like ...

sceptre validate matthaber-dev/infrastructure

with a folder structure looks basically like ...

matthaber-dev
        application.yaml
        infrastructure.yaml
sandbox 
        application.yaml
        infrastructure.yaml
prod 
        application.yaml
        infrastructure.yaml

with Sceptre==2.3.0 this always worked. However, ever since upgrading to sceptre==2.4.0 it no longer does. It now gives me the following error...

$ sceptre validate matthaber-dev/infrastructure
"No stacks detected from the given path 'matthaber-dev/infrastructure'. Valid stack paths are: []"

If i run the validate on the entire folder it validates fine

$ sceptre validate matthaber-dev
Template matthaber-dev/infrastructure is valid. Template details:
Template matthaber-dev/application is valid. Template details:

its only when wanting to validate a single template does it not work.

Is this an expected behaviour change with 2.4.0 where i can no longer validate a single template by passing the entire path?

@mattthaber
Copy link
Author

closing my own ticket as i found that i just needed to add the .yaml extension.

$ sceptre validate matthaber-dev/infrastructure.yaml
Template matthaber-dev/infrastructure is valid. Template details:

this now works. Should be noted this behavour did seemingly change from 2.3.0 -> 2.4.0

@ngfgrant
Copy link
Contributor

ngfgrant commented Oct 5, 2020

Glad you managed to move forward @mhaber-tophat - I am like 90% sure we haven't supported .yml previously so not sure how this was working!

@zaro0508 zaro0508 changed the title sceptre==2.4.0 validate cant find stack with given path sceptre==2.4.0 cant find stack with given path Oct 6, 2020
@zaro0508
Copy link
Contributor

zaro0508 commented Oct 6, 2020

I think this is a real issue. I noticed that one of my automated deployments broke which worked with ver 2.3.0.

I used the command sceptre delete develop/sc-product-assoc-ec2 --yes which in ver 2.3.0 would do a greedy match of files in the develop folder and deploy all of the files that matched:

 ➜ ll ./config/develop/sc-product-assoc-ec2*
-rw-r--r--  1 zaro0508  staff   378B Jun 23 11:34 config/develop/sc-product-assoc-ec2-linux-jumpcloud-notebook.yaml
-rw-r--r--  1 zaro0508  staff   381B Jun 23 11:34 config/develop/sc-product-assoc-ec2-linux-jumpcloud-workflows.yaml
-rw-r--r--  1 zaro0508  staff   351B Jun 23 11:34 config/develop/sc-product-assoc-ec2-linux-jumpcloud.yaml
-rw-r--r--  1 zaro0508  staff   357B Jun 23 11:34 config/develop/sc-product-assoc-ec2-linux-windows-jumpcloud.yaml 

in ver 2.4.0 it fails with No stacks detected from the given path 'develop/sc-product-assoc-ec2':

$ sceptre delete $TRAVIS_BRANCH/sc-product-assoc-ec2 --yes

"No stacks detected from the given path 'develop/sc-product-assoc-ec2'. Valid stack paths are: ['develop/cfn-cr-synapse-tagger.yaml', 'develop/cfn-macro-ssm-param.yaml', 'develop/cfn-s3objects-macro.yaml', 'develop/cfn-cr-saml-provider.yaml', 'develop/sc-product-ec2-windows-jumpcloud.yaml', 'develop/cesspoolvpc.yaml', 'develop/sc-ec2-actions.yaml', 'develop/s3-cesspoolvpc-gateway-endpoint.yaml', 'develop/sc-product-s3-private-enc.yaml', 'develop/sc-portfolio-ec2.yaml', 'develop/peer-vpn-cesspoolvpc.yaml', 'develop/sc-product-ec2-linux-jumpcloud-notebook.yaml', 'develop/maintenance.yaml', 'develop/alb-notebook-access-logsbucket.yaml', 'develop/sc-product-s3-synapse.yaml', 'develop/cfn-explode-macro.yaml', 'develop/sc-product-assoc-ec2-linux-jumpcloud.yaml', 'develop/alb-notebook-access.yaml', 'develop/sc-product-ec2-linux-jumpcloud.yaml', 'develop/AccountAlertTopics.yaml', 'develop/lambda-send-budget-alert.yaml', 'develop/synapse-oidc-idp.yaml', 'develop/cfn-ssm-param-policy.yaml', 'develop/sc-product-ec2-linux-jumpcloud-workflows.yaml', 'develop/cfn-cr-bucket-tagger.yaml', 'develop/sc-product-assoc-ec2-linux-jumpcloud-workflows.yaml', 'develop/sc-kms-key.yaml', 'develop/jumpcloud-idp.yaml', 'develop/get-role-policy.yaml', 'develop/sc-tag-options-external.yaml', 'develop/sc-s3-launchrole.yaml', 'develop/park-my-cloud.yaml', 'develop/essentials.yaml', 'develop/sc-ec2vpc-launchrole.yaml', 'develop/sc-portfolio-ec2-external.yaml', 'develop/sc-product-assoc-ec2-linux-jumpcloud-notebook.yaml', 'develop/bootstrap.yaml', 'develop/sc-enduser-iam.yaml', 'develop/cfn-tag-instance-policy.yaml', 'develop/sc-portfolio-s3-basic.yaml', 'develop/sc-product-assoc-ec2-linux-windows-jumpcloud.yaml', 'develop/cfn-cr-sc-bucket-policy.yaml', 'develop/rotate-credentials.yaml', 'develop/cfn-cr-alb-rule.yaml', 'develop/cfn-cr-sc-actions-provider.yaml', 'develop/sc-tag-options.yaml', 'develop/lambda-budgets.yaml', 'prod/cfn-cr-synapse-tagger.yaml', 'prod/cfn-macro-ssm-param.yaml', 'prod/cfn-s3objects-macro.yaml', 'prod/cfn-cr-saml-provider.yaml', 'prod/sc-product-ec2-windows-jumpcloud.yaml', 'prod/peer-vpn-internalpoolvpc.yaml', 'prod/sc-ec2-actions.yaml', 'prod/sc-product-s3-private-enc.yaml', 'prod/sc-portfolio-ec2.yaml', 'prod/sc-product-ec2-linux-jumpcloud-notebook.yaml', 'prod/alb-notebook-access-logsbucket.yaml', 'prod/sc-product-s3-synapse.yaml', 'prod/cfn-explode-macro.yaml', 'prod/sc-product-assoc-ec2-linux-jumpcloud.yaml', 'prod/alb-notebook-access.yaml', 'prod/sc-product-ec2-linux-jumpcloud.yaml', 'prod/AccountAlertTopics.yaml', 'prod/lambda-send-budget-alert.yaml', 'prod/synapse-oidc-idp.yaml', 'prod/cfn-ssm-param-policy.yaml', 'prod/sc-product-ec2-linux-jumpcloud-workflows.yaml', 'prod/cfn-cr-bucket-tagger.yaml', 'prod/guardduty-member.yaml', 'prod/sc-product-assoc-ec2-linux-jumpcloud-workflows.yaml', 'prod/sc-kms-key.yaml', 'prod/jumpcloud-idp.yaml', 'prod/get-role-policy.yaml', 'prod/internalpoolvpc.yaml', 'prod/sc-tag-options-external.yaml', 'prod/sc-s3-launchrole.yaml', 'prod/s3-internalpoolvpc-gateway-endpoint.yaml', 'prod/park-my-cloud.yaml', 'prod/essentials.yaml', 'prod/sc-ec2vpc-launchrole.yaml', 'prod/sc-portfolio-ec2-external.yaml', 'prod/sc-product-assoc-ec2-linux-jumpcloud-notebook.yaml', 'prod/bootstrap.yaml', 'prod/sc-enduser-iam.yaml', 'prod/cfn-tag-instance-policy.yaml', 'prod/sc-portfolio-s3-basic.yaml', 'prod/sc-product-assoc-ec2-linux-windows-jumpcloud.yaml', 'prod/cfn-cr-sc-bucket-policy.yaml', 'prod/rotate-credentials.yaml', 'prod/cfn-cr-alb-rule.yaml', 'prod/cfn-cr-sc-actions-provider.yaml', 'prod/sc-tag-options.yaml', 'prod/lambda-budgets.yaml', 'strides/cfn-cr-saml-provider.yaml', 'strides/stridespoolvpc.yaml', 'strides/AccountAlertTopics.yaml', 'strides/guardduty-member.yaml', 'strides/jumpcloud-idp.yaml', 'strides/essentials.yaml', 'strides/bootstrap.yaml', 'strides/peer-vpn-stridespoolvpc.yaml', 'strides/rotate-credentials.yaml']"

The command "sceptre delete $TRAVIS_BRANCH/sc-product-assoc-ec2 --yes" exited with 1.

@zaro0508 zaro0508 reopened this Oct 6, 2020
@craighurley
Copy link
Contributor

@zaro0508 greedy pattern matching was raised as a concern here: #836

and fixed in #731

Having greedy pattern matching could result in stacks being deleted for a simple typo. I have used greedy pattern matching like you did for convenience, but because it caught people out, I am in favour of the behaviour in 2.4.0.

@craighurley
Copy link
Contributor

Maybe there a happy ground that can be reached with the addition of an argument to optionally enable greedy path matching?

@ngfgrant
Copy link
Contributor

ngfgrant commented Oct 7, 2020

Yeh I was just thinking that Craig I think by default it should be safe but wouldn’t be much work to add a —greedy flag or something like that

@pipozzz
Copy link

pipozzz commented Nov 30, 2020

Same issue here. I used to work with that greedy selection so far but now it's gone :( , any ETA for greedy flag, pls?

@zaro0508 zaro0508 changed the title sceptre==2.4.0 cant find stack with given path greedy pattern matching no longer supported in sceptre==2.4.0 Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants