buildkite-plugins/docker-buildkite-plugin

Unfurl command for docker run

pecigonzalo opened this issue · 6 comments

Commands passed to docker run should be unfurled, otherwise they do not work as intended, for example the node snipped from the readme:

  - command:
      - "yarn install"
      - "yarn run test"
    plugins:
      - docker#v3.1.0:
          image: "node:7"
          always-pull: true
          environment:
            - "MY_SECRET_KEY"
            - "MY_SPECIAL_BUT_PUBLIC_VALUE=kittens"

would output:

yarn run test' in node:7
--
  | docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"yarn install\\nyarn run test\": executable file not found in $PATH": unknown.
  | 🚨 Error: The command exited with status 127

This is because its like doing:
docker run --rm node:7 "yarn install" instead of docker run --rm node:7 yarn install

Line:

( if is_windows ; then export MSYS_NO_PATHCONV=1; fi && docker run "${args[@]}" )

should probably change to

[...] docker run ${args[@]}
lox commented

That's really odd, that is supposed to work 🤔 Let me test this.

For some context, check out "Improved Shell Handling" in https://github.com/buildkite-plugins/docker-buildkite-plugin/releases/tag/v2.0.0 for how it's supposed to work.

lox commented

This seems to work ok for me. It should be executing:

/bin/sh -e -c 'yarn install
yarn run test'

Which is totally correct.

lox commented

I'll close this one for now, let me know if I've misunderstood!

Yep, that output would be totally correct. I wonder if this was an error of the node image, as I put on my first comment, that was not the output I was getting out of it.

lox commented

Yeah, that's really strange 🤔 If you happen to see it again, send us the build and we will investigate!

I tried just now and this is working as expected, im confused as I had a build with it configured as described in the issue desc, but my build its now removed as I deleted the pipeline. If I can replicate again or find the build, ill post here.
For now, this seems to be something else and not the plugin.

Thanks