+
Skip to content

Output Grype stderr to action logs #137

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 1 commit into from
Dec 22, 2021
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
30 changes: 18 additions & 12 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const fs = __webpack_require__(747);
const stream = __webpack_require__(413);

const grypeBinary = "grype";
const grypeVersion = "0.22.0";
const grypeVersion = "0.27.3";

// sarif code
function convert_severity_to_acs_level(input_severity, severity_cutoff_param) {
Expand Down Expand Up @@ -513,21 +513,27 @@ async function runScan({
},
});

const cmdOpts = {
ignoreReturnCode: true,
outStream,
listeners: {
stdout: (data = Buffer) => {
cmdOutput += data.toString();
},
},
};

core.info("\nAnalyzing: " + source);

core.info(`Executing: ${cmd} ` + cmdArgs.join(" "));

const exitCode = await exec(cmd, cmdArgs, cmdOpts);
const exitCode = await core.group(`${cmd} output...`, async () =>
exec(cmd, cmdArgs, {
ignoreReturnCode: true,
outStream,
listeners: {
stdout(buffer) {
cmdOutput += buffer.toString();
},
stderr(buffer) {
core.info(buffer.toString());
},
debug(message) {
core.debug(message);
},
},
})
);

if (core.isDebug()) {
core.debug("Grype output:");
Expand Down
28 changes: 17 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,21 +506,27 @@ async function runScan({
},
});

const cmdOpts = {
ignoreReturnCode: true,
outStream,
listeners: {
stdout: (data = Buffer) => {
cmdOutput += data.toString();
},
},
};

core.info("\nAnalyzing: " + source);

core.info(`Executing: ${cmd} ` + cmdArgs.join(" "));

const exitCode = await exec(cmd, cmdArgs, cmdOpts);
const exitCode = await core.group(`${cmd} output...`, async () =>
exec(cmd, cmdArgs, {
ignoreReturnCode: true,
outStream,
listeners: {
stdout(buffer) {
cmdOutput += buffer.toString();
},
stderr(buffer) {
core.info(buffer.toString());
},
debug(message) {
core.debug(message);
},
},
})
);

if (core.isDebug()) {
core.debug("Grype output:");
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载