-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix hadolint on some versions of macOS (#913)
- Loading branch information
Showing
2 changed files
with
168 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
import { customLinterCheckTest } from "tests"; | ||
import { TEST_DATA } from "tests/utils"; | ||
|
||
const manualVersionReplacer = (version: string) => { | ||
if (version === "2.12.0") { | ||
// This version may segfault on certain versions on macOS. | ||
// The beta version is identical except with upx compression disabled on the binary. | ||
// See https://github.com/hadolint/hadolint/issues/919#issuecomment-1672031271 | ||
return "2.12.1-beta"; | ||
} | ||
return version; | ||
}; | ||
|
||
// We have a number of different files to determine which are valid Dockerfiles, validated by lint actions in the snapshot | ||
customLinterCheckTest({ linterName: "hadolint", args: TEST_DATA }); | ||
customLinterCheckTest({ linterName: "hadolint", args: TEST_DATA, manualVersionReplacer }); |
157 changes: 157 additions & 0 deletions
157
linters/hadolint/test_data/hadolint_v2.12.1-beta_CUSTOM.check.shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Testing linter hadolint test CUSTOM 1`] = ` | ||
{ | ||
"issues": [ | ||
{ | ||
"code": "DL3059", | ||
"column": "1", | ||
"file": "test_data/basic.Dockerfile", | ||
"issueClass": "ISSUE_CLASS_EXISTING", | ||
"issueUrl": "https://github.com/hadolint/hadolint/wiki/DL3059", | ||
"level": "LEVEL_LOW", | ||
"line": "4", | ||
"linter": "hadolint", | ||
"message": "Multiple consecutive \`RUN\` instructions. Consider consolidation.", | ||
"targetType": "docker", | ||
}, | ||
], | ||
"lintActions": [ | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/Dockerfile", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/Dockerfile.empty", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/basic.Dockerfile", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/empty.Dockerfile", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/nested/Dockerfile.debug", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/nested/dockerfile", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/nested/prefix.Dockerfile", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/Dockerfile", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/Dockerfile.empty", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/basic.Dockerfile", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/empty.Dockerfile", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/nested/Dockerfile.debug", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/nested/dockerfile", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "docker", | ||
"linter": "hadolint", | ||
"paths": [ | ||
"test_data/nested/prefix.Dockerfile", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
], | ||
"taskFailures": [], | ||
"unformattedFiles": [], | ||
} | ||
`; |