feat: Use docker connection variables specified in 'platforms'#354
Open
adam-bishop wants to merge 1 commit intoansible-community:mainfrom
Open
feat: Use docker connection variables specified in 'platforms'#354adam-bishop wants to merge 1 commit intoansible-community:mainfrom
adam-bishop wants to merge 1 commit intoansible-community:mainfrom
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the connection attributes specified in platforms are ignored, despite being in the schema. They're wired up but the 'sanity' check assumes that any config for connecting to dockerd comes from environment variables so unless you're using dockerd locally or executing molecule on a container host directly, the check will fail. It also assumes that one would only ever want to connect to a single dockerd.
This causes some weird behaviour - because the variables are wired up in the playbooks, molecule will run the sanity checks against your local dockerd, and then run the tests against the configured one - meaning your tests will randomly fail depending on whether you've got dockerd running locally, even though it's not used.
This change preserves the existing behaviour as far as possible as it still looks at the environment first and attempts to connect with defaults. If that fails, it then looks for connection details specified as attributes in each platform entry. It should also be possible to run tests on different dockerd instances (e.g. to target aarch64 and x86_64).
Some changes were needed to create/destroy.yml, as the connection variables weren't used for the network create/update operations.
Error handling is improved a little, as it wasn't obvious why the 'sanity' checks were failing.
There are some CI failures, but I believe they're unrelated.
With two platforms defined - one pointing to
unix:///Users/adamb/.rd/docker.sockand the other tounix:///Users/adamb/.rd/docker2.sock