Build outputs

This commit is contained in:
daz
2024-04-07 14:43:04 -06:00
parent 1105cf252a
commit 8691214514
8 changed files with 1499 additions and 47784 deletions

View File

@@ -141173,24 +141173,25 @@ const input_params_1 = __nccwpck_require__(23885);
const DEPENDENCY_GRAPH_PREFIX = 'dependency-graph_';
function setup(config) {
return __awaiter(this, void 0, void 0, function* () {
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.Disabled) {
const option = config.getDependencyGraphOption();
if (option === input_params_1.DependencyGraphOption.Disabled) {
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'false');
return;
}
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.DownloadAndSubmit) {
if (option === input_params_1.DependencyGraphOption.DownloadAndSubmit) {
yield downloadAndSubmitDependencyGraphs(config);
return;
}
core.info('Enabling dependency graph generation');
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true');
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_CONTINUE_ON_FAILURE', config.continueOnFailure);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_CONTINUE_ON_FAILURE', config.getDependencyGraphContinueOnFailure());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR', config.getJobCorrelator());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', layout.workspaceDirectory());
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports'));
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.Clear) {
if (option === input_params_1.DependencyGraphOption.Clear) {
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_PROJECTS', '');
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', '');
}
@@ -141204,12 +141205,9 @@ function maybeExportVariable(variableName, value) {
}
function complete(config) {
return __awaiter(this, void 0, void 0, function* () {
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload and submit not supported in the ACT environment.');
return;
}
const option = config.getDependencyGraphOption();
try {
switch (config.dependencyGraphOption) {
switch (option) {
case input_params_1.DependencyGraphOption.Disabled:
case input_params_1.DependencyGraphOption.Generate:
case input_params_1.DependencyGraphOption.DownloadAndSubmit:
@@ -141223,7 +141221,7 @@ function complete(config) {
}
}
catch (e) {
warnOrFail(config, e);
warnOrFail(config, option, e);
}
});
}
@@ -141236,6 +141234,11 @@ function findGeneratedDependencyGraphFiles() {
}
function uploadDependencyGraphs(dependencyGraphFiles, config) {
return __awaiter(this, void 0, void 0, function* () {
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload not supported in the ACT environment.');
core.info(`Would upload: ${dependencyGraphFiles.join(', ')}`);
return;
}
const workspaceDirectory = layout.workspaceDirectory();
const artifactClient = new artifact_1.DefaultArtifactClient();
for (const dependencyGraphFile of dependencyGraphFiles) {
@@ -141243,7 +141246,7 @@ function uploadDependencyGraphs(dependencyGraphFiles, config) {
core.info(`Uploading dependency graph file: ${relativePath}`);
const artifactName = `${DEPENDENCY_GRAPH_PREFIX}${path.basename(dependencyGraphFile)}`;
yield artifactClient.uploadArtifact(artifactName, [dependencyGraphFile], workspaceDirectory, {
retentionDays: config.artifactRetentionDays
retentionDays: config.getArtifactRetentionDays()
});
}
});
@@ -141258,19 +141261,24 @@ function downloadAndSubmitDependencyGraphs(config) {
yield submitDependencyGraphs(yield downloadDependencyGraphs());
}
catch (e) {
warnOrFail(config, e);
warnOrFail(config, input_params_1.DependencyGraphOption.DownloadAndSubmit, e);
}
});
}
function submitDependencyGraphs(dependencyGraphFiles) {
return __awaiter(this, void 0, void 0, function* () {
for (const jsonFile of dependencyGraphFiles) {
if (isRunningInActEnvironment()) {
core.info('Dependency graph submit not supported in the ACT environment.');
core.info(`Would submit: ${dependencyGraphFiles.join(', ')}`);
return;
}
for (const dependencyGraphFile of dependencyGraphFiles) {
try {
yield submitDependencyGraphFile(jsonFile);
yield submitDependencyGraphFile(dependencyGraphFile);
}
catch (error) {
if (error instanceof request_error_1.RequestError) {
throw new Error(translateErrorMessage(jsonFile, error));
throw new Error(translateErrorMessage(dependencyGraphFile, error));
}
else {
throw error;
@@ -141332,15 +141340,25 @@ function downloadDependencyGraphs() {
function findDependencyGraphFiles(dir) {
return __awaiter(this, void 0, void 0, function* () {
const globber = yield glob.create(`${dir}/dependency-graph-reports/*.json`);
const graphFiles = globber.glob();
return graphFiles;
const allFiles = yield globber.glob();
const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
return unprocessedFiles;
});
}
function warnOrFail(config, error) {
if (!config.continueOnFailure) {
function isProcessed(dependencyGraphFile) {
const markerFile = `${dependencyGraphFile}.processed`;
return fs_1.default.existsSync(markerFile);
}
function markProcessed(dependencyGraphFile) {
const markerFile = `${dependencyGraphFile}.processed`;
fs_1.default.writeFileSync(markerFile, '');
}
function warnOrFail(config, option, error) {
if (!config.getDependencyGraphContinueOnFailure()) {
throw new errors_1.PostActionJobFailure(error);
}
core.warning(`Failed to ${config.dependencyGraphOption} dependency graph. Will continue.\n${String(error)}`);
core.warning(`Failed to ${option} dependency graph. Will continue.\n${String(error)}`);
}
function getOctokit() {
return github.getOctokit((0, input_params_1.getGithubToken)());
@@ -141566,11 +141584,6 @@ const cache = __importStar(__nccwpck_require__(27799));
const summary_1 = __nccwpck_require__(81327);
const string_argv_1 = __nccwpck_require__(19663);
class DependencyGraphConfig {
constructor() {
this.dependencyGraphOption = this.getDependencyGraphOption();
this.continueOnFailure = this.getDependencyGraphContinueOnFailure();
this.artifactRetentionDays = this.getArtifactRetentionDays();
}
getDependencyGraphOption() {
const val = core.getInput('dependency-graph');
switch (val.toLowerCase().trim()) {
@@ -141716,9 +141729,6 @@ var JobSummaryOption;
})(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {}));
class BuildScanConfig {
getBuildScanPublishEnabled() {
if (!this.verifyTermsOfUseAgreement()) {
return false;
}
return getBooleanInput('build-scan-publish') && this.verifyTermsOfUseAgreement();
}
getBuildScanTermsOfUseUrl() {