Compare commits

...

15 Commits

Author SHA1 Message Date
7243ea3674 Merge pull request 'Update dependency undici to v8' (#4) from renovate/undici-8.x into main
Reviewed-on: #4
2026-04-03 11:28:53 +00:00
62c5b5d727 Update dependency undici to v8 2026-04-03 11:26:35 +00:00
b0960e8b14 Merge pull request 'Update dependency undici to v7' (#3) from renovate/undici-7.x into main
Reviewed-on: #3
Reviewed-by: Daan Selen <dselen@systemec.nl>
2025-09-15 15:54:58 +00:00
954a55271a Update dependency undici to v7 2025-09-15 15:47:15 +00:00
265328e917 Merge pull request 'Configure Renovate' (#2) from renovate/configure into main
Reviewed-on: #2
2025-09-15 15:46:18 +00:00
ec9386f924 Add renovate.json 2025-09-15 15:29:39 +00:00
Daan Selen
6e7555e536 Code update 2025-08-09 00:33:26 +02:00
Daan Selen
d9c972fcaf Optimist 2025-08-09 00:24:17 +02:00
Daan Selen
b03f2090d6 Correct node20 2025-08-09 00:21:01 +02:00
Daan Selen
02f8d16e0b Testing out the real shit. 2025-08-09 00:20:16 +02:00
Daan Selen
8bcfb9c6f9 Testing out according to https://docs.github.com/en/actions/tutorials/create-actions/create-a-javascript-action 2025-08-09 00:08:06 +02:00
Daan Selen
3749fc3adf Commented out unused code (I think) 2025-08-08 22:21:01 +02:00
Daan Selen
9da7585e9a Testing out my own docker scout action. 2025-08-08 20:20:35 +00:00
Daan Selen
a2d0c6c890 Made repo generic 2025-08-08 20:20:35 +00:00
Daan Selen
6ba328c294 Testing my own action files... 2025-08-08 20:20:35 +00:00
6 changed files with 27818 additions and 0 deletions

1
.gitignore vendored
View File

@@ -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

33
docker-scout/action.yml Normal file
View File

@@ -0,0 +1,33 @@
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
name: 'Docker scout'
description: 'Check vulnerabilities'
inputs:
command:
description: 'actions to be performed'
default: 'cves'
required: true
version:
description: 'Docker scout version'
default: 'latest'
required: true
format:
description: 'Output format'
default: 'packages'
required: true
image:
description: 'Name of the image'
required: true
output-file:
description: 'whether the program outputs a file at all'
default: false
required: false
outputs:
result-file:
description: 'File output result'
value: ${{ steps.run.outputs.result-file }}
runs:
using: node20
main: dist/index.js

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
View 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"
}

102
docker-scout/src/index.js Normal file
View File

@@ -0,0 +1,102 @@
const fs = require('fs');
const os = require('os');
const core = require('@actions/core');
const exec = require('@actions/exec');
const path = require('path');
async function pullDockerImage(version) {
await core.group(`Pull docker/scout-cli image`, async () => {
await exec.exec(`docker pull docker.io/docker/scout-cli:${version}`);
});
}
async function copyBinary(version) {
await core.group(`Copy binary`, async () => {
const res = await exec.getExecOutput('docker', ['create', `docker.io/docker/scout-cli:${version}`], {
ignoreReturnCode: true
});
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr);
}
const ctnid = res.stdout.trim();
const dockerCfgPath = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
const pluginsPath = path.join(dockerCfgPath, 'cli-plugins');
fs.mkdirSync(pluginsPath, { recursive: true });
await exec.exec(`docker cp ${ctnid}:/docker-scout ${pluginsPath}`);
await exec.exec(`docker rm -v ${ctnid}`);
});
}
async function dockerInfo() {
await core.group(`Docker info`, async () => {
await exec.exec(`docker info`);
});
}
/*
async function getScoutVersion() {
let version;
await core.group(`Docker scout version`, async () => {
const res = await exec.getExecOutput('docker', ['scout', 'version'], {
ignoreReturnCode: true,
silent: true
});
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr);
}
const matchVersion = res.stdout.trim().match(/version:\s(.*?)\s/);
version = matchVersion ? matchVersion[1] : null;
if (!version) {
throw new Error('Failed to get Docker scout version');
}
core.info(version);
});
return version;
}
*/
async function runScoutCommand(commands, image, format, outputFile) {
const resultPath = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'docker-scout-action-')), 'result.txt');
core.setOutput('result-file', resultPath);
for (const cmd of commands) {
const args = ['scout', cmd, image];
if (cmd == 'cves') {
args.push('--format', format);
}
if (outputFile) {
const res = await exec.getExecOutput('docker', args, { silent: true });
if (res.stderr && res.stderr.length > 0) {
throw new Error(res.stderr);
}
fs.appendFile(resultPath, res.stdout);
} else {
await exec.exec('docker', args);
}
}
return resultPath;
}
async function main(inputs) {
try {
const commandInput = core.getInput('command');
const commands = commandInput.split(',').map(cmd => cmd.trim()).filter(cmd => cmd.length > 0);
const scoutVersion = core.getInput('version');
const outputFormat = core.getInput('format');
const imageName = core.getInput('image');
const outputFile = core.getInput('output-file') === 'true';
await pullDockerImage(scoutVersion);
await copyBinary(scoutVersion);
await dockerInfo();
//const version = await getScoutVersion();
// TODO: cache binary (no changes per your request)
await runScoutCommand(commands, imageName, outputFormat, outputFile);
}
catch (error) {
core.setFailed(error.message);
console.error(error);
}
}
main()

3
renovate.json Normal file
View File

@@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}