Skip to content

Makefile incorrectly prints 'Neither docker nor podman can be executed' when container runtime is available #3626

@osullivandonal

Description

@osullivandonal

Area(s)

tooling

What's the problem?

When running Make targets that use a container runtime the following info is printed:

Neither docker nor podman can be executed. Did you install and configure one of them to be used?
semantic-conventions main ❯ make markdownlint DOCKER_COMMAND=podman
Neither docker nor podman can be executed. Did you install and configure one of them to be used?
semantic-conventions@ /home/dos/Documents/semantic-conventions
└─┬ markdownlint-cli2@0.22.0
  └─┬ markdownlint-cli2-formatter-default@0.0.6
    └── markdownlint-cli2@0.22.0 deduped

npx --no -- markdownlint-cli2 '**/*.md'
markdownlint-cli2 v0.22.0 (markdownlint v0.40.0)
Finding: **/*.md
Linting: 312 file(s)
Summary: 0 error(s)

semantic-conventions main ❯ make markdownlint
Neither docker nor podman can be executed. Did you install and configure one of them to be used?
semantic-conventions@ /home/dos/Documents/semantic-conventions
└─┬ markdownlint-cli2@0.22.0
  └─┬ markdownlint-cli2-formatter-default@0.0.6
    └── markdownlint-cli2@0.22.0 deduped

npx --no -- markdownlint-cli2 '**/*.md'
markdownlint-cli2 v0.22.0 (markdownlint v0.40.0)
Finding: **/*.md
Linting: 312 file(s)
Summary: 0 error(s)

semantic-conventions main ❯

Since both container runtimes (docker and podman) are installed this should not be printed.

Describe the solution you'd like

The issue is that the Makefile checks if DOCKER_COMMAND is defined, if it is then it prints:

$(info Neither docker nor podman can be executed. Did you install and configure one of them to be used?)

The current logic is:

ifndef DOCKER_COMMAND # If DOCKER_COMMAND is NOT defined...
    ifneq ($(strip $(shell podman --version 2>&1)),)
        DOCKER_COMMAND := podman
    endif
else # If DOCKER_COMMAND IS defined...
    $(info Neither docker nor podman can be executed. Did you install and configure one of them to be used?)
endif

This should actually be:

ifndef DOCKER_COMMAND
    ifneq ($(strip $(shell podman --version 2>&1)),)
        DOCKER_COMMAND := podman
    else
        $(info Neither docker nor podman can be executed. Did you install and configure one of them to be used?)
    endif
endif

Which then removes the incorrect info:

semantic-conventions main ❯ make markdownlint DOCKER_COMMAND=podman
semantic-conventions@ /home/dos/Documents/semantic-conventions
└─┬ markdownlint-cli2@0.22.0
  └─┬ markdownlint-cli2-formatter-default@0.0.6
    └── markdownlint-cli2@0.22.0 deduped

npx --no -- markdownlint-cli2 '**/*.md'
markdownlint-cli2 v0.22.0 (markdownlint v0.40.0)
Finding: **/*.md
Linting: 312 file(s)
Summary: 0 error(s)

semantic-conventions main  ❯ make markdownlint
semantic-conventions@ /home/dos/Documents/semantic-conventions
└─┬ markdownlint-cli2@0.22.0
  └─┬ markdownlint-cli2-formatter-default@0.0.6
    └── markdownlint-cli2@0.22.0 deduped

npx --no -- markdownlint-cli2 '**/*.md'
markdownlint-cli2 v0.22.0 (markdownlint v0.40.0)
Finding: **/*.md
Linting: 312 file(s)
Summary: 0 error(s)

semantic-conventions main  ❯

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtoolingRegarding build, workflows, build-tools, ...triage:needs-triage

    Type

    No type

    Projects

    Status

    Need triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions