From a39f23ad389f332d13dffcdcf6f31ff15d2ff4b5 Mon Sep 17 00:00:00 2001 From: Alex Tsai Date: Mon, 13 May 2019 13:22:58 -0700 Subject: [PATCH 1/3] don't use CIRCLE_WORKFLOW_WORKSPACE_ID for parallel nonce as it is not unique between retries --- percy/environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/percy/environment.py b/percy/environment.py index 8233823..2b225c6 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_WORKFLOW_WORKSPACE_ID') or os.getenv('CIRCLE_BUILD_NUM') + return os.getenv('CIRCLE_BUILD_NUM') @property def parallel_total_shards(self): From cfc4626990da27c35c39e3dacd2797468fe6501e Mon Sep 17 00:00:00 2001 From: Alex Tsai Date: Mon, 13 May 2019 14:34:26 -0700 Subject: [PATCH 2/3] updated test --- tests/test_environment.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_environment.py b/tests/test_environment.py index 4f4cbbd..4a14b3d 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -337,8 +337,6 @@ 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): From 34dd47b9547a5094d31d6b1f4d97ca2e9a3ebb9c Mon Sep 17 00:00:00 2001 From: Alex Tsai Date: Thu, 5 Dec 2019 10:35:54 -0800 Subject: [PATCH 3/3] switch to CIRCLE_WORKFLOW_ID --- percy/environment.py | 2 +- tests/test_environment.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/percy/environment.py b/percy/environment.py index 2b225c6..5724eab 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_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 4a14b3d..cbde924 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -322,7 +322,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_WORKFLOW_ID'] = 'circle-workflow-id' os.environ['CIRCLE_NODE_TOTAL'] = '3' os.environ['CI_PULL_REQUESTS'] = 'https://github.com/owner/repo-name/pull/123' self.environment = percy.Environment() @@ -337,6 +337,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-id' + del os.environ['CIRCLE_WORKFLOW_ID'] assert self.environment.parallel_nonce == 'circle-build-number' def test_parallel_total(self):