Skip to content

Commit 7ed8714

Browse files
Merge pull request #420 from adamtheturtle/DOUBLE-builds
Double builds
2 parents 13b3d24 + 913b881 commit 7ed8714

File tree

4 files changed

+18
-31
lines changed

4 files changed

+18
-31
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,27 @@ The configuration for this is in `.travis.yml`.
9494
Travis CI is set up with secrets for connecting to Vuforia.
9595
These variables include those from `vuforia_secrets.env.example`.
9696

97-
They also include another set of variables especially for running the tests on the `master` branch.
98-
The tests are run daily against the `master` branch.
99-
This means that when the daily request quota is used, the `master` branch may show as failing on the `README`.
100-
Using the request quota on the `master` branch also leaves fewer requests for regular development.
101-
Therefore, `master` is given its own Vuforia database with separate limits.
97+
To avoid hitting request quotas and to avoid conflicts when running multiple tests in prallel, we use multiple target databases.
98+
99+
Travis builds use a different credentials file depending on the build number.
100+
For example, build 2045.1 will use a different credentials file to build 2045.2.
101+
This should avoid conflicts, but in theory the same credentials file may be run across two Pull Request builds.
102+
This may cause errors.
102103

103104
### How to set Travis CI secrets
104105

105106
Create environment variable files for secrets:
106107

107108
```sh
108109
mkdir -p ci_secrets
109-
cp vuforia_secrets.env.example ci_secrets/vuforia_secrets_0.env
110-
cp vuforia_secrets.env.example ci_secrets/vuforia_secrets_master.env
110+
cp vuforia_secrets.env.example ci_secrets/vuforia_secrets_1.env
111+
cp vuforia_secrets.env.example ci_secrets/vuforia_secrets_2.env
112+
...
111113
```
112114

113-
Add Vuforia credentials to the file `ci_secrets/vuforia_secrets.env` and `ci_secrets/vuforia_secrets_master.env`.
115+
Add Vuforia credentials for different target databases to the new files in the `ci_secrets/` directory.
116+
Add as many credentials files as there are builds in the Travis matrix.
117+
All credentials files can share the same credentials for an inactive database.
114118

115119
Install the Travis CLI:
116120

ci/set_secrets_file.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,20 @@
22
Move the right secrets file into place for Travis CI.
33
"""
44

5-
import math
65
import os
76
import shutil
87
from pathlib import Path
98

10-
CONCURRENT_BUILDS = 1
11-
129

1310
def move_secrets_file() -> None:
1411
"""
1512
Move the right secrets file to the current directory.
1613
"""
17-
branch = os.environ['TRAVIS_BRANCH']
18-
is_pr = os.environ['TRAVIS_PULL_REQUEST'] != 'false'
19-
is_master = branch == 'master'
20-
14+
travis_job_number = os.environ['TRAVIS_JOB_NUMBER']
15+
travis_builder_number = travis_job_number.split('.')[-1]
2116
secrets_dir = Path('ci_secrets')
22-
23-
travis_build_number = float(os.environ['TRAVIS_BUILD_NUMBER'])
24-
travis_job_number = float(os.environ['TRAVIS_JOB_NUMBER'])
25-
travis_builder_number = math.ceil(
26-
(travis_job_number - travis_build_number) * 10
27-
)
28-
29-
if is_master and not is_pr:
30-
suffix = 'master'
31-
else:
32-
suffix = str(travis_builder_number % CONCURRENT_BUILDS)
33-
34-
secrets_path = secrets_dir / f'vuforia_secrets_{suffix}.env'
35-
17+
secrets_path = secrets_dir / f'vuforia_secrets_{travis_builder_number}.env'
18+
print(f'Using: {secrets_path}')
3619
shutil.copy(secrets_path, './vuforia_secrets.env')
3720

3821

secrets.tar.enc

67.5 KB
Binary file not shown.

tests/mock_vws/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,13 @@ def database_summary(vuforia_database_keys: VuforiaDatabaseKeys) -> Response:
295295
return response
296296

297297

298-
@timeout_decorator.timeout(seconds=120)
298+
@timeout_decorator.timeout(seconds=240)
299299
def wait_for_target_processed(
300300
vuforia_database_keys: VuforiaDatabaseKeys,
301301
target_id: str,
302302
) -> None:
303303
"""
304-
Wait up to two minutes (arbitrary) for a target to get past the processing
304+
Wait up to four minutes (arbitrary) for a target to get past the processing
305305
stage.
306306
307307
Args:

0 commit comments

Comments
 (0)