Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bin/commands/generateReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const logger = require("../helpers/logger").winstonLogger,
utils = require("../helpers/utils"),
reporterHTML = require('../helpers/reporterHTML'),
getInitialDetails = require('../helpers/getInitialDetails').getInitialDetails;

const { isTurboScaleSession } = require('../helpers/atsHelper');

module.exports = function generateReport(args, rawArgs) {
let bsConfigPath = utils.getConfigPath(args.cf);
let reportGenerator = reporterHTML.reportGenerator;

return utils.validateBstackJson(bsConfigPath).then(function (bsConfig) {
return utils.validateBstackJson(bsConfigPath).then(async function (bsConfig) {
// setting setDefaults to {} if not present and set via env variables or via args.
utils.setDefaults(bsConfig, args);

Expand All @@ -21,9 +21,9 @@ module.exports = function generateReport(args, rawArgs) {
// accept the access key from command line if provided
utils.setAccessKey(bsConfig, args);

getInitialDetails(bsConfig, args, rawArgs).then((buildReportData) => {

utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);
try {
let buildReportData = isTurboScaleSession(bsConfig) ? null : await getInitialDetails(bsConfig, args, rawArgs);
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);

// set cypress config filename
utils.setCypressConfigFilename(bsConfig, args);
Expand All @@ -34,9 +34,9 @@ module.exports = function generateReport(args, rawArgs) {

reportGenerator(bsConfig, buildId, args, rawArgs, buildReportData);
utils.sendUsageReport(bsConfig, args, 'generate-report called', messageType, errorCode, buildReportData, rawArgs);
}).catch((err) => {
} catch(err) {
logger.warn(err);
});
};
}).catch(function (err) {
logger.error(err);
utils.setUsageReportingFlag(null, args.disableUsageReporting);
Expand Down
4 changes: 2 additions & 2 deletions bin/commands/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ module.exports = function run(args, rawArgs) {
await new Promise(resolve => setTimeout(resolve, 5000));

// download build artifacts
if (exitCode != Constants.BUILD_FAILED_EXIT_CODE && !turboScaleSession) {
if (exitCode != Constants.BUILD_FAILED_EXIT_CODE) {
if (utils.nonEmptyArray(bsConfig.run_settings.downloads)) {
logger.debug("Downloading build artifacts");
await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs, buildReportData);
await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs, buildReportData, turboScaleSession);
}

// Generate custom report!
Expand Down
6 changes: 4 additions & 2 deletions bin/helpers/buildArtifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,15 @@ const sendUpdatesToBstack = async (bsConfig, buildId, args, options, rawArgs, bu
});
}

exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs, buildReportData = null) => {
exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs, buildReportData = null, isTurboScaleSession = false) => {
return new Promise ( async (resolve, reject) => {
BUILD_ARTIFACTS_FAIL_COUNT = 0;
BUILD_ARTIFACTS_TOTAL_COUNT = 0;

let options = {
url: `${config.buildUrl}${buildId}/build_artifacts`,
url: isTurboScaleSession
? `${config.turboScaleBuildsUrl}/${buildId}/build_artifacts`
: `${config.buildUrl}${buildId}/build_artifacts`,
auth: {
username: bsConfig.auth.username,
password: bsConfig.auth.access_key,
Expand Down
3 changes: 3 additions & 0 deletions bin/helpers/capabilityHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ const caps = (bsConfig, zip) => {
obj.run_settings = JSON.stringify(bsConfig.run_settings);
}

obj.cypress_cli_user_agent = Utils.getUserAgent();
logger.info(`Cypress CLI User Agent: ${obj.cypress_cli_user_agent}`);

if(obj.parallels === Constants.cliMessages.RUN.DEFAULT_PARALLEL_MESSAGE) obj.parallels = undefined

if (obj.project) logger.info(`Project name is: ${obj.project}`);
Expand Down
5 changes: 5 additions & 0 deletions bin/helpers/reporterHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const fs = require('fs'),
Constants = require('./constants'),
config = require("./config"),
decompress = require('decompress');
const { isTurboScaleSession } = require('../helpers/atsHelper');

let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) => {
let options = {
Expand All @@ -19,6 +20,10 @@ let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) =>
},
};

if (isTurboScaleSession(bsConfig)) {
options.url = `${config.turboScaleBuildsUrl}/${buildId}/custom_report`;
}

logger.debug('Started fetching the build json and html reports.');

return request.get(options, async function (err, resp, body) {
Expand Down
Loading