Build outputs

This commit is contained in:
daz 2024-04-07 14:43:04 -06:00
parent 1105cf252a
commit 8691214514
No known key found for this signature in database
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_'; const DEPENDENCY_GRAPH_PREFIX = 'dependency-graph_';
function setup(config) { function setup(config) {
return __awaiter(this, void 0, void 0, function* () { 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'); core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'false');
return; return;
} }
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.DownloadAndSubmit) { if (option === input_params_1.DependencyGraphOption.DownloadAndSubmit) {
yield downloadAndSubmitDependencyGraphs(config); yield downloadAndSubmitDependencyGraphs(config);
return; return;
} }
core.info('Enabling dependency graph generation'); core.info('Enabling dependency graph generation');
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true'); 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_CORRELATOR', config.getJobCorrelator());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId); maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref); maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext()); maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', layout.workspaceDirectory()); maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', layout.workspaceDirectory());
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports')); 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_PROJECTS', '');
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', ''); core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', '');
} }
@ -141204,12 +141205,9 @@ function maybeExportVariable(variableName, value) {
} }
function complete(config) { function complete(config) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (isRunningInActEnvironment()) { const option = config.getDependencyGraphOption();
core.info('Dependency graph upload and submit not supported in the ACT environment.');
return;
}
try { try {
switch (config.dependencyGraphOption) { switch (option) {
case input_params_1.DependencyGraphOption.Disabled: case input_params_1.DependencyGraphOption.Disabled:
case input_params_1.DependencyGraphOption.Generate: case input_params_1.DependencyGraphOption.Generate:
case input_params_1.DependencyGraphOption.DownloadAndSubmit: case input_params_1.DependencyGraphOption.DownloadAndSubmit:
@ -141223,7 +141221,7 @@ function complete(config) {
} }
} }
catch (e) { catch (e) {
warnOrFail(config, e); warnOrFail(config, option, e);
} }
}); });
} }
@ -141236,6 +141234,11 @@ function findGeneratedDependencyGraphFiles() {
} }
function uploadDependencyGraphs(dependencyGraphFiles, config) { function uploadDependencyGraphs(dependencyGraphFiles, config) {
return __awaiter(this, void 0, void 0, function* () { 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 workspaceDirectory = layout.workspaceDirectory();
const artifactClient = new artifact_1.DefaultArtifactClient(); const artifactClient = new artifact_1.DefaultArtifactClient();
for (const dependencyGraphFile of dependencyGraphFiles) { for (const dependencyGraphFile of dependencyGraphFiles) {
@ -141243,7 +141246,7 @@ function uploadDependencyGraphs(dependencyGraphFiles, config) {
core.info(`Uploading dependency graph file: ${relativePath}`); core.info(`Uploading dependency graph file: ${relativePath}`);
const artifactName = `${DEPENDENCY_GRAPH_PREFIX}${path.basename(dependencyGraphFile)}`; const artifactName = `${DEPENDENCY_GRAPH_PREFIX}${path.basename(dependencyGraphFile)}`;
yield artifactClient.uploadArtifact(artifactName, [dependencyGraphFile], workspaceDirectory, { yield artifactClient.uploadArtifact(artifactName, [dependencyGraphFile], workspaceDirectory, {
retentionDays: config.artifactRetentionDays retentionDays: config.getArtifactRetentionDays()
}); });
} }
}); });
@ -141258,19 +141261,24 @@ function downloadAndSubmitDependencyGraphs(config) {
yield submitDependencyGraphs(yield downloadDependencyGraphs()); yield submitDependencyGraphs(yield downloadDependencyGraphs());
} }
catch (e) { catch (e) {
warnOrFail(config, e); warnOrFail(config, input_params_1.DependencyGraphOption.DownloadAndSubmit, e);
} }
}); });
} }
function submitDependencyGraphs(dependencyGraphFiles) { function submitDependencyGraphs(dependencyGraphFiles) {
return __awaiter(this, void 0, void 0, function* () { 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 { try {
yield submitDependencyGraphFile(jsonFile); yield submitDependencyGraphFile(dependencyGraphFile);
} }
catch (error) { catch (error) {
if (error instanceof request_error_1.RequestError) { if (error instanceof request_error_1.RequestError) {
throw new Error(translateErrorMessage(jsonFile, error)); throw new Error(translateErrorMessage(dependencyGraphFile, error));
} }
else { else {
throw error; throw error;
@ -141332,15 +141340,25 @@ function downloadDependencyGraphs() {
function findDependencyGraphFiles(dir) { function findDependencyGraphFiles(dir) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const globber = yield glob.create(`${dir}/dependency-graph-reports/*.json`); const globber = yield glob.create(`${dir}/dependency-graph-reports/*.json`);
const graphFiles = globber.glob(); const allFiles = yield globber.glob();
return graphFiles; const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
return unprocessedFiles;
}); });
} }
function warnOrFail(config, error) { function isProcessed(dependencyGraphFile) {
if (!config.continueOnFailure) { 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); 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() { function getOctokit() {
return github.getOctokit((0, input_params_1.getGithubToken)()); return github.getOctokit((0, input_params_1.getGithubToken)());
@ -141424,10 +141442,8 @@ function run() {
try { try {
yield setupGradle.setup(new input_params_1.CacheConfig(), new input_params_1.BuildScanConfig()); yield setupGradle.setup(new input_params_1.CacheConfig(), new input_params_1.BuildScanConfig());
const config = new input_params_1.DependencyGraphConfig(); const config = new input_params_1.DependencyGraphConfig();
config.artifactRetentionDays = 1;
config.continueOnFailure = false;
yield dependencyGraph.setup(config); yield dependencyGraph.setup(config);
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.DownloadAndSubmit) { if (config.getDependencyGraphOption() === input_params_1.DependencyGraphOption.DownloadAndSubmit) {
return; return;
} }
const executable = yield provisioner.provisionGradle(); const executable = yield provisioner.provisionGradle();
@ -141442,6 +141458,7 @@ function run() {
const args = (0, string_argv_1.parseArgsStringToArgv)(executionArgs); const args = (0, string_argv_1.parseArgsStringToArgv)(executionArgs);
const buildRootDirectory = layout.buildRootDirectory(); const buildRootDirectory = layout.buildRootDirectory();
yield execution.executeGradleBuild(executable, buildRootDirectory, args); yield execution.executeGradleBuild(executable, buildRootDirectory, args);
yield dependencyGraph.complete(config);
} }
catch (error) { catch (error) {
core.setFailed(String(error)); core.setFailed(String(error));
@ -141652,11 +141669,6 @@ const cache = __importStar(__nccwpck_require__(27799));
const summary_1 = __nccwpck_require__(81327); const summary_1 = __nccwpck_require__(81327);
const string_argv_1 = __nccwpck_require__(19663); const string_argv_1 = __nccwpck_require__(19663);
class DependencyGraphConfig { class DependencyGraphConfig {
constructor() {
this.dependencyGraphOption = this.getDependencyGraphOption();
this.continueOnFailure = this.getDependencyGraphContinueOnFailure();
this.artifactRetentionDays = this.getArtifactRetentionDays();
}
getDependencyGraphOption() { getDependencyGraphOption() {
const val = core.getInput('dependency-graph'); const val = core.getInput('dependency-graph');
switch (val.toLowerCase().trim()) { switch (val.toLowerCase().trim()) {
@ -141802,9 +141814,6 @@ var JobSummaryOption;
})(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {})); })(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {}));
class BuildScanConfig { class BuildScanConfig {
getBuildScanPublishEnabled() { getBuildScanPublishEnabled() {
if (!this.verifyTermsOfUseAgreement()) {
return false;
}
return getBooleanInput('build-scan-publish') && this.verifyTermsOfUseAgreement(); return getBooleanInput('build-scan-publish') && this.verifyTermsOfUseAgreement();
} }
getBuildScanTermsOfUseUrl() { getBuildScanTermsOfUseUrl() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

@ -138626,24 +138626,25 @@ const input_params_1 = __nccwpck_require__(23885);
const DEPENDENCY_GRAPH_PREFIX = 'dependency-graph_'; const DEPENDENCY_GRAPH_PREFIX = 'dependency-graph_';
function setup(config) { function setup(config) {
return __awaiter(this, void 0, void 0, function* () { 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'); core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'false');
return; return;
} }
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.DownloadAndSubmit) { if (option === input_params_1.DependencyGraphOption.DownloadAndSubmit) {
yield downloadAndSubmitDependencyGraphs(config); yield downloadAndSubmitDependencyGraphs(config);
return; return;
} }
core.info('Enabling dependency graph generation'); core.info('Enabling dependency graph generation');
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true'); 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_CORRELATOR', config.getJobCorrelator());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId); maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref); maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext()); maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', layout.workspaceDirectory()); maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', layout.workspaceDirectory());
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports')); 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_PROJECTS', '');
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', ''); core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', '');
} }
@ -138657,12 +138658,9 @@ function maybeExportVariable(variableName, value) {
} }
function complete(config) { function complete(config) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (isRunningInActEnvironment()) { const option = config.getDependencyGraphOption();
core.info('Dependency graph upload and submit not supported in the ACT environment.');
return;
}
try { try {
switch (config.dependencyGraphOption) { switch (option) {
case input_params_1.DependencyGraphOption.Disabled: case input_params_1.DependencyGraphOption.Disabled:
case input_params_1.DependencyGraphOption.Generate: case input_params_1.DependencyGraphOption.Generate:
case input_params_1.DependencyGraphOption.DownloadAndSubmit: case input_params_1.DependencyGraphOption.DownloadAndSubmit:
@ -138676,7 +138674,7 @@ function complete(config) {
} }
} }
catch (e) { catch (e) {
warnOrFail(config, e); warnOrFail(config, option, e);
} }
}); });
} }
@ -138689,6 +138687,11 @@ function findGeneratedDependencyGraphFiles() {
} }
function uploadDependencyGraphs(dependencyGraphFiles, config) { function uploadDependencyGraphs(dependencyGraphFiles, config) {
return __awaiter(this, void 0, void 0, function* () { 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 workspaceDirectory = layout.workspaceDirectory();
const artifactClient = new artifact_1.DefaultArtifactClient(); const artifactClient = new artifact_1.DefaultArtifactClient();
for (const dependencyGraphFile of dependencyGraphFiles) { for (const dependencyGraphFile of dependencyGraphFiles) {
@ -138696,7 +138699,7 @@ function uploadDependencyGraphs(dependencyGraphFiles, config) {
core.info(`Uploading dependency graph file: ${relativePath}`); core.info(`Uploading dependency graph file: ${relativePath}`);
const artifactName = `${DEPENDENCY_GRAPH_PREFIX}${path.basename(dependencyGraphFile)}`; const artifactName = `${DEPENDENCY_GRAPH_PREFIX}${path.basename(dependencyGraphFile)}`;
yield artifactClient.uploadArtifact(artifactName, [dependencyGraphFile], workspaceDirectory, { yield artifactClient.uploadArtifact(artifactName, [dependencyGraphFile], workspaceDirectory, {
retentionDays: config.artifactRetentionDays retentionDays: config.getArtifactRetentionDays()
}); });
} }
}); });
@ -138711,19 +138714,24 @@ function downloadAndSubmitDependencyGraphs(config) {
yield submitDependencyGraphs(yield downloadDependencyGraphs()); yield submitDependencyGraphs(yield downloadDependencyGraphs());
} }
catch (e) { catch (e) {
warnOrFail(config, e); warnOrFail(config, input_params_1.DependencyGraphOption.DownloadAndSubmit, e);
} }
}); });
} }
function submitDependencyGraphs(dependencyGraphFiles) { function submitDependencyGraphs(dependencyGraphFiles) {
return __awaiter(this, void 0, void 0, function* () { 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 { try {
yield submitDependencyGraphFile(jsonFile); yield submitDependencyGraphFile(dependencyGraphFile);
} }
catch (error) { catch (error) {
if (error instanceof request_error_1.RequestError) { if (error instanceof request_error_1.RequestError) {
throw new Error(translateErrorMessage(jsonFile, error)); throw new Error(translateErrorMessage(dependencyGraphFile, error));
} }
else { else {
throw error; throw error;
@ -138785,15 +138793,25 @@ function downloadDependencyGraphs() {
function findDependencyGraphFiles(dir) { function findDependencyGraphFiles(dir) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const globber = yield glob.create(`${dir}/dependency-graph-reports/*.json`); const globber = yield glob.create(`${dir}/dependency-graph-reports/*.json`);
const graphFiles = globber.glob(); const allFiles = yield globber.glob();
return graphFiles; const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
return unprocessedFiles;
}); });
} }
function warnOrFail(config, error) { function isProcessed(dependencyGraphFile) {
if (!config.continueOnFailure) { 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); 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() { function getOctokit() {
return github.getOctokit((0, input_params_1.getGithubToken)()); return github.getOctokit((0, input_params_1.getGithubToken)());
@ -138885,11 +138903,6 @@ const cache = __importStar(__nccwpck_require__(27799));
const summary_1 = __nccwpck_require__(81327); const summary_1 = __nccwpck_require__(81327);
const string_argv_1 = __nccwpck_require__(19663); const string_argv_1 = __nccwpck_require__(19663);
class DependencyGraphConfig { class DependencyGraphConfig {
constructor() {
this.dependencyGraphOption = this.getDependencyGraphOption();
this.continueOnFailure = this.getDependencyGraphContinueOnFailure();
this.artifactRetentionDays = this.getArtifactRetentionDays();
}
getDependencyGraphOption() { getDependencyGraphOption() {
const val = core.getInput('dependency-graph'); const val = core.getInput('dependency-graph');
switch (val.toLowerCase().trim()) { switch (val.toLowerCase().trim()) {
@ -139035,9 +139048,6 @@ var JobSummaryOption;
})(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {})); })(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {}));
class BuildScanConfig { class BuildScanConfig {
getBuildScanPublishEnabled() { getBuildScanPublishEnabled() {
if (!this.verifyTermsOfUseAgreement()) {
return false;
}
return getBooleanInput('build-scan-publish') && this.verifyTermsOfUseAgreement(); return getBooleanInput('build-scan-publish') && this.verifyTermsOfUseAgreement();
} }
getBuildScanTermsOfUseUrl() { getBuildScanTermsOfUseUrl() {

File diff suppressed because one or more lines are too long