Skip to content

Commit 990231a

Browse files
author
Forest Hoffman
committed
Make custom unique job ID for Travis
$TRAVIS_JOB_NUMBER is unreliable, as it outputs the currently running job number ($TRAVIS_BUILD_NUMBER.XX) which seems to be the job that was started last.
1 parent 4769792 commit 990231a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ node_js:
33
- 10.15.1
44
env:
55
matrix:
6-
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
6+
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" CI_JOB_ID="$TRAVIS_BUILD_NUMBER.$TRAVIS_OS_NAME.$RANDOM"
77
matrix:
88
include:
99
- os: linux
1010
dist: trusty
1111
- os: osx
1212
before_install:
13+
- echo $CI_JOB_ID
1314
- openssl aes-256-cbc -K $encrypted_31e0a178b4fd_key -iv $encrypted_31e0a178b4fd_iv
1415
-in test/.coder-gcp-credentials.json.enc -out test/.coder-gcp-credentials.json -d
1516
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then

test/src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,10 @@ export class TestPage {
155155
const img = await this.rootPage.screenshot(options);
156156
++this.screenshotCount;
157157

158-
// If this is a Travis CI build, store the screenshots
159-
// for later.
160-
if (process.env.TRAVIS_OS_NAME && process.env.TRAVIS_JOB_NUMBER) {
158+
// If this is a Travis CI build, store the screenshots.
159+
if (process.env.CI_JOB_ID) {
161160
const makePublic = true;
162-
const bucketPath = `Travis-${process.env.TRAVIS_JOB_NUMBER}/${fileName}`;
161+
const bucketPath = `Travis-${process.env.CI_JOB_ID}/${fileName}`;
163162
let buf: Buffer = typeof img === "string" ? Buffer.from(img as string) : img;
164163
try {
165164
const url = await bucket.write(bucketPath, buf, makePublic);

0 commit comments

Comments
 (0)