Skip to content

Commit

Permalink
fix support for --container-tool-extra-args
Browse files Browse the repository at this point in the history
  • Loading branch information
chr15p authored and kwozyman committed Nov 11, 2024
1 parent 103e7ae commit 50ec083
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ $ python3 -m fab build --fabfile Fabfile.example
```

The above will trigger container image builds in sequence for each of the modules and the final one at the end.


Debugging messages can be enabled in fab with the `--log-level debug` switch, and in the underlying podman call with the `--container-tool-extra-args` switch:

```
$ python3 -m fab --container-tool-extra-args="--log-level debug" --log-level debug build --fabfile Fabfile.example
```
2 changes: 1 addition & 1 deletion fab/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _cmdargs(self):
default='/usr/bin/podman')
parser.add_argument('--container-tool-extra-args',
help='container tool extra arguments',
default=[])
default="")

subparsers = parser.add_subparsers(dest='command')
subparsers.required = False
Expand Down
8 changes: 3 additions & 5 deletions fab/fab.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Fab:
Fabfile definition
"""

def __init__(self, source, container_tool='/usr/bin/podman', tool_args=[]):
def __init__(self, source, container_tool='/usr/bin/podman', tool_args=""):
self.source = source
self.name = source
self.container_tool = container_tool
Expand Down Expand Up @@ -97,8 +97,7 @@ def build(self):
tag = '{}-stage-{}'.format(
self.name,
module.name)
podman_args = []
podman_args.append(self.tool_args)
podman_args = self.tool_args.split()
podman_args.append('build')
podman_args.append('--from')
podman_args.append(previous_container_image)
Expand All @@ -114,8 +113,7 @@ def build(self):
logging.info('Start build of {} stage'.format(tag))
self._run(self.container_tool, podman_args, module.working_dir)
previous_container_image = tag
podman_args = []
podman_args.append(self.tool_args)
podman_args = self.tool_args.split()
podman_args.append('tag')
podman_args.append(previous_container_image)
podman_args.append(self.name)
Expand Down

0 comments on commit 50ec083

Please sign in to comment.