Skip to content

Commit

Permalink
utils: log envvar SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT when invalid (#4041
Browse files Browse the repository at this point in the history
)

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
  • Loading branch information
mr-cal authored Feb 23, 2023
1 parent ce9c24e commit 1f8bef6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions snapcraft/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,13 @@ def get_parallel_build_count() -> int:
)
build_count = 1

max_count_env = os.environ.get("SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT", "")
try:
max_count = int(os.environ.get("SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT", ""))
max_count = int(max_count_env)
if max_count > 0:
build_count = min(build_count, max_count)
except ValueError:
emit.debug("Invalid SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT value")
emit.debug(f"Invalid SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT {max_count_env!r}")

return build_count

Expand Down

0 comments on commit 1f8bef6

Please sign in to comment.