Add debugging statements

This commit is contained in:
Justin Hutchings
2023-01-22 07:20:25 +00:00
parent f0ab51072a
commit 82a0300769
4 changed files with 11 additions and 6 deletions
-4
View File
@@ -9,10 +9,6 @@ inputs:
description: 'The path to the directory containing the environment files to upload. Defaults to Actions working directory.' description: 'The path to the directory containing the environment files to upload. Defaults to Actions working directory.'
required: false required: false
default: '.' default: '.'
filePattern:
description: 'The file name pattern for environment files to upload'
required: false
default: 'environment.yaml'
runs: runs:
using: 'node16' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'
+5 -1
View File
@@ -29,12 +29,14 @@ export default class ComponentDetection {
// Get the latest release from the component-detection repo, download the tarball, and extract it // Get the latest release from the component-detection repo, download the tarball, and extract it
private static async downloadLatestRelease() { private static async downloadLatestRelease() {
try { try {
core.debug("Downloading latest release");
const downloadURL = await this.getLatestReleaseURL(); const downloadURL = await this.getLatestReleaseURL();
const blob = await (await fetch(new URL(downloadURL))).blob(); const blob = await (await fetch(new URL(downloadURL))).blob();
const arrayBuffer = await blob.arrayBuffer(); const arrayBuffer = await blob.arrayBuffer();
const buffer = Buffer.from(arrayBuffer); const buffer = Buffer.from(arrayBuffer);
// Write the blob to a file // Write the blob to a file
core.debug("Writing binary to file");
await fs.writeFile(this.componentDetectionPath, buffer, {mode: 0o777, flag: 'w'}, await fs.writeFile(this.componentDetectionPath, buffer, {mode: 0o777, flag: 'w'},
(err: any) => { (err: any) => {
if (err) { if (err) {
@@ -48,6 +50,7 @@ export default class ComponentDetection {
// Run the component-detection CLI on the path specified // Run the component-detection CLI on the path specified
private static async runComponentDetection(path: string) { private static async runComponentDetection(path: string) {
core.info("Running component-detection");
try { try {
await exec.exec(`${this.componentDetectionPath} scan --SourceDirectory ${path} --ManifestFile ${this.outputPath}`); await exec.exec(`${this.componentDetectionPath} scan --SourceDirectory ${path} --ManifestFile ${this.outputPath}`);
} catch (error: any) { } catch (error: any) {
@@ -56,7 +59,7 @@ export default class ComponentDetection {
} }
private static async getManifestsFromResults(): Promise<Manifest[]| undefined> { private static async getManifestsFromResults(): Promise<Manifest[]| undefined> {
core.info("Getting manifests from results");
try { try {
// Parse the result file and add the packages to the package cache // Parse the result file and add the packages to the package cache
const packageCache = new PackageCache(); const packageCache = new PackageCache();
@@ -85,6 +88,7 @@ export default class ComponentDetection {
} }
}); });
}); });
core.debug(JSON.stringify(packages));
// Create manifests // Create manifests
const manifests: Array<Manifest> = []; const manifests: Array<Manifest> = [];
Generated Vendored
+5
View File
@@ -23753,11 +23753,13 @@ class ComponentDetection {
static downloadLatestRelease() { static downloadLatestRelease() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
core.debug("Downloading latest release");
const downloadURL = yield this.getLatestReleaseURL(); const downloadURL = yield this.getLatestReleaseURL();
const blob = yield (yield (0, cross_fetch_1.default)(new URL(downloadURL))).blob(); const blob = yield (yield (0, cross_fetch_1.default)(new URL(downloadURL))).blob();
const arrayBuffer = yield blob.arrayBuffer(); const arrayBuffer = yield blob.arrayBuffer();
const buffer = Buffer.from(arrayBuffer); const buffer = Buffer.from(arrayBuffer);
// Write the blob to a file // Write the blob to a file
core.debug("Writing binary to file");
yield fs_1.default.writeFile(this.componentDetectionPath, buffer, { mode: 0o777, flag: 'w' }, (err) => { yield fs_1.default.writeFile(this.componentDetectionPath, buffer, { mode: 0o777, flag: 'w' }, (err) => {
if (err) { if (err) {
core.error(err); core.error(err);
@@ -23772,6 +23774,7 @@ class ComponentDetection {
// Run the component-detection CLI on the path specified // Run the component-detection CLI on the path specified
static runComponentDetection(path) { static runComponentDetection(path) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.info("Running component-detection");
try { try {
yield exec.exec(`${this.componentDetectionPath} scan --SourceDirectory ${path} --ManifestFile ${this.outputPath}`); yield exec.exec(`${this.componentDetectionPath} scan --SourceDirectory ${path} --ManifestFile ${this.outputPath}`);
} }
@@ -23782,6 +23785,7 @@ class ComponentDetection {
} }
static getManifestsFromResults() { static getManifestsFromResults() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.info("Getting manifests from results");
try { try {
// Parse the result file and add the packages to the package cache // Parse the result file and add the packages to the package cache
const packageCache = new dependency_submission_toolkit_1.PackageCache(); const packageCache = new dependency_submission_toolkit_1.PackageCache();
@@ -23805,6 +23809,7 @@ class ComponentDetection {
} }
})); }));
})); }));
core.debug(JSON.stringify(packages));
// Create manifests // Create manifests
const manifests = []; const manifests = [];
// Check the locationsFoundAt for every package and add each as a manifest // Check the locationsFoundAt for every package and add each as a manifest
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long