diff --git a/cli/pkg/scanners/file_scanner.go b/cli/pkg/scanners/file_scanner.go index 7e3108bd2..a92c7b6c6 100644 --- a/cli/pkg/scanners/file_scanner.go +++ b/cli/pkg/scanners/file_scanner.go @@ -80,7 +80,8 @@ func getTargetRegex(target string) string { if strings.HasSuffix(target, "-*") { // Should start with given target // followed by hyphen and followed by one or more lowercase letters or numbers - return fmt.Sprintf("^%s-(?:[a-z0-9]+)?$", regexp.QuoteMeta(target[:len(target)-2])) + // allows for additional hyphenated alphanumeric sequences + return fmt.Sprintf("^%s-[a-z0-9]+(?:-[a-z0-9]+)*$", regexp.QuoteMeta(target[:len(target)-2])) } // Match the exact target diff --git a/cli/pkg/scanners/file_scanner_test.go b/cli/pkg/scanners/file_scanner_test.go index d85bec215..976082a72 100644 --- a/cli/pkg/scanners/file_scanner_test.go +++ b/cli/pkg/scanners/file_scanner_test.go @@ -113,6 +113,8 @@ var _ = Describe("FileScanner", func() { }, Entry("scanning 'docker', target in file is 'docker'", "docker", "docker"), Entry("scanning 'docker-*', target in file is 'docker-test'", "docker-*", "docker-test"), + Entry("scanning 'docker-*', target in file is 'docker-test-test2'", "docker-*", "docker-test-test2"), + Entry("scanning 'docker-*', target in file is 'docker-test-test2-test3'", "docker-*", "docker-test-test2-test3"), ) DescribeTable("when Earthfile contain no target", func(target string) { diff --git a/docs/src/onboarding/index.md b/docs/src/onboarding/index.md index 5aafdbee9..5193c81e3 100644 --- a/docs/src/onboarding/index.md +++ b/docs/src/onboarding/index.md @@ -57,7 +57,7 @@ The output of the check phase may looks like the following: ```json { - "/home/work/test": ["check-test1", "check-test2", "check-test3"], + "/home/work/test": ["check-test1", "check-test2", "check-test3", "check-test-test4"], "/home/work/test2": ["check"] } ``` @@ -71,7 +71,8 @@ The output of the check phase may looks like the following: This list of `path` is fed into a [matrix job](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs) that multiplexes executing the filtered targets from each of the discovered `Earthfile`s. The filtered targets will be retrieved from the map according to which Earthfile is currently running. -For example, from the above example, running `/home/work/test` will run the targets `check-test1`, `check-test2`, and `check-test3`. +For example, from the above example, running `/home/work/test` will run the targets `check-test1`, `check-test2`, `check-test3` and +`check-test-test4`. Executing each discovered Earthfile in parallel will maximize network throughput and create a more easily digestible view of the CI status. @@ -183,7 +184,7 @@ The examples are provided below: ```json { - "/home/work/test": ["check-test1", "check-test2", "check-test3"], + "/home/work/test": ["check-test1", "check-test2", "check-test3", "check-test-test4"], "/home/work/test2": ["check-test1"] } ```