-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add flag to limit by number of projects to number of changed files (#…
…1846) * add flag to limit by number of projects to number of changed files * fix build
- Loading branch information
Showing
2 changed files
with
14 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,11 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strconv" | ||
) | ||
|
||
func GetMaxProjectsCreated() int { | ||
// the maximum number of impacted projects possible for a change | ||
// digger will fail when this number exceeds it | ||
// default value of 0 or negative means unlimited allowed | ||
maxProjects := os.Getenv("DIGGER_MAX_PROJECTS_IMPACTED") | ||
maxProjectsNum, err := strconv.Atoi(maxProjects) | ||
if err != nil { | ||
fmt.Printf("Error converting env var to number: %v\n", err) | ||
return 0 | ||
} | ||
return maxProjectsNum | ||
func LimitByNumOfFilesChanged() bool { | ||
// if this flag is set then it will fail if there are more projects impacted than the | ||
// number of files changed | ||
return os.Getenv("DIGGER_LIMIT_MAX_PROJECTS_TO_FILES_CHANGED") == "1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters