@@ -1071,6 +1071,7 @@ const github = __webpack_require__(469);
1071
1071
const os = __webpack_require__(87);
1072
1072
const path = __webpack_require__(622);
1073
1073
const fs = __webpack_require__(747);
1074
+ const Utils = __webpack_require__(353);
1074
1075
const ArtifactsManager = __webpack_require__(513);
1075
1076
const constants = __webpack_require__(613);
1076
1077
@@ -1084,6 +1085,9 @@ const {
1084
1085
ALLOWED_INPUT_VALUES: {
1085
1086
LOCAL_TESTING,
1086
1087
},
1088
+ ENV_VARS: {
1089
+ BROWSERSTACK_LOCAL_LOGS_FILE,
1090
+ },
1087
1091
} = constants;
1088
1092
1089
1093
/**
@@ -1126,8 +1130,9 @@ class BinaryControl {
1126
1130
* Generates logging file name and its path for Local Binary
1127
1131
*/
1128
1132
_generateLogFileMetadata() {
1129
- this.logFileName = `${LOCAL_LOG_FILE_PREFIX}_${github.context.job}.log`;
1133
+ this.logFileName = process.env[BROWSERSTACK_LOCAL_LOGS_FILE] || `${LOCAL_LOG_FILE_PREFIX}_${github.context.job}_${new Date().toISOString() }.log`;
1130
1134
this.logFilePath = path.resolve(this.binaryFolder, this.logFileName);
1135
+ core.exportVariable(BROWSERSTACK_LOCAL_LOGS_FILE, this.logFileName);
1131
1136
}
1132
1137
1133
1138
/**
@@ -1196,23 +1201,16 @@ class BinaryControl {
1196
1201
};
1197
1202
}
1198
1203
1199
- _binaryExists() {
1200
- const localBinary = tc.findAllVersions(LOCAL_BINARY_NAME);
1201
- return localBinary.length ? true : false;
1202
- }
1203
-
1204
1204
/**
1205
1205
* Downloads the Local Binary, extracts it and adds it in the PATH variable
1206
1206
*/
1207
1207
async downloadBinary() {
1208
1208
try {
1209
- if (this._binaryExists()) {
1210
- console.log(core.getState('jinga'));
1209
+ if (Utils.checkToolInCache(LOCAL_BINARY_NAME)) {
1211
1210
core.info('BrowserStackLocal binary already exists in cache. Using that instead of downloading again...');
1212
1211
return;
1213
1212
}
1214
1213
await this._makeDirectory();
1215
- core.saveState('jinga', 'lala');
1216
1214
core.info('Downloading BrowserStackLocal binary...');
1217
1215
const downloadPath = await tc.downloadTool(this.binaryLink, path.resolve(this.binaryFolder, 'binaryZip'));
1218
1216
const extractedPath = await tc.extractZip(downloadPath, this.binaryFolder);
@@ -1283,7 +1281,6 @@ class BinaryControl {
1283
1281
* Uploads BrowserStackLocal generated logs (if the file exists for the job)
1284
1282
*/
1285
1283
async uploadLogFilesIfAny() {
1286
- core.saveState
1287
1284
this._generateLogFileMetadata();
1288
1285
if (fs.existsSync(this.logFilePath)) {
1289
1286
await ArtifactsManager.uploadArtifacts(
@@ -1293,6 +1290,7 @@ class BinaryControl {
1293
1290
);
1294
1291
await io.rmRF(this.logFilePath);
1295
1292
}
1293
+ Utils.clearEnvironmentVariable(BROWSERSTACK_LOCAL_LOGS_FILE);
1296
1294
}
1297
1295
}
1298
1296
@@ -7178,6 +7176,27 @@ exports.default = void 0;
7178
7176
var _default = '00000000-0000-0000-0000-000000000000';
7179
7177
exports.default = _default;
7180
7178
7179
+ /***/ }),
7180
+
7181
+ /***/ 353:
7182
+ /***/ (function(module, __unusedexports, __webpack_require__) {
7183
+
7184
+ const tc = __webpack_require__(533);
7185
+
7186
+ class Utils {
7187
+ static clearEnvironmentVariable(environmentVariable) {
7188
+ delete process.env[environmentVariable];
7189
+ }
7190
+
7191
+ static checkToolInCache(toolName) {
7192
+ const toolCache = tc.findAllVersions(toolName);
7193
+ return toolCache.length !== 0;
7194
+ }
7195
+ }
7196
+
7197
+ module.exports = Utils;
7198
+
7199
+
7181
7200
/***/ }),
7182
7201
7183
7202
/***/ 357:
@@ -13383,6 +13402,7 @@ module.exports = {
13383
13402
ENV_VARS: {
13384
13403
BROWSERSTACK_ACCESS_KEY: 'BROWSERSTACK_ACCESS_KEY',
13385
13404
BROWSERSTACK_LOCAL_IDENTIFIER: 'BROWSERSTACK_LOCAL_IDENTIFIER',
13405
+ BROWSERSTACK_LOCAL_LOGS_FILE: 'BROWSERSTACK_LOCAL_LOGS_FILE',
13386
13406
},
13387
13407
13388
13408
BINARY_LINKS: {
0 commit comments