Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: retain workspace volume when volumes option is set #970

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ech0-de
Copy link

@ech0-de ech0-de commented Mar 9, 2021

Currently the workspace bind mount is overwritten when setting the volumes property in the steps' options field.

Popper Version: 2020.09.1

Minimal Working Example:

$ cat wf.yml
steps:

- uses: "docker://alpine:3.11"
  options:
    volumes:
     - /dev/zero:/tmp/test
  args: ["cat", "wf.yml"]

$ popper run -f wf.yml
[1] docker pull alpine:3.11
[1] docker create name=popper_1_c25e08ff image=alpine:3.11 command=['cat', 'wf.yml']
[1] docker start
cat: can't open 'wf.yml': No such file or directory
ERROR: Step '1' failed ('1') !

This behavior can be worked around by using docker-py's mount option instead of the volumes option, but the behavior of the volumes option seems unintuitive to me.

This pull request retains the workspace mount, by appending it to the volumes list after the update call with the step specific options.

In case anyone else stumbles over this behavior before this behavior is changed (or if the behavior is intentional) the following workflow works as intended. However, keep in mind that the mounts option requires you to specify the mount type, which would be inferred when using the volumes option.

steps:

- uses: "docker://alpine:3.11"
  options:
    mounts:
    - { 'source': '/dev/zero', 'target': '/tmp/test', 'type': 'bind', 'read_only': false }
  args: ["cat", "wf.yml"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant