docker-compose-buildkite-plugin icon indicating copy to clipboard operation
docker-compose-buildkite-plugin copied to clipboard

Allow interpolation for `volumes`

Open ngan opened this issue 3 years ago • 0 comments

I'm using the plugin like such:

  - docker-compose#v3.9.0:
      run: coolapp
      ansi: false
      volumes:
      - "$$PATH_TO_MY_BINARY:/usr/bin/foobar"

But when this executes, the $PATH_TO_MY_BINARY is not interpolated in bash. It used as a raw argument in the docker-compose command:

$ docker-compose -f .buildkite/docker-compose.yml -p buildkite40d06312fc41497a96f8fa4f5e0d70e8 --no-ansi run --name buildkite40d06312ac41497a96f8fa4f5e0d70e8_coolapp_build_513190 -v $PATH_TO_MY_BINARY:/usr/bin/cache --rm coolapp /bin/sh -e -c 'dosomething'

Cannot create container for service coolapp: create $PATH_TO_MY_BINARY: "$PATH_TO_MY_BINARY" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path

I can't seem to tell where along the way does the interpolation fail to happen? https://github.com/buildkite-plugins/docker-compose-buildkite-plugin/blob/master/commands/run.sh#L94-L96 https://github.com/buildkite-plugins/docker-compose-buildkite-plugin/blob/master/lib/shared.bash#L37-L39 https://github.com/buildkite-plugins/docker-compose-buildkite-plugin/blob/master/lib/shared.bash#L42-L57

ngan avatar Apr 11 '22 23:04 ngan