diff --git a/percy/environment.py b/percy/environment.py index 90f1882..491b640 100644 --- a/percy/environment.py +++ b/percy/environment.py @@ -251,7 +251,7 @@ def commit_sha(self): @property def parallel_nonce(self): - return os.getenv('CIRCLE_BUILD_NUM') + return os.getenv('CIRCLE_WORKFLOW_WORKSPACE_ID') or os.getenv('CIRCLE_BUILD_NUM') @property def parallel_total_shards(self): diff --git a/tests/test_environment.py b/tests/test_environment.py index 31e9b8e..71f0428 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -54,6 +54,7 @@ def clear_env_vars(self): 'CIRCLE_SHA1', 'CIRCLE_BRANCH', 'CIRCLE_BUILD_NUM', + 'CIRCLE_WORKFLOW_WORKSPACE_ID', 'CI_PULL_REQUESTS', 'CIRCLE_NODE_TOTAL', @@ -320,6 +321,7 @@ def setup_method(self, method): os.environ['CIRCLE_BRANCH'] = 'circle-branch' os.environ['CIRCLE_SHA1'] = 'circle-commit-sha' os.environ['CIRCLE_BUILD_NUM'] = 'circle-build-number' + os.environ['CIRCLE_WORKFLOW_WORKSPACE_ID'] = 'circle-workflow-workspace-id' os.environ['CIRCLE_NODE_TOTAL'] = '3' os.environ['CI_PULL_REQUESTS'] = 'https://github.com/owner/repo-name/pull/123' self.environment = percy.Environment() @@ -334,6 +336,8 @@ def test_commit_sha(self): assert self.environment.commit_sha == 'circle-commit-sha' def test_parallel_nonce(self): + assert self.environment.parallel_nonce == 'circle-workflow-workspace-id' + del os.environ['CIRCLE_WORKFLOW_WORKSPACE_ID'] assert self.environment.parallel_nonce == 'circle-build-number' def test_parallel_total(self):