Skip to content

CLI: bug with boolean docker options when substituting #968

@bertbesser

Description

@bertbesser

This workflow uses a boolean docker option

steps:
- id: hello
  uses: "docker://alpine"
  runs: ['sh', '-c']
  args: ['echo hello ${WHO}']
  env:
    WHO: $_WHO
  options:
    auto_remove: true

When running it via ./popper run --substitution _WHO=bert -f wf.yml the following error arises:

[...]
  File "/usr/local/lib/python3.7/site-packages/popper/commands/cmd_run.py", line 179, in cli
    allow_loose=allow_loose,
  File "/usr/local/lib/python3.7/site-packages/popper/parser.py", line 113, in parse
    _wf_data, substitutions=substitutions, allow_loose=allow_loose
  File "/usr/local/lib/python3.7/site-packages/popper/parser.py", line 198, in __apply_substitutions
    step[attr], k, v, used
  File "/usr/local/lib/python3.7/site-packages/popper/parser.py", line 144, in __apply_substitution
    if k in wf_element[ek]:
TypeError: argument of type 'bool' is not iterable

Trying to solve the issue making the bool a string (auto_remove: "true") gives the following error:

[...]
ERROR: 500 Server Error: Internal Server Error ("json: cannot unmarshal string into Go struct field HostConfig.AutoRemove of type bool")

I.e., the docker daemon will not handle a string but demands a bool.

Side note: The problem does not arise when no substitutions are given.

Expected behavior: Bc the docker daemon demands a boolean value, the bug should be fixed by making the substitutions code handle boolean values gracefully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions