This repository was archived by the owner on Mar 31, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
main/java/com/spotify/plugin/dockerfile
test/java/com/spotify/plugin/dockerfile Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public class BuildMojo extends AbstractDockerMojo {
5353 /**
5454 * Regex for a valid docker repository name. Used in validateRepository().
5555 */
56- private static final String VALID_REPO_REGEX = "^([a-z0-9_.-])+(\\ /[a-z0-9_.-]+)*$" ;
56+ private static final String VALID_REPO_REGEX = "^([a-z0-9_.-])+(:[0-9]{1,5})?( \\ /[a-z0-9_.-]+)*$" ;
5757
5858 /**
5959 * Directory containing the the build context. This is typically the directory that contains
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ public void testSuccess() throws MojoFailureException {
4747 assertTrue ("Start and end with dots" , BuildMojo .validateRepository (".start.and.end." ));
4848 assertTrue ("Start and end with hyphens" , BuildMojo .validateRepository ("-start-and-end-" ));
4949 assertTrue ("Start and end with underscores" , BuildMojo .validateRepository ("_start_and_end_" ));
50+ assertTrue ("May contain port" , BuildMojo .validateRepository ("example.com:443/okay./.path" ));
5051 // Forward slash delimits the repo user from the repo name; strictly speaking,
5152 // you're allowed only one slash, somewhere in the middle.
5253 assertTrue ("Multipart" , BuildMojo .validateRepository ("with/forwardslash" ));
@@ -59,5 +60,8 @@ public void testFailCases() {
5960 assertFalse ("Symbols didn't fail" , BuildMojo .validateRepository ("ddddddDd+dddd" ));
6061 assertFalse ("Starting slash didn't fail" , BuildMojo .validateRepository ("/atstart" ));
6162 assertFalse ("Ending slash didn't fail" , BuildMojo .validateRepository ("atend/" ));
63+ assertFalse ("Only port" , BuildMojo .validateRepository (":443" ));
64+ assertFalse (
65+ "Port exceeding range" , BuildMojo .validateRepository ("example.com:100000/myproject" ));
6266 }
6367}
You can’t perform that action at this time.
0 commit comments