Skip to content

Commit

Permalink
Revert "[RFE] Support for tags from the configuration file (#555)" (#655
Browse files Browse the repository at this point in the history
)

This reverts commit 317b132.
  • Loading branch information
Shrews authored Feb 21, 2024
1 parent 0563a9d commit e991c1a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 38 deletions.
2 changes: 0 additions & 2 deletions demo/execution-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ images:

options:
user: '1000' # (optional) sets the username or UID
# tags: # (optional) sets tags
# - 'ee_development:latest'

dependencies:
python_interpreter:
Expand Down
5 changes: 0 additions & 5 deletions docs/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,6 @@ builder runtime functionality. Valid keys for this section are:
This sets the username or UID to use as the default user for the final container image.
The default value ``1000``.

``tags``
Specifies the name which is assigned to resulting image if build process completes successfully.
The default value is ``ansible-execution-env:latest``.

Example ``options`` section:

Expand All @@ -379,8 +376,6 @@ Example ``options`` section:
skip_ansible_check: true
workdir: /myworkdir
user: bob
tags:
- ee_development:latest
version
^^^^^^^
Expand Down
8 changes: 7 additions & 1 deletion src/ansible_builder/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ def parse_args(args=None):

add_container_options(subparsers)

return parser.parse_args(args)
args = parser.parse_args(args)

# Tag default must be handled differently. See comment for --tag option.
if 'tag' not in vars(args) or not args.tag:
args.tag = [constants.default_tag]

return args


class BuildArgAction(argparse.Action):
Expand Down
11 changes: 1 addition & 10 deletions src/ansible_builder/ee_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
},

"options": {
"description": "Options that affect the runtime behavior",
"description": "Options that effect runtime behavior",
"type": "object",
"additionalProperties": False,
"properties": {
Expand Down Expand Up @@ -372,14 +372,6 @@
},
},
},
"tags": {
"description": "A list of names to assign to the resulting image if build process completes successfully",
"type": "array",
"items": {
"type": "string"
}

},
},
},
},
Expand Down Expand Up @@ -452,4 +444,3 @@ def _handle_options_defaults(ee_def: dict):
'cmd': '["bash"]',
})
options.setdefault('user', '1000')
options.setdefault('tags', [])
8 changes: 1 addition & 7 deletions src/ansible_builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@ def __init__(self,
self.definition = UserDefinition(filename=filename)
self.definition.validate()

self.tags = [constants.default_tag]
if self.definition.version >= 3 and self.definition.options['tags']:
self.tags = self.definition.options['tags']

if tag:
self.tags = tag

self.tags = tag or []
self.build_context = build_context
self.build_outputs_dir = os.path.join(
build_context, constants.user_content_subfolder)
Expand Down
13 changes: 0 additions & 13 deletions test/unit/test_user_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,6 @@ def test_v3_set_user_name(self, exec_env_definition_file):
value = definition.raw.get('options', {}).get('user')
assert value == 'bob'

def test_v3_set_tags(self, exec_env_definition_file):
"""
Test that options.tags sets to tags
"""
path = exec_env_definition_file(
"{'version': 3, 'options': {'tags': ['ee_test:latest']}}"
)
definition = UserDefinition(path)
definition.validate()

value = definition.raw.get('options', {}).get('tags')
assert value == ['ee_test:latest']


class TestImageDescription:

Expand Down

0 comments on commit e991c1a

Please sign in to comment.