Skip to content

Commit

Permalink
make parsing ignore sequence digits
Browse files Browse the repository at this point in the history
Ref SPIN-1754. For some use-cases we may need
to support a larger number of digits for group
sequence numbers. This change makes the parsing
more lenient to the number of digits in the
sequence.

Tools such as spinnaker that are creating the
resources would be responsible for figuring out
the appropriate number of digits and worrying
about padding. This change is to allow tools
that just consume the group names to move forward.
  • Loading branch information
brharrington committed Jun 1, 2016
1 parent 7022e81 commit 5a8ef31
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/netflix/frigga/NameConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public interface NameConstants {

String NAME_CHARS = "a-zA-Z0-9._";
String NAME_HYPHEN_CHARS = "-a-zA-Z0-9._";
String PUSH_FORMAT = "v([0-9]{3})";
String PUSH_FORMAT = "v([0-9]+)";
String LABELED_VAR_SEPARATOR = "0";
String LABELED_VARIABLE = "[a-zA-Z][" + LABELED_VAR_SEPARATOR + "][a-zA-Z0-9]+";

Expand Down
22 changes: 22 additions & 0 deletions src/test/groovy/com/netflix/frigga/NamesSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ class NamesSpec extends Specification {
"v406" == names.push
406 == names.sequence

when:
names = Names.parseName("api-test-A-v40600")
then:
"api-test-A-v40600" == names.group
"api-test-A" == names.cluster
"api" == names.app
"test" == names.stack
"A" == names.detail
"v40600" == names.push
40600 == names.sequence

when:
names = Names.parseName("api-test-A-v4")
then:
"api-test-A-v4" == names.group
"api-test-A" == names.cluster
"api" == names.app
"test" == names.stack
"A" == names.detail
"v4" == names.push
4 == names.sequence

when:
names = Names.parseName("api-test101")
then:
Expand Down

0 comments on commit 5a8ef31

Please sign in to comment.