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

fix(cli): add stricter validation to svc names #2016

Merged
merged 3 commits into from
Mar 4, 2021

Conversation

bvtujo
Copy link
Contributor

@bvtujo bvtujo commented Mar 4, 2021

As discussed in #2005, providing consecutive or trailing hyphens in the service or job name causes the ECR repository to fail to deploy. This is due to undocumented validation behavior in ECR, where trailing or consecutive punctuation characters are invalid names.

Invalid service and job names will now fail at validation, not during a StackSet update, avoiding a problem where the StackSet became unmanageable by Copilot.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@iamhopaul123 iamhopaul123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you so much for the quick turn around on this!

Comment on lines 59 to 64
// s3 validation expressions.
// s3RegExp matches alphanumeric, .- from 3 to 63 characters long.
// s3DashesRegExp matches consecutive dashes or periods
// s3TrailingDashRegExp matches a trailing dash
// punctuationRegExp matches consecutive dashes or periods
// trailingPunctRegExp matches a trailing dash
// ipAddressRegExp checks for a bucket in the format of an IP address.
// https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we have duplicated comments for explaining the same thing. Can we remove one of them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They look like they handle different things-- one is -- and the other is someName-, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's exactly right

@huanjani
Copy link
Contributor

huanjani commented Mar 4, 2021

Looks good, and yes-- speedy turnaround!
Nit: do we need periods at the ends of comment lines?

@bvtujo
Copy link
Contributor Author

bvtujo commented Mar 4, 2021

@huanjani Yes; fixed in the latest push.

Copy link
Contributor

@huanjani huanjani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@mergify mergify bot merged commit 8ff70c9 into aws:mainline Mar 4, 2021
Sprint 🏃‍♀️ automation moved this from In review to Pending release Mar 4, 2021
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
<!-- Provide summary of changes -->
As discussed in aws#2005, providing consecutive or trailing hyphens in the service or job name causes the ECR repository to fail to deploy. This is due to undocumented validation behavior in ECR, where trailing or consecutive punctuation characters are invalid names. 

Invalid service and job names will now fail at validation, not during a StackSet update, avoiding a problem where the StackSet became unmanageable by Copilot. 

<!-- Issue number, if available. E.g. "Fixes aws#31", "Addresses aws#42, 77" -->

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Sprint 🏃‍♀️
  
Pending release
Development

Successfully merging this pull request may close these issues.

None yet

3 participants