Repository navigation
Conversation
There was a problem hiding this comment.
As already stated on IRC, I have a hard time justifying this functionality in the Molecule. I would much rather document how to set up a collection development environment and then let molecule run ansible from within the collection where it can automatically use the content without installing it.
|
|
||
| :return: None | ||
| """ | ||
| if os.path.isfile("galaxy.yml"): |
There was a problem hiding this comment.
This check is too naive to be effective. For example, we have our molecule scenarios stored under tests/integration/molecule, which means that we run Molecule from the tests/integration collection subfolder where galaxy.yml file will never be found.
There was a problem hiding this comment.
I will address this because molecule already looks for repository root location as is used in config file lookup, so we should be able to re-use repo-root path and avoid depending on cwd.
| dist = Path(self._config.scenario.ephemeral_directory) / "dist" | ||
| dist.mkdir(parents=True, exist_ok=True) | ||
| result = util.run_command( | ||
| f"ansible-galaxy collection build -v -f --output-path {dist}", |
There was a problem hiding this comment.
Again, this build command is too naive because it assumes that we are running molecule from the collection root. And there is another problem: users might need to some something else before they build the collection artifact. Because ansible-galaxy collection build command is really primitive, there is usually quite a few steps we need to perform before we get to building (or we risk packaging together things like virtual environments, coverage reports - and the are huge BTW, etc.).
If run inside a collection repository dependency step will first build and install the current collection. This avoids failure to run test scenarios unless user already installed the collection. Fixes: #2997
|
This will address an issue I am currently encountering where trying to get Molecule to pick up an existing collection is difficult but also causes any other collections on my development machine to be overwritten by the ansibile-galaxy command. |
There was a problem hiding this comment.
This would be a wonderful improvement to my current development cycle.
| :return: None | ||
| """ | ||
| workdir = util.find_vcs_root(self._config.project_directory) | ||
| collection_marker = os.path.join(workdir, "galaxy.yml") |
There was a problem hiding this comment.
What if galaxy.yml doesn't live at the root of the current VCS?
|
I think there first needs to be some consensus (and documentation) on where the |
|
Closing in favour of #3077 which is reusing ansible-lint prerun code. |
If run inside a collection repository dependency step will first
build and install the current collection. This avoids failure to
run test scenarios unless user already installed the collection.
Fixes: #2997