Skip to content

Commit

Permalink
support 3-6 digit push sequence (#32)
Browse files Browse the repository at this point in the history
need to not break some existing deploys using a 6 digit sequence number, but this is still small enough
that tracking a standard width git short sha (8 characters) won't conflict.
  • Loading branch information
cfieber authored Mar 14, 2020
1 parent 0f36601 commit bc5b9fe
Show file tree
Hide file tree
Showing 2 changed files with 25 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 @@ -23,7 +23,7 @@ public interface NameConstants {
String NAME_CHARS = "a-zA-Z0-9._";
String EXTENDED_NAME_CHARS = NAME_CHARS + "~\\^";
String NAME_HYPHEN_CHARS = "-" + EXTENDED_NAME_CHARS;
String PUSH_FORMAT = "v([0-9]{3})";
String PUSH_FORMAT = "v([0-9]{3,6})";

String COUNTRIES_KEY = "c";
String DEV_PHASE_KEY = "d";
Expand Down
24 changes: 24 additions & 0 deletions src/test/groovy/com/netflix/frigga/NamesSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,30 @@ class NamesSpec extends Specification {
null == names.sequence
}

def 'supports 3-6 digit push sequence'() {
when:
Names names = Names.parseName(name)

then:
group == names.group
cluster == names.cluster
app == names.app
stack == names.stack
detail == names.detail
push == names.push
sequence == names.sequence

where:
name || group || cluster || app || stack || detail || push || sequence
'foo-v1' || 'foo-v1' || 'foo-v1' || 'foo' || 'v1' || null || null || null
'foo-v01' || 'foo-v01' || 'foo-v01' || 'foo' || 'v01' || null || null || null
'foo-v001' || 'foo-v001' || 'foo' || 'foo' || null || null || 'v001' || 1
'foo-v0001' || 'foo-v0001' || 'foo' || 'foo' || null || null || 'v0001' || 1
'foo-v00001' || 'foo-v00001' || 'foo' || 'foo' || null || null || 'v00001' || 1
'foo-v000001' || 'foo-v000001' || 'foo' || 'foo' || null || null || 'v000001' || 1
'foo-v0000001' || 'foo-v0000001' || 'foo-v0000001' || 'foo' || 'v0000001' || null || null || null
}

def 'should dissect group names'() {
when:
Names names = Names.parseName(null)
Expand Down

0 comments on commit bc5b9fe

Please sign in to comment.