Role meta data platform key broken?

I might have missed the memo, but is the galaxy_info.platforms: key gone or deprecated with the new Galaxy?

ansible-lint gives me: schema[meta]: $.galaxy_info.platforms[1].versions[0] 'Stretch' is not one of ['6.1', '7.1', '7.2', 'all']. See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#using-role-dependencies which is both confusing and the link seems unrelated.

This is an excerpt of my meta/main.yml:

  platforms:
    - name: Debian
      versions:
        - Stretch
        - Buster
        - Bullseye
    - name: Ubuntu
      versions:
        - Xenial
        - Bionic
        - Focal
        - Jammy

The role is part of a collection, but ansible-lint runs against the roles directory.

Also with the old API at https://galaxy.ansible.com/api/v1/platforms/ gone, I also cannot look up, what is expected of me.

P.S.: This is a link to my Github actions, if one wants to take a peek: Linting · Workflow runs · thorian93/main · GitHub

P.P.S.: To whom it may concern: The template for a new message has a typo:
- Include relavant logs from the issue

1 Like

Use lower case for the versions:

  platforms:
    - name: Debian
      versions:
        - bookworm
        - bullseye
        - buster
1 Like

Thanks! I will test that.

Follow-up question: I get the same error for EL, where versions are used. No matter, if it is 6, 7 or 8, I get the same error as above. Even if I change it to e.g., 7.1, the message remains.

I feel like this is more like a red herring.

I only test on Debian and Ubuntu so I don’t know, but you could try quoting the version numbers to ensure they are strings and not integers to see if that helps?

Based on the error message:
schema[meta]: $.galaxy_info.platforms[1].versions[0] 'Stretch' is not one of ['6.1', '7.1', '7.2', 'all']. [...]
I am very certain, that the way I note the platforms is not the issue. It gives me only four options: ['6.1', '7.1', '7.2', 'all']
And even using one of those does not seem to do the trick.

Maybe someone else has an idea? I will test this sometime though, perhaps I can find a workaround. But either my mistake is borderline stupid, or something is broken. I don’t care which it is, as long as I can figure it out. :slight_smile:

If the error message involves Stretch, you didn’t use the correct form, which is lowercase. That would be stretch.

The limit to ['6.1', '7.1', '7.2', 'all'] is likely an artefact of the schema validation: since it cannot match the whole dict you provided to any of the schemes it knows, it takes the list of values from the first schema, which happens to be for name=AIX and has exactly these four values.

Simply fix the casing as @chris pointed out.

1 Like

@gwmngilfen ^ (adding some more text to reach 20 characters)

2 Likes

This seems like a bug to me.

The actual schema for this used by Ansible-Lint is found here:
ansible-lint/src/ansiblelint/schemas/meta.json at main · ansible/ansible-lint (github.com)

It should report that the given list for the Debian platform does not match: ["bookworm","bullseye","buster","etch","jessie","lenny","sid","squeeze","stretch","trixie", "wheezy","all"], but instead is returning the supported versions for the AIX platform (the very first platform in the list).

@ssbarnea is this a known or previously fixed issue? I see a couple of recently closed related issues, but I didn’t see any PR’s. Just mention that you have to quote integers. In this case, we’re not using integers, we’re using strings with incorrect casing, but the error message is entirely unhelpful because it doesn’t match the platform in question.

platforms is ignored in the current version of galaxy, we are in the middle of removing it from the generator template in core.

2 Likes

Fixed. thanks to you both for pointing this out (and to discourse for ensuring I have to type 20 chars to reply)

2 Likes

So I am good to remove it entirely from my roles, as the Galaxy will not support now or in the forseeable future?

Thanks @samccann for the quick fix!

yep ‘now i need to fill 20 chars’

1 Like

hehe here’s something to fill your 20 chars - Is the meta/main.yml settings fully defined somewhere so we can link to them from the docs? There’s been more than one question in this area lately. See Improve meta/main.yml documentation for roles · Issue #1241 · ansible/ansible-documentation · GitHub

1 Like