Compare commits
12 Commits
9da7585e9a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 7243ea3674 | |||
| 62c5b5d727 | |||
| b0960e8b14 | |||
| 954a55271a | |||
| 265328e917 | |||
| ec9386f924 | |||
|
|
6e7555e536 | ||
|
|
d9c972fcaf | ||
|
|
b03f2090d6 | ||
|
|
02f8d16e0b | ||
|
|
8bcfb9c6f9 | ||
|
|
3749fc3adf |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -18,3 +18,4 @@ bin-release/
|
|||||||
# should NOT be excluded as they contain compiler settings and other important
|
# should NOT be excluded as they contain compiler settings and other important
|
||||||
# information for Eclipse / Flash Builder.
|
# information for Eclipse / Flash Builder.
|
||||||
|
|
||||||
|
node_modules
|
||||||
@@ -29,5 +29,5 @@ outputs:
|
|||||||
value: ${{ steps.run.outputs.result-file }}
|
value: ${{ steps.run.outputs.result-file }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node24
|
using: node20
|
||||||
main: index.js
|
main: dist/index.js
|
||||||
27662
docker-scout/dist/index.js
vendored
Normal file
27662
docker-scout/dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
docker-scout/package.json
Normal file
17
docker-scout/package.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "docker-scout",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"tunnel": "^0.0.6",
|
||||||
|
"undici": "^8.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {},
|
||||||
|
"scripts": {
|
||||||
|
"test": "node dist/index.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
const exec = require('@actions/exec');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
async function pullDockerImage(version) {
|
async function pullDockerImage(version) {
|
||||||
@@ -32,6 +33,7 @@ async function dockerInfo() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
async function getScoutVersion() {
|
async function getScoutVersion() {
|
||||||
let version;
|
let version;
|
||||||
await core.group(`Docker scout version`, async () => {
|
await core.group(`Docker scout version`, async () => {
|
||||||
@@ -51,21 +53,26 @@ async function getScoutVersion() {
|
|||||||
});
|
});
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
async function runScoutCommand(commands, image, format, outputFile) {
|
async function runScoutCommand(commands, image, format, outputFile) {
|
||||||
const resultPath = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'docker-scout-action-')), 'result.txt');
|
const resultPath = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'docker-scout-action-')), 'result.txt');
|
||||||
core.setOutput('result-file', resultPath);
|
core.setOutput('result-file', resultPath);
|
||||||
|
|
||||||
for (const cmd of commands) {
|
for (const cmd of commands) {
|
||||||
|
const args = ['scout', cmd, image];
|
||||||
|
if (cmd == 'cves') {
|
||||||
|
args.push('--format', format);
|
||||||
|
}
|
||||||
|
|
||||||
if (outputFile) {
|
if (outputFile) {
|
||||||
const res = await exec.getExecOutput('docker', ['scout', cmd, image, '--format', format], { silent: true });
|
const res = await exec.getExecOutput('docker', args, { silent: true });
|
||||||
if (res.stderr && res.stderr.length > 0) {
|
if (res.stderr && res.stderr.length > 0) {
|
||||||
throw new Error(res.stderr);
|
throw new Error(res.stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.appendFile(resultPath, res.stdout);
|
fs.appendFile(resultPath, res.stdout);
|
||||||
} else {
|
} else {
|
||||||
await exec.exec('docker', ['scout', cmd, image, '--format', format]);
|
await exec.exec('docker', args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resultPath;
|
return resultPath;
|
||||||
@@ -83,7 +90,7 @@ async function main(inputs) {
|
|||||||
await pullDockerImage(scoutVersion);
|
await pullDockerImage(scoutVersion);
|
||||||
await copyBinary(scoutVersion);
|
await copyBinary(scoutVersion);
|
||||||
await dockerInfo();
|
await dockerInfo();
|
||||||
const version = await getScoutVersion();
|
//const version = await getScoutVersion();
|
||||||
// TODO: cache binary (no changes per your request)
|
// TODO: cache binary (no changes per your request)
|
||||||
await runScoutCommand(commands, imageName, outputFormat, outputFile);
|
await runScoutCommand(commands, imageName, outputFormat, outputFile);
|
||||||
}
|
}
|
||||||
3
renovate.json
Normal file
3
renovate.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user