ansible / ansible-builder

An Ansible execution environment builder
Other
289 stars 93 forks source link

unable to specify tags in execution-environment.yml #620

Closed mwtrigg closed 11 months ago

mwtrigg commented 11 months ago

When specifying the following in my yml file

options:
  tags:
    - environment:latest

The command immediately fails and spits out this return:

jsonschema.exceptions.ValidationError: Additional properties are not allowed ('tags' was unexpected)

Failed validating 'additionalProperties' in schema['properties']['options']:
    {'additionalProperties': False,
     'description': 'Options that effect runtime behavior',
     'properties': {'container_init': {'additionalProperties': False,
                                       'description': 'Customize container '
                                                      'startup behavior',
                                       'properties': {'cmd': {'description': 'literal '
                                                                             'value '
                                                                             'for '
                                                                             'CMD '
                                                                             'Containerfile '
                                                                             'directive',
                                                              'type': 'string'},
                                                      'entrypoint': {'description': 'literal '
                                                                                    'value '
                                                                                    'for '
                                                                                    'ENTRYPOINT '
                                                                                    'Containerfile '
                                                                                    'directive',
                                                                     'type': 'string'},
                                                      'package_pip': {'description': 'package '
                                                                                     'to '
                                                                                     'install '
                                                                                     'via '
                                                                                     'pip '
                                                                                     'for '
                                                                                     'entrypoint '
                                                                                     'support',
                                                                      'type': 'string'}},
                                       'type': 'object'},
                    'package_manager_path': {'description': 'Path to the '
                                                            'system '
                                                            'package '
                                                            'manager to '
                                                            'use',
                                             'type': 'string'},
                    'relax_passwd_permissions': {'description': 'allows '
                                                                'GID0 '
                                                                'write '
                                                                'access to '
                                                                '/etc/passwd; '
                                                                'currently '
                                                                'necessary '
                                                                'for many '
                                                                'uses',
                                                 'type': 'boolean'},
                    'skip_ansible_check': {'description': 'Disables the '
                                                          'check for '
                                                          'Ansible/Runner '
                                                          'in final image',
                                           'type': 'boolean'},
                    'user': {'description': 'Sets the username or UID',
                             'type': 'string'},
                    'workdir': {'description': 'Default working directory, '
                                               'also often the homedir for '
                                               'ephemeral UIDs',
                                'type': ['string', 'null']}},
     'type': 'object'}

On instance['options']:
    {'tags': 'environment:latest'}

During handling of the above exception, another exception occurred:
ansible_builder.exceptions.DefinitionError: Additional properties are not allowed ('tags' was unexpected)

When removing that from my yml, and adding --tag=environment:latest the command proceeds.

I appear to be following the syntax as documented.

Shrews commented 11 months ago

This is a new feature in an unreleased version. The stable release version of the builder documentation (https://ansible.readthedocs.io/projects/builder/en/stable/definition/#options) does not mention this tag (if you select the latest version of that documentation, that will be the unreleased version of the docs).

Shrews commented 11 months ago

Seems to be a mismatch between doc version being referenced and builder version in use, so closing this issue.