diff --git a/percy/environment.py b/percy/environment.py index 491b640..8233823 100644 --- a/percy/environment.py +++ b/percy/environment.py @@ -281,7 +281,7 @@ def commit_sha(self): @property def parallel_nonce(self): - return os.getenv('CI_BUILD_NUMBER') + return os.getenv('CI_BUILD_NUMBER') or os.getenv('CI_BUILD_ID') @property def parallel_total_shards(self): diff --git a/tests/test_environment.py b/tests/test_environment.py index 71f0428..4f4cbbd 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -64,6 +64,7 @@ def clear_env_vars(self): 'CI_PULL_REQUEST', 'CI_COMMIT_ID', 'CI_BUILD_NUMBER', + 'CI_BUILD_ID', 'CI_NODE_TOTAL', # Unset Drone vars. @@ -350,6 +351,7 @@ def setup_method(self, method): os.environ['CI_NAME'] = 'codeship' os.environ['CI_BRANCH'] = 'codeship-branch' os.environ['CI_BUILD_NUMBER'] = 'codeship-build-number' + os.environ['CI_BUILD_ID'] = 'codeship-build-id' os.environ['CI_PULL_REQUEST'] = 'false' # This is always false on Codeship, unfortunately. os.environ['CI_COMMIT_ID'] = 'codeship-commit-sha' os.environ['CI_NODE_TOTAL'] = '3' @@ -366,6 +368,8 @@ def test_commit_sha(self): def test_parallel_nonce(self): assert self.environment.parallel_nonce == 'codeship-build-number' + del os.environ['CI_BUILD_NUMBER'] + assert self.environment.parallel_nonce == 'codeship-build-id' def test_parallel_total(self): assert self.environment.parallel_total_shards == 3