Skip to content

Commit e991c1a

Browse files
authored
Revert "[RFE] Support for tags from the configuration file (#555)" (#655)
This reverts commit 317b132.
1 parent 0563a9d commit e991c1a

File tree

6 files changed

+9
-38
lines changed

6 files changed

+9
-38
lines changed

demo/execution-environment.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ images:
1010

1111
options:
1212
user: '1000' # (optional) sets the username or UID
13-
# tags: # (optional) sets tags
14-
# - 'ee_development:latest'
1513

1614
dependencies:
1715
python_interpreter:

docs/definition.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,6 @@ builder runtime functionality. Valid keys for this section are:
361361
This sets the username or UID to use as the default user for the final container image.
362362
The default value ``1000``.
363363

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

368365
Example ``options`` section:
369366

@@ -379,8 +376,6 @@ Example ``options`` section:
379376
skip_ansible_check: true
380377
workdir: /myworkdir
381378
user: bob
382-
tags:
383-
- ee_development:latest
384379
385380
version
386381
^^^^^^^

src/ansible_builder/cli.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,13 @@ def parse_args(args=None):
194194

195195
add_container_options(subparsers)
196196

197-
return parser.parse_args(args)
197+
args = parser.parse_args(args)
198+
199+
# Tag default must be handled differently. See comment for --tag option.
200+
if 'tag' not in vars(args) or not args.tag:
201+
args.tag = [constants.default_tag]
202+
203+
return args
198204

199205

200206
class BuildArgAction(argparse.Action):

src/ansible_builder/ee_schema.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329
},
330330

331331
"options": {
332-
"description": "Options that affect the runtime behavior",
332+
"description": "Options that effect runtime behavior",
333333
"type": "object",
334334
"additionalProperties": False,
335335
"properties": {
@@ -372,14 +372,6 @@
372372
},
373373
},
374374
},
375-
"tags": {
376-
"description": "A list of names to assign to the resulting image if build process completes successfully",
377-
"type": "array",
378-
"items": {
379-
"type": "string"
380-
}
381-
382-
},
383375
},
384376
},
385377
},
@@ -452,4 +444,3 @@ def _handle_options_defaults(ee_def: dict):
452444
'cmd': '["bash"]',
453445
})
454446
options.setdefault('user', '1000')
455-
options.setdefault('tags', [])

src/ansible_builder/main.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ def __init__(self,
4646
self.definition = UserDefinition(filename=filename)
4747
self.definition.validate()
4848

49-
self.tags = [constants.default_tag]
50-
if self.definition.version >= 3 and self.definition.options['tags']:
51-
self.tags = self.definition.options['tags']
52-
53-
if tag:
54-
self.tags = tag
55-
49+
self.tags = tag or []
5650
self.build_context = build_context
5751
self.build_outputs_dir = os.path.join(
5852
build_context, constants.user_content_subfolder)

test/unit/test_user_definition.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -241,19 +241,6 @@ def test_v3_set_user_name(self, exec_env_definition_file):
241241
value = definition.raw.get('options', {}).get('user')
242242
assert value == 'bob'
243243

244-
def test_v3_set_tags(self, exec_env_definition_file):
245-
"""
246-
Test that options.tags sets to tags
247-
"""
248-
path = exec_env_definition_file(
249-
"{'version': 3, 'options': {'tags': ['ee_test:latest']}}"
250-
)
251-
definition = UserDefinition(path)
252-
definition.validate()
253-
254-
value = definition.raw.get('options', {}).get('tags')
255-
assert value == ['ee_test:latest']
256-
257244

258245
class TestImageDescription:
259246

0 commit comments

Comments
 (0)