Closed alikins closed 5 years ago
ping @chouseknecht @thaumos
@chouseknecht @thaumos A couple of open questions about this feature:
The "correct" location for plugins and modules in a collection is different than traditional roles ie,
collection: mycollection/plugins/callback/mycallback.py trad role: myrole/callback_plugins/mycallback.py
Should migrate_role move these? For this particular case of creating a collection with one role, there aren't any naming conflicts to worry about, so moving the plugins is doable.
Downside is it means mazer has to continue to know the mapping between old style plugin dirs and the collection style (ie, 'filter_plugins' -> 'plugins/filter', 'library/' -> 'plugins/modules', etc)
Another downside is that some plugins may not work in a collection. I don't have a specific example of this case, but discussions in the past indicated that some plugins that can be included in roles currently will not work in collections.
Based on the new collection loader branch of ansible/ansible, it looks likely that existing plugins and modules will require source code changes to work via collections.
I am assuming that modifying the plugin/module source code is out of scope for this request. Safe assumption?
Would this be for migrating any traditional role or just galaxy style traditional roles?
For determining the version of the existing role, for galaxy style roles migrate_role would have to assume there is a git repo and try to extract a version from the git tags.
There is no version info for roles that are not in a dedicated git repo (ie, when a git repo has multiple roles in it) and has to be provided as a cli option for migrate_role.
For the galaxy style repo ('ansible-role-foo' with versions tagged) is it worthwhile to try to determine the version automatically? Or just require it to be specified.
Should migrate_role attempt to translate trad role license identifiers to collection spdx style ids?
ie, a traditional role may have it's meta/main.yml 'license' attribute be 'GPL', but that is not a valid license id for the stricter collections format (where 'GPL-3.0-or-later' or such is required).
Responses to previous comment...
One point I want to make aside from this... Let's make sure we aren't marrying ourselves to mazer being the entry point to this. I want this ultimately to be a molecule thing later.
@thaumos "* Source code modification: We should not have any tooling do modification. I hope I understand you correctly."
To clarify, I do not want mazer migrate_role to modify a roles plugin or module source code. This branch does not modify role plugin or module source code. And we agree that mazer migraterole should not modify the role plugin or module source code, even if that means plugins and modules used via the new collection loader will not work without further modification_.
@thaumos
- Role type migration: I think Galaxy roles is for our MVP. If we can do non-Galaxy roles later, then cool. However, let's not block ourselves. For version, let's have them specify.
Currently (d293ee1164fc550c76272359c7a5a3e1b0b53e9e) migrate_role does no "auto" detection of version, and the version of the new collection must be specified with '--version'. That includes galaxy style roles and any others.
Adding some git based "auto" detection of the role version based on git tags could be added later however.
@thaumos
License determination: No, let's not try to interpret. Have them specify.
Seems reasonable, I'll add a way to specify.
I'll start with behavior like:
And assuming no difficulties, also:
Feature Request
To ease transitional from traditional style roles to the newer collection format, it would be useful to be able to convert a traditional style role into a collection that contains that role.
Use Case
What problem does this feature solve? Please describe. A clear and concise description of what the problem is. Ex. I have an issue when [...]
At some point, mazer will stop installing traditional style roles directly and will only support collections. To make it easier for users to use mazer and ansible 2.8 with collections, and to continue using traditional style releases with older ansible releases, this feature would provide way to convert an on disk traditional role repository, to a collection style repository.
Proposed Solution
Describe the solution you'd like A clear and concise description of what you want to happen. Add any considered drawbacks.
mazer 'convert-role'[1], when pointed at a directory with a role in it:
For ex, transform a role like:
to:
There is existing code to do most of that, as it is used as implementation details of how
mazer install
installs traditional style roles as collections currently (a59757e5cbab905f63ecc8a1d468b7963da918a5)Main drawbacks/concerns
[1] not final name
Alternatives
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Implementation
Teachability, Documentation, Adoption, Migration Strategy
mazer migrate-role-to-collection --namespace some_namespace --name some_name some_role/ --output-dir ./some_collection/