Skip to content
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

mega-linter-runner: force platform linux/amd64 #2430

Merged
merged 2 commits into from
Mar 6, 2023
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
1 change: 1 addition & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ CVE-2021-46828
CVE-2022-0235
CVE-2022-0778
CVE-2022-1271
CVE-2022-1304
CVE-2022-1996
CVE-2022-2097
CVE-2022-3510
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-linter.yml file, or with `oxsecurity/megalinter:beta` docker image

- Fixes
- Fix issue with running on Mac m1 no longer working [#2427](https://github.com/oxsecurity/megalinter/issues/2427)

- Linter versions upgrades
- [jsonlint](https://github.com/prantlf/jsonlint) from 13.0.1 to **14.0.0** on 2023-03-05
<!-- linter-versions-end -->
Expand Down
8 changes: 8 additions & 0 deletions mega-linter-runner/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ module.exports = optionator({
type: "Boolean",
description: "Do not pull docker image before running it",
},
{
option: "platform",
alias: "z",
type: "String",
default: "linux/amd64",
description:
"Force a docker image platform (currently, only linux/amd64 works)",
},
{
option: "debug",
type: "Boolean",
Expand Down
17 changes: 11 additions & 6 deletions mega-linter-runner/lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,17 @@ ERROR: Docker engine has not been found on your system.
console.info(
"The next runs, it will be immediate (thanks to docker cache !)"
);
const spawnResPull = spawnSync("docker", ["pull", dockerImage], {
detached: false,
stdio: "inherit",
windowsHide: true,
windowsVerbatimArguments: true,
});
const imagePlatform = options.platform || "linux/amd64";
const spawnResPull = spawnSync(
"docker",
["pull", "--platform", imagePlatform, dockerImage],
{
detached: false,
stdio: "inherit",
windowsHide: true,
windowsVerbatimArguments: true,
}
);
// Manage case when unable to pull docker image
if (spawnResPull.status !== 0) {
return {
Expand Down