Skip to content

Custom Report Support for Automate Turboscale #884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion bin/commands/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ 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);
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