From 901d9dce5e874b67eecbf4c7e90ed28666998361 Mon Sep 17 00:00:00 2001 From: Miroslav Shubernetskiy Date: Mon, 25 Mar 2024 13:02:30 -0400 Subject: [PATCH 1/2] fix: runCommand returns non-zero exit code for non-existing exes --- CHANGELOG.md | 3 +++ chalk.nimble | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2aa6b19..57001042 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ installed. Previously, any chalk sub-scan such as during `chalk exec` had misleading error logs. [#248](https://github.com/crashappsec/chalk/pull/248) +- `chalk docker ...` did not exit with non-zero exit code + when `docker` is not installed. + [#256](https://github.com/crashappsec/chalk/pull/256) - Fixed parsing CLI params when wrapping `docker` (rename `chalk` exe to `docker`) and a docker command had a "docker" param. diff --git a/chalk.nimble b/chalk.nimble index 0439711c..fcaa234f 100644 --- a/chalk.nimble +++ b/chalk.nimble @@ -11,7 +11,7 @@ bin = @["chalk"] # Dependencies requires "nim >= 2.0.0" -requires "https://github.com/crashappsec/con4m#23309b7c4ad492576509b84f6969a1a43c862057" +requires "https://github.com/crashappsec/con4m#973bb0a8bfc0745a30f6f6285a9fd81e6196b647" requires "https://github.com/viega/zippy == 0.10.7" # MIT # this allows us to get version externally From 5634f2d9d877c59f6f9fdd9ec2b547071975b9df Mon Sep 17 00:00:00 2001 From: Miroslav Shubernetskiy Date: Wed, 27 Mar 2024 14:08:33 -0400 Subject: [PATCH 2/2] test: adding test to check chalk fails without docker --- tests/test_docker.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_docker.py b/tests/test_docker.py index 79b86da6..96402e72 100644 --- a/tests/test_docker.py +++ b/tests/test_docker.py @@ -71,6 +71,17 @@ def run_container(*args, **kwargs): Docker.remove_images(list(images)) +def test_no_docker(chalk: Chalk): + _, build = chalk.docker_build( + context=DOCKERFILES / "valid" / "sample_1", + env={"PATH": ""}, + expected_success=False, + # dont run sanity docker subcommand + run_docker=False, + ) + assert build.exit_code > 0 + + @pytest.mark.parametrize("buildkit", [True, False]) @pytest.mark.parametrize( "cwd, dockerfile, tag",