devcontainers-extra / features

🐳 Extra add-in features for Devcontainers and GitHub Codespaces
MIT License
8 stars 2 forks source link

[Bug]: Ansible feature always installs the latest version #43

Closed koralowiec closed 4 weeks ago

koralowiec commented 4 weeks ago

Feature id and version

ghcr.io/devcontainers-extra/features/ansible:2.0.17

Devcontainer base Image

mcr.microsoft.com/devcontainers/base:bookworm

What happened?

Ansible feature doesn't install ansible-core in the specified version

devcontainer.json:

{
    "name": "Debian",
    "image": "mcr.microsoft.com/devcontainers/base:bookworm",
    "features": {
        "ghcr.io/devcontainers-extra/features/ansible:2.0.17": {
            "version": "2.16.11"
        }
    }
}

image

test_version_selection scenario doesn't catch it when the tests are run - The following check doesn't fail even though the version is not matched:

check "ansible --version | grep 'core 2.13.0'" ansible --version | grep 'core 2.13.0'

It fails when I change it to this:

check "ansible --version | grep 'core 2.13.0'" bash -c "ansible --version | grep 'core 2.13.0'"

Relevant log output

No response

koralowiec commented 4 weeks ago
check "ansible --version | grep 'core 2.13.0'" ansible --version | grep 'core 2.13.0'

The "false positive" caused by the fact that the output of check function is piped to the grep 'core 2.13.0'. And the output contains the "label" that is passed as the 1st argument ("ansible --version | grep 'core 2.13.0'"). As the result the grep is always successful - core 2.13.0 is always present in the check's output